aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/permission-templates/update-view.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/apps/permission-templates/update-view.js')
-rw-r--r--server/sonar-web/src/main/js/apps/permission-templates/update-view.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/update-view.js b/server/sonar-web/src/main/js/apps/permission-templates/update-view.js
new file mode 100644
index 00000000000..38e546b820d
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/permission-templates/update-view.js
@@ -0,0 +1,27 @@
+import FormView from './form-view';
+import {updatePermissionTemplate} from '../../api/permissions';
+
+export default FormView.extend({
+ sendRequest: function () {
+ var that = this;
+ this.disableForm();
+ return updatePermissionTemplate({
+ data: {
+ id: this.model.id,
+ name: this.$('#permission-template-name').val(),
+ description: this.$('#permission-template-description').val(),
+ projectKeyPattern: this.$('#permission-template-project-key-pattern').val()
+ },
+ statusCode: {
+ // do not show global error
+ 400: null
+ }
+ }).done(function () {
+ that.options.refresh();
+ that.destroy();
+ }).fail(function (jqXHR) {
+ that.enableForm();
+ that.showErrors(jqXHR.responseJSON.errors, jqXHR.responseJSON.warnings);
+ });
+ }
+});