From 829d5b8d58690097727465868ddc5037b4397528 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Fri, 27 Mar 2015 16:03:00 +0100 Subject: [PATCH] do not show global error if the request is sent from modal window --- .../js/coding-rules/rule/custom-rule-creation-view.js | 10 +++++++++- .../js/coding-rules/rule/manual-rule-creation-view.js | 10 +++++++++- .../js/coding-rules/rule/profile-activation-view.js | 4 ++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/server/sonar-web/src/main/js/coding-rules/rule/custom-rule-creation-view.js b/server/sonar-web/src/main/js/coding-rules/rule/custom-rule-creation-view.js index e2dd5d78f48..ee0512e2af3 100644 --- a/server/sonar-web/src/main/js/coding-rules/rule/custom-rule-creation-view.js +++ b/server/sonar-web/src/main/js/coding-rules/rule/custom-rule-creation-view.js @@ -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 { diff --git a/server/sonar-web/src/main/js/coding-rules/rule/manual-rule-creation-view.js b/server/sonar-web/src/main/js/coding-rules/rule/manual-rule-creation-view.js index ead147351ba..d8e5fbfd3d3 100644 --- a/server/sonar-web/src/main/js/coding-rules/rule/manual-rule-creation-view.js +++ b/server/sonar-web/src/main/js/coding-rules/rule/manual-rule-creation-view.js @@ -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); } diff --git a/server/sonar-web/src/main/js/coding-rules/rule/profile-activation-view.js b/server/sonar-web/src/main/js/coding-rules/rule/profile-activation-view.js index 18362015704..2e2e0f9be56 100644 --- a/server/sonar-web/src/main/js/coding-rules/rule/profile-activation-view.js +++ b/server/sonar-web/src/main/js/coding-rules/rule/profile-activation-view.js @@ -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); -- 2.39.5