From 803f745e23dc4ffc4bb232da4ed05c5401c3bd86 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Mon, 9 Oct 2017 16:27:48 +0200 Subject: [PATCH] SONAR-8524 update rule inheritance indicator when rule activation is changed --- .../src/main/js/apps/coding-rules/controller.js | 15 +++++++++++++++ .../apps/coding-rules/rule/rule-profiles-view.js | 1 + .../templates/rule/coding-rules-rule-profile.hbs | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/server/sonar-web/src/main/js/apps/coding-rules/controller.js b/server/sonar-web/src/main/js/apps/coding-rules/controller.js index e659ea1fbfd..8545fcfada6 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/controller.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/controller.js @@ -179,5 +179,20 @@ export default Controller.extend({ const ruleView = this.app.workspaceListView.children.findByModel(rule); ruleView.$('.coding-rules-detail-quality-profile-deactivate').click(); } + }, + + updateActivation(rule, actives) { + const selectedProfile = this.options.app.state.get('query').qprofile; + if (selectedProfile) { + const profile = (actives || []).find(activation => activation.qProfile === selectedProfile); + const listRule = this.app.list.get(rule.id); + if (profile && listRule) { + listRule.set('activation', { + ...listRule.get('activation'), + inherit: profile.inherit, + severity: profile.severity + }); + } + } } }); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js index 25658dd0deb..cc2db14af0d 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js @@ -81,6 +81,7 @@ export default Marionette.CompositeView.extend({ that.collection.reset( that.model.getInactiveProfiles(data.actives, that.options.app.qualityProfiles) ); + this.options.app.controller.updateActivation(this.model, data.actives); }); }, diff --git a/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-rule-profile.hbs b/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-rule-profile.hbs index e65ab663892..c4667774c96 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-rule-profile.hbs +++ b/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-rule-profile.hbs @@ -11,7 +11,7 @@ {{#if parent}}
{{#eq inherit 'OVERRIDES'}} - + {{/eq}} {{#eq inherit 'INHERITED'}} -- 2.39.5