]> source.dussan.org Git - sonarqube.git/commitdiff
do not show global error if the request is sent from modal window
authorStas Vilchik <vilchiks@gmail.com>
Fri, 27 Mar 2015 15:03:00 +0000 (16:03 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Fri, 27 Mar 2015 16:54:41 +0000 (17:54 +0100)
server/sonar-web/src/main/js/coding-rules/rule/custom-rule-creation-view.js
server/sonar-web/src/main/js/coding-rules/rule/manual-rule-creation-view.js
server/sonar-web/src/main/js/coding-rules/rule/profile-activation-view.js

index e2dd5d78f48e9b6ac753128794c0f38835ff4d78..ee0512e2af3271f66e805849f7ec165b71cee791 100644 (file)
@@ -157,7 +157,15 @@ define([
       this.$('.modal-warning').hide();
       var that = this,
           url = baseUrl + '/api/rules/' + action;
-      return $.post(url, options).done(function () {
+      return $.ajax({
+        url: url,
+        type: 'POST',
+        data: options,
+        statusCode: {
+          // do not show global error
+          400: null
+        }
+      }).done(function () {
         if (that.options.templateRule) {
           that.options.app.controller.showDetails(that.options.templateRule);
         } else {
index ead147351ba79150ffb613724e598cc88e00ff4b..d8e5fbfd3d31a66ce85494aa74b2bd9f0647f656 100644 (file)
@@ -105,7 +105,15 @@ define([
       this.$('.modal-warning').hide();
       var that = this,
           url = baseUrl + '/api/rules/' + action;
-      return $.post(url, options).done(function (r) {
+      return $.ajax({
+        url: url,
+        type: 'POST',
+        data: options,
+        statusCode: {
+          // do not show global error
+          400: null
+        }
+      }).done(function (r) {
         if (typeof r === 'string') {
           r = JSON.parse(r);
         }
index 1836201570406eeecadb5588d21679867c2e3c85..2e2e0f9be56a0f75914cf3581a0a2223bc701054 100644 (file)
@@ -103,6 +103,10 @@ define([
           rule_key: ruleKey,
           severity: severity,
           params: paramsHash
+        },
+        statusCode: {
+          // do not show global error
+          400: null
         }
       }).done(function () {
         that.trigger('profileActivated', severity, params);