diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps/metrics/update-view.js')
-rw-r--r-- | server/sonar-web/src/main/js/apps/metrics/update-view.js | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/server/sonar-web/src/main/js/apps/metrics/update-view.js b/server/sonar-web/src/main/js/apps/metrics/update-view.js index ff8183fd5f5..fbc4807ff18 100644 --- a/server/sonar-web/src/main/js/apps/metrics/update-view.js +++ b/server/sonar-web/src/main/js/apps/metrics/update-view.js @@ -20,8 +20,7 @@ import FormView from './form-view'; export default FormView.extend({ - - sendRequest () { + sendRequest() { const that = this; this.model.set({ key: this.$('#create-metric-key').val(), @@ -31,18 +30,20 @@ export default FormView.extend({ type: this.$('#create-metric-type').val() }); this.disableForm(); - return this.model.save(null, { - statusCode: { - // do not show global error - 400: null - } - }).done(() => { - that.collection.refresh(); - that.destroy(); - }).fail(jqXHR => { - that.enableForm(); - that.showErrors(jqXHR.responseJSON.errors, jqXHR.responseJSON.warnings); - }); + return this.model + .save(null, { + statusCode: { + // do not show global error + 400: null + } + }) + .done(() => { + that.collection.refresh(); + that.destroy(); + }) + .fail(jqXHR => { + that.enableForm(); + that.showErrors(jqXHR.responseJSON.errors, jqXHR.responseJSON.warnings); + }); } }); - |