From 8e17de7b37bcbcbb5e34497023ce1fead8462c5a Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Tue, 7 Jul 2015 12:16:05 +0200 Subject: SONAR-6661 apply feedback --- .../src/main/js/apps/update-center/list-item-view.js | 8 +++++++- server/sonar-web/src/main/js/apps/update-center/plugins.js | 1 - .../sonar-web/src/main/js/apps/update-center/search-view.js | 13 ++++++++++++- .../templates/_update-center-plugin-changelog-entry.hbs | 2 +- .../apps/update-center/templates/update-center-plugin.hbs | 2 +- .../update-center/templates/update-center-system-update.hbs | 2 +- .../src/test/json/update-center-spec/available.json | 2 +- server/sonar-web/test/medium/update-center.spec.js | 12 ++++++++++++ 8 files changed, 35 insertions(+), 7 deletions(-) (limited to 'server') diff --git a/server/sonar-web/src/main/js/apps/update-center/list-item-view.js b/server/sonar-web/src/main/js/apps/update-center/list-item-view.js index aec237a36bb..67750c343ec 100644 --- a/server/sonar-web/src/main/js/apps/update-center/list-item-view.js +++ b/server/sonar-web/src/main/js/apps/update-center/list-item-view.js @@ -22,7 +22,8 @@ define([ 'click .js-install': 'install', 'click .js-update': 'update', 'click .js-uninstall': 'uninstall', - 'change .js-terms': 'onTermsChange' + 'change .js-terms': 'onTermsChange', + 'click .js-plugin-category': 'onCategoryClick' }, getTemplate: function () { @@ -86,6 +87,11 @@ define([ onTermsChange: function () { var isAccepted = this.$('.js-terms').is(':checked'); this.$('.js-install').prop('disabled', !isAccepted); + }, + + onCategoryClick: function (e) { + e.preventDefault(); + this.model.trigger('filter', this.model); } }); diff --git a/server/sonar-web/src/main/js/apps/update-center/plugins.js b/server/sonar-web/src/main/js/apps/update-center/plugins.js index f81c7702a38..021e124511c 100644 --- a/server/sonar-web/src/main/js/apps/update-center/plugins.js +++ b/server/sonar-web/src/main/js/apps/update-center/plugins.js @@ -146,7 +146,6 @@ define([ plugins.set(that._installed); plugins.set(that._updates, { remove: true }); plugins.set(that._pending, { add: false, remove: false }); - plugins.add(that._systemUpdates); that.reset(plugins.models); }); }, diff --git a/server/sonar-web/src/main/js/apps/update-center/search-view.js b/server/sonar-web/src/main/js/apps/update-center/search-view.js index 3ace406ba06..d9988d3f448 100644 --- a/server/sonar-web/src/main/js/apps/update-center/search-view.js +++ b/server/sonar-web/src/main/js/apps/update-center/search-view.js @@ -10,7 +10,12 @@ define([ 'submit #update-center-search-form': 'onFormSubmit', 'search #update-center-search-query': 'debouncedOnKeyUp', - 'keyup #update-center-search-query': 'debouncedOnKeyUp' + 'keyup #update-center-search-query': 'debouncedOnKeyUp', + 'change #update-center-search-query': 'debouncedOnKeyUp' + }, + + collectionEvents: { + 'filter': 'onFilter' }, initialize: function () { @@ -57,6 +62,12 @@ define([ }, 0); }, + onFilter: function (model) { + var q = model.get('category'); + this.$('#update-center-search-query').val(q) + this.search(q); + }, + serializeData: function () { return _.extend(this._super(), { state: this.options.state.toJSON() }); } diff --git a/server/sonar-web/src/main/js/apps/update-center/templates/_update-center-plugin-changelog-entry.hbs b/server/sonar-web/src/main/js/apps/update-center/templates/_update-center-plugin-changelog-entry.hbs index 859ec420626..fddb84bce8c 100644 --- a/server/sonar-web/src/main/js/apps/update-center/templates/_update-center-plugin-changelog-entry.hbs +++ b/server/sonar-web/src/main/js/apps/update-center/templates/_update-center-plugin-changelog-entry.hbs @@ -7,7 +7,7 @@ {{/notEq}} {{d release.date}} {{#if release.changeLogUrl}} - Release Notes + Release Notes {{/if}}
{{{release.description}}}
diff --git a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-plugin.hbs b/server/sonar-web/src/main/js/apps/update-center/templates/update-center-plugin.hbs index eff32440761..e8c8aab5cc2 100644 --- a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-plugin.hbs +++ b/server/sonar-web/src/main/js/apps/update-center/templates/update-center-plugin.hbs @@ -4,7 +4,7 @@
{{name}} {{#if category}} - {{category}} + {{category}} {{/if}}
{{{description}}}
diff --git a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-system-update.hbs b/server/sonar-web/src/main/js/apps/update-center/templates/update-center-system-update.hbs index 0096dea967e..bc50d859efc 100644 --- a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-system-update.hbs +++ b/server/sonar-web/src/main/js/apps/update-center/templates/update-center-system-update.hbs @@ -1,6 +1,6 @@ -
+ diff --git a/server/sonar-web/src/test/json/update-center-spec/available.json b/server/sonar-web/src/test/json/update-center-spec/available.json index 95658631f6d..bda1a3dae08 100644 --- a/server/sonar-web/src/test/json/update-center-spec/available.json +++ b/server/sonar-web/src/test/json/update-center-spec/available.json @@ -23,7 +23,7 @@ { "key": "visualstudio", "name": "Analysis Bootstrapper for Visual Studio Projects", - "category": "Languages", + "category": "Integration", "description": "Bootstraps the analysis from Visual Studio solution and project files.", "license": "GNU LGPL 3", "organizationName": "SonarSource", diff --git a/server/sonar-web/test/medium/update-center.spec.js b/server/sonar-web/test/medium/update-center.spec.js index 978fafaff2f..bcb2d66b0f8 100644 --- a/server/sonar-web/test/medium/update-center.spec.js +++ b/server/sonar-web/test/medium/update-center.spec.js @@ -155,6 +155,18 @@ define(function (require) { .checkElementInclude('li:not(.hidden)[data-id] .js-plugin-name', 'JavaScript'); }); + bdd.it('should search by category on click', function () { + return this.remote + .open('#available') + .mockFromString('/api/l10n/index', '{}') + .mockFromFile('/api/plugins/available', 'update-center-spec/available.json') + .mockFromFile('/api/plugins/pending', 'update-center-spec/pending.json') + .startApp('update-center', { urlRoot: '/test/medium/base.html' }) + .checkElementCount('li[data-id]:not(.hidden)', 3) + .clickElement('li[data-id="abap"] .js-plugin-category') + .checkElementCount('li[data-id]:not(.hidden)', 2); + }); + bdd.it('should show changelog of plugin update', function () { return this.remote .open('#installed') -- cgit v1.2.3