aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-01-06 14:45:26 +0100
committerStas Vilchik <vilchiks@gmail.com>2015-01-06 14:45:26 +0100
commitf6176a48b89619f0539655059089d89917500fc4 (patch)
tree839ffed52e2dddf34cc143e779dc65dd7eace153
parente2d074c326a61db83147840e17eae49bd984a29e (diff)
downloadsonarqube-f6176a48b89619f0539655059089d89917500fc4.tar.gz
sonarqube-f6176a48b89619f0539655059089d89917500fc4.zip
SONAR-5820 Improve performance
-rw-r--r--server/sonar-web/src/main/js/coding-rules/controller.js2
-rw-r--r--server/sonar-web/src/main/js/coding-rules/models/rule.js8
-rw-r--r--server/sonar-web/src/main/js/coding-rules/models/rules.js4
3 files changed, 6 insertions, 8 deletions
diff --git a/server/sonar-web/src/main/js/coding-rules/controller.js b/server/sonar-web/src/main/js/coding-rules/controller.js
index bb36840c7c5..277803b0f5f 100644
--- a/server/sonar-web/src/main/js/coding-rules/controller.js
+++ b/server/sonar-web/src/main/js/coding-rules/controller.js
@@ -89,7 +89,7 @@ define([
};
return $.get(url, options).done(function (data) {
rule.set(data.rule);
- rule.addExtraAttributes(that.app.languages, that.app.repositories);
+ rule.addExtraAttributes(that.app.repositories);
});
},
diff --git a/server/sonar-web/src/main/js/coding-rules/models/rule.js b/server/sonar-web/src/main/js/coding-rules/models/rule.js
index 9363ff689d8..edfd042fe0a 100644
--- a/server/sonar-web/src/main/js/coding-rules/models/rule.js
+++ b/server/sonar-web/src/main/js/coding-rules/models/rule.js
@@ -5,18 +5,16 @@ define([
return Backbone.Model.extend({
idAttribute: 'key',
- addExtraAttributes: function (languages, repositories) {
- var langName = languages[this.get('lang')] || this.get('lang'),
- repo = _.findWhere(repositories, { key: this.get('repo') }) || this.get('repo'),
+ addExtraAttributes: function (repositories) {
+ var repo = _.findWhere(repositories, { key: this.get('repo') }) || this.get('repo'),
repoName = repo != null ? repo.name : repo,
isManual = this.get('repo') === 'manual',
isCustom = this.has('templateKey');
this.set({
- langName: langName,
repoName: repoName,
isManual: isManual,
isCustom: isCustom
- });
+ }, { silent: true });
}
});
diff --git a/server/sonar-web/src/main/js/coding-rules/models/rules.js b/server/sonar-web/src/main/js/coding-rules/models/rules.js
index 752576ee2f8..12c8aadb0e3 100644
--- a/server/sonar-web/src/main/js/coding-rules/models/rules.js
+++ b/server/sonar-web/src/main/js/coding-rules/models/rules.js
@@ -16,9 +16,9 @@ define([
});
},
- addExtraAttributes: function (languages, repositories) {
+ addExtraAttributes: function (repositories) {
this.models.forEach(function (model) {
- model.addExtraAttributes(languages, repositories);
+ model.addExtraAttributes(repositories);
});
}
});