blob: 5ab77f11dc31456757334db1faef5e730edbfd33 (
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
28
29
30
31
32
33
34
35
36
37
38
|
import $ from 'jquery';
import ModalFormView from '../../components/common/modal-form';
import Template from './templates/quality-profiles-rename-profile.hbs';
export default ModalFormView.extend({
template: Template,
onFormSubmit: function () {
ModalFormView.prototype.onFormSubmit.apply(this, arguments);
this.sendRequest();
},
sendRequest: function () {
var that = this,
url = baseUrl + '/api/qualityprofiles/rename',
name = this.$('#rename-profile-name').val(),
options = {
key: this.model.get('key'),
name: name
};
return $.ajax({
type: 'POST',
url: url,
data: options,
statusCode: {
// do not show global error
400: null
}
}).done(function () {
that.model.set({ name: name });
that.destroy();
}).fail(function (jqXHR) {
that.showErrors(jqXHR.responseJSON.errors, jqXHR.responseJSON.warnings);
});
}
});
|