diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps/permission-templates/delete-view.js')
-rw-r--r-- | server/sonar-web/src/main/js/apps/permission-templates/delete-view.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/delete-view.js b/server/sonar-web/src/main/js/apps/permission-templates/delete-view.js new file mode 100644 index 00000000000..8f86bb0759d --- /dev/null +++ b/server/sonar-web/src/main/js/apps/permission-templates/delete-view.js @@ -0,0 +1,28 @@ +import ModalForm from '../../components/common/modal-form'; +import {deletePermissionTemplate} from '../../api/permissions'; +import Template from './templates/permission-templates-delete.hbs'; + +export default ModalForm.extend({ + template: Template, + + onFormSubmit: function () { + ModalForm.prototype.onFormSubmit.apply(this, arguments); + this.sendRequest(); + }, + + sendRequest: function () { + var that = this; + return deletePermissionTemplate({ + data: { templateId: this.model.id }, + statusCode: { + // do not show global error + 400: null + } + }).done(function () { + that.options.refresh(); + that.destroy(); + }).fail(function (jqXHR) { + that.showErrors(jqXHR.responseJSON.errors, jqXHR.responseJSON.warnings); + }); + } +}); |