aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-03-30 14:46:36 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-03-30 14:46:36 +0200
commitd61ec5e58ba0882f890260f42bf4a8ce10fe16ab (patch)
treef960189676272283ff63d5412c257571d462d9d6 /server
parent243cd244e0a3209b2db55e091e5ea5c069f0afa0 (diff)
downloadsonarqube-d61ec5e58ba0882f890260f42bf4a8ce10fe16ab.tar.gz
sonarqube-d61ec5e58ba0882f890260f42bf4a8ce10fe16ab.zip
add a second sort dimension for facets
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/js/components/navigator/facets/base-facet.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/components/navigator/facets/base-facet.js b/server/sonar-web/src/main/js/components/navigator/facets/base-facet.js
index 2b9f573f343..31d78fe36d9 100644
--- a/server/sonar-web/src/main/js/components/navigator/facets/base-facet.js
+++ b/server/sonar-web/src/main/js/components/navigator/facets/base-facet.js
@@ -95,8 +95,19 @@ define(function () {
},
sortValues: function (values) {
- return _.sortBy(values, function (v) {
- return -v.count;
+ return values.slice().sort(function (left, right) {
+ if (left.count !== right.count) {
+ return right.count - left.count;
+ }
+ if (left.val !== right.val) {
+ if (left.val > right.val) {
+ return 1;
+ }
+ if (left.val < right.val) {
+ return -1;
+ }
+ }
+ return 0;
});
},