aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/custom-measures/update-view.js
blob: 4b3fae8384b3626f60b2ffd5fe3bc107e2baac6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import FormView from './form-view';

export default FormView.extend({

  sendRequest: function () {
    var that = this;
    this.model.set({
      value: this.$('#create-custom-measure-value').val(),
      description: this.$('#create-custom-measure-description').val()
    });
    this.disableForm();
    return this.model.save(null, {
      statusCode: {
        // do not show global error
        400: null
      }
    }).done(function () {
      that.collection.refresh();
      that.destroy();
    }).fail(function (jqXHR) {
      that.enableForm();
      that.showErrors(jqXHR.responseJSON.errors, jqXHR.responseJSON.warnings);
    });
  }
});