]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6138 apply feedback
authorStas Vilchik <vilchiks@gmail.com>
Tue, 5 May 2015 07:57:21 +0000 (09:57 +0200)
committerStas Vilchik <vilchiks@gmail.com>
Tue, 5 May 2015 07:57:28 +0000 (09:57 +0200)
server/sonar-web/src/main/js/nav/search-view.js

index 007a2ebf537d50e3b7180c8e292d22c0e1a7e792..e7e4bc9e370ebea06895b57e628c2f9820de2017 100644 (file)
@@ -136,15 +136,15 @@ define([
     fetchFavorite: function () {
       var that = this;
       return $.get(baseUrl + '/api/favourites').done(function (r) {
-        that.favorite = r.map(function (f, index) {
+        that.favorite = r.map(function (f) {
           var isFile = ['FIL', 'UTS'].indexOf(f.qualifier) !== -1;
           return {
             url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(f.key) + dashboardParameters(true),
             name: isFile ? window.collapsedDirFromPath(f.lname) + window.fileFromPath(f.lname) : f.name,
-            icon: 'favorite',
-            extra: index === 0 ? t('favorite') : null
+            icon: 'favorite'
           };
         });
+        that.favorite = _.sortBy(that.favorite, 'name');
       });
     },
 
@@ -158,6 +158,9 @@ define([
               extra: index === 0 ? t('browsed_recently') : null
             };
           }),
+          favorite = _.first(this.favorite, 6).map(function (f, index) {
+            return _.extend(f, { extra: index === 0 ? t('favorite') : null });
+          }),
           qualifiers = this.model.get('qualifiers').map(function (q, index) {
             return {
               url: baseUrl + '/all_projects?qualifier=' + encodeURIComponent(q),
@@ -165,7 +168,7 @@ define([
               extra: index === 0 ? '' : null
             };
           });
-      this.results.reset([].concat(history, _.first(this.favorite, 6), qualifiers));
+      this.results.reset([].concat(history, favorite, qualifiers));
     },
 
     search: function (q) {