]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5820 show only profiles that match the selected language
authorStas Vilchik <vilchiks@gmail.com>
Thu, 22 Jan 2015 14:19:14 +0000 (15:19 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Thu, 22 Jan 2015 14:19:22 +0000 (15:19 +0100)
server/sonar-web/src/main/js/coding-rules/facets/quality-profile-facet.js

index 778a044590dcca83f48ea1da74bee13602f9b1dc..cea987658d0aa216c1284f356895058b8536640d 100644 (file)
@@ -17,13 +17,20 @@ define([
 
     getValues: function () {
       var that = this,
-          values = this.options.app.qualityProfiles.map(function (profile) {
-            return {
-              label: profile.name,
-              extra: that.options.app.languages[profile.lang],
-              val: profile.key
-            };
-          });
+          languagesQuery = this.options.app.state.get('query').languages,
+          languages = languagesQuery != null ? languagesQuery.split(',') : [],
+          lang = languages.length === 1 ? languages[0] : null,
+          values = this.options.app.qualityProfiles
+              .filter(function (profile) {
+                return lang != null ? profile.lang === lang : true;
+              })
+              .map(function (profile) {
+                return {
+                  label: profile.name,
+                  extra: that.options.app.languages[profile.lang],
+                  val: profile.key
+                };
+              });
       return _.sortBy(values, 'label');
     },