aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/coding-rules
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-09-16 15:21:31 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-09-16 15:24:10 +0200
commit6de86daae8f53f77a2c5a75b1f8eceb7c6cc5ccc (patch)
tree9746fa6c4a3b457db988e0cb8827b845012b2bd1 /server/sonar-web/src/main/js/apps/coding-rules
parent937ac93f4d23638cedcec44629a571e06a14a6f3 (diff)
downloadsonarqube-6de86daae8f53f77a2c5a75b1f8eceb7c6cc5ccc.tar.gz
sonarqube-6de86daae8f53f77a2c5a75b1f8eceb7c6cc5ccc.zip
SONAR-6598 scroll index should be saved when (de-)activating a rule in a profile
Diffstat (limited to 'server/sonar-web/src/main/js/apps/coding-rules')
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/models/rule.js10
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js9
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js12
4 files changed, 24 insertions, 13 deletions
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/models/rule.js b/server/sonar-web/src/main/js/apps/coding-rules/models/rule.js
index 51993df4b98..9610739b9dd 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/models/rule.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/models/rule.js
@@ -32,6 +32,16 @@ define(function () {
isManual: isManual,
isCustom: isCustom
}, { silent: true });
+ },
+
+ getInactiveProfiles: function (actives, profiles) {
+ return actives.map(function (profile) {
+ var profileBase = _.findWhere(profiles, { key: profile.qProfile });
+ if (profileBase != null) {
+ _.extend(profile, profileBase);
+ }
+ return profile;
+ });
}
});
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js
index 05856342aa4..da7f6a865e0 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js
@@ -116,14 +116,7 @@ define([
},
getQualityProfiles: function () {
- var that = this;
- return this.options.actives.map(function (profile) {
- var profileBase = _.findWhere(that.options.app.qualityProfiles, { key: profile.qProfile });
- if (profileBase != null) {
- _.extend(profile, profileBase);
- }
- return profile;
- });
+ return this.model.getInactiveProfiles(this.options.actives, this.options.app.qualityProfiles);
},
bindShortcuts: function () {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js
index 42902e38c3c..8454dfc7f69 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js
@@ -57,7 +57,7 @@ define([
app: this.options.app
});
activationView.on('profileActivated', function () {
- that.options.app.controller.showDetails(that.options.rule);
+ that.options.refreshActives();
});
activationView.render();
},
@@ -78,7 +78,7 @@ define([
reset: true
}
}).done(function () {
- that.options.app.controller.showDetails(that.options.rule);
+ that.options.refreshActives();
});
}
});
@@ -99,7 +99,7 @@ define([
rule_key: ruleKey
}
}).done(function () {
- that.options.app.controller.showDetails(that.options.rule);
+ that.options.refreshActives();
});
}
});
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 4c187693cf2..0a055c4d6c5 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
@@ -31,7 +31,8 @@ define([
childViewOptions: function () {
return {
app: this.options.app,
- rule: this.model
+ rule: this.model,
+ refreshActives: this.refreshActives.bind(this)
};
},
@@ -76,11 +77,18 @@ define([
};
that.model.set({ activation: activation });
}
- that.options.app.controller.showDetails(that.model);
+ that.refreshActives();
});
activationView.render();
},
+ refreshActives: function () {
+ var that = this;
+ this.options.app.controller.getRuleDetails(this.model).done(function (data) {
+ that.collection.reset(that.model.getInactiveProfiles(data.actives, that.options.app.qualityProfiles));
+ });
+ },
+
serializeData: function () {
return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
canWrite: this.options.app.canWrite