diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-08-16 15:17:42 +0200 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-08-17 16:42:34 +0200 |
commit | 46bfe295d2c6984093ba506000e1de289a94a0e3 (patch) | |
tree | 09cb525c4fb38fa22742ec05349eece5fe6123f5 /server/sonar-web/src | |
parent | b085c7e3887dbca984d0211edf1c93a08972fced (diff) | |
download | sonarqube-46bfe295d2c6984093ba506000e1de289a94a0e3.tar.gz sonarqube-46bfe295d2c6984093ba506000e1de289a94a0e3.zip |
Add missing error messages in quality gates page
Diffstat (limited to 'server/sonar-web/src')
3 files changed, 19 insertions, 22 deletions
diff --git a/server/sonar-web/src/main/js/api/quality-gates.js b/server/sonar-web/src/main/js/api/quality-gates.js index 878c2e32dca..7bf0a0c73ef 100644 --- a/server/sonar-web/src/main/js/api/quality-gates.js +++ b/server/sonar-web/src/main/js/api/quality-gates.js @@ -18,29 +18,30 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { getJSON, post, postJSON } from '../helpers/request'; +import throwGlobalError from '../app/utils/throwGlobalError'; export function fetchQualityGatesAppDetails() { const url = '/api/qualitygates/app'; - - return getJSON(url); + return getJSON(url).catch(throwGlobalError); } export function fetchQualityGates() { const url = '/api/qualitygates/list'; - - return getJSON(url).then(r => - r.qualitygates.map(qualityGate => { - return { - ...qualityGate, - isDefault: qualityGate.id === r.default - }; - }) + return getJSON(url).then( + r => + r.qualitygates.map(qualityGate => { + return { + ...qualityGate, + isDefault: qualityGate.id === r.default + }; + }), + throwGlobalError ); } export function fetchQualityGate(id) { const url = '/api/qualitygates/show'; - return getJSON(url, { id }); + return getJSON(url, { id }).catch(throwGlobalError); } export function createQualityGate(name) { @@ -65,12 +66,12 @@ export function copyQualityGate(id, name) { export function setQualityGateAsDefault(id) { const url = '/api/qualitygates/set_as_default'; - return post(url, { id }); + return post(url, { id }).catch(throwGlobalError); } export function unsetQualityGateAsDefault(id) { const url = '/api/qualitygates/unset_default'; - return post(url, { id }); + return post(url, { id }).catch(throwGlobalError); } export function createCondition(gateId, condition) { @@ -97,13 +98,13 @@ export function getGateForProject(projectKey) { export function associateGateWithProject(gateId, projectKey) { const url = '/api/qualitygates/select'; const data = { gateId, projectKey }; - return post(url, data); + return post(url, data).catch(throwGlobalError); } export function dissociateGateWithProject(gateId, projectKey) { const url = '/api/qualitygates/deselect'; const data = { gateId, projectKey }; - return post(url, data); + return post(url, data).catch(throwGlobalError); } export function getApplicationQualityGate(application) { diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.js b/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.js index ca9c1af2283..81a6003f7dc 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Condition.js @@ -94,7 +94,7 @@ export default class Condition extends Component { onSaveCondition(condition, newCondition); onResetError(); }) - .catch(error => onError(error)); + .catch(onError); } handleUpdateClick(e) { @@ -123,7 +123,7 @@ export default class Condition extends Component { onSaveCondition(condition, newCondition); onResetError(); }) - .catch(error => onError(error)); + .catch(onError); } handleDeleteClick(e) { diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/Details.js b/server/sonar-web/src/main/js/apps/quality-gates/components/Details.js index 4d9893fbff3..07070991007 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/Details.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/Details.js @@ -45,11 +45,7 @@ export default class Details extends React.PureComponent { fetchDetails() { const { id } = this.props.params; - const { onShow } = this.props; - - fetchQualityGate(id).then(qualityGate => { - onShow(qualityGate); - }); + fetchQualityGate(id).then(qualityGate => this.props.onShow(qualityGate)); } handleRenameClick() { |