From: Stas Vilchik Date: Tue, 5 May 2015 07:57:21 +0000 (+0200) Subject: SONAR-6138 apply feedback X-Git-Tag: 5.2-RC1~2056 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fafb1f05739f94bb846d3f7cd8f5663147b281d8;p=sonarqube.git SONAR-6138 apply feedback --- diff --git a/server/sonar-web/src/main/js/nav/search-view.js b/server/sonar-web/src/main/js/nav/search-view.js index 007a2ebf537..e7e4bc9e370 100644 --- a/server/sonar-web/src/main/js/nav/search-view.js +++ b/server/sonar-web/src/main/js/nav/search-view.js @@ -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) {