blob: 49cd86ef4af6a76516233c921419147e2808bf35 (
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
39
40
|
import $ from 'jquery';
import ModalFormView from '../../components/common/modal-form';
import Template from './templates/quality-profiles-delete-profile.hbs';
export default ModalFormView.extend({
template: Template,
modelEvents: {
'destroy': 'destroy'
},
onFormSubmit: function () {
ModalFormView.prototype.onFormSubmit.apply(this, arguments);
this.disableForm();
this.sendRequest();
},
sendRequest: function () {
var that = this,
url = baseUrl + '/api/qualityprofiles/delete',
options = { profileKey: this.model.get('key') };
return $.ajax({
type: 'POST',
url: url,
data: options,
statusCode: {
// do not show global error
400: null
}
}).done(function () {
that.model.collection.fetch();
that.model.trigger('destroy', that.model, that.model.collection);
}).fail(function (jqXHR) {
that.showErrors(jqXHR.responseJSON.errors, jqXHR.responseJSON.warnings);
that.enableForm();
});
}
});
|