From e15b6d0c7ddd84e398db704cc732c870f14b966b Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Thu, 12 May 2016 10:55:14 +0200 Subject: [PATCH] SONAR-7094 Correct, expand update center summary (#941) --- .../main/js/apps/update-center/header-view.js | 1 + .../src/main/js/apps/update-center/plugin.js | 2 +- .../src/main/js/apps/update-center/plugins.js | 11 ++++++- .../templates/update-center-header.hbs | 29 ++++++++++++------- .../templates/update-center-plugin.hbs | 6 +++- 5 files changed, 35 insertions(+), 14 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/update-center/header-view.js b/server/sonar-web/src/main/js/apps/update-center/header-view.js index 48132dcdc1a..f30c641fa15 100644 --- a/server/sonar-web/src/main/js/apps/update-center/header-view.js +++ b/server/sonar-web/src/main/js/apps/update-center/header-view.js @@ -45,6 +45,7 @@ export default Marionette.ItemView.extend({ serializeData () { return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { installing: this.collection._installedCount, + updating: this.collection._updatedCount, uninstalling: this.collection._uninstalledCount }); } diff --git a/server/sonar-web/src/main/js/apps/update-center/plugin.js b/server/sonar-web/src/main/js/apps/update-center/plugin.js index de5b07b2655..761745b8270 100644 --- a/server/sonar-web/src/main/js/apps/update-center/plugin.js +++ b/server/sonar-web/src/main/js/apps/update-center/plugin.js @@ -72,7 +72,7 @@ export default Backbone.Model.extend({ return this._action({ url: window.baseUrl + '/api/plugins/update', success (model) { - model.set({ _status: 'installing' }); + model.set({ _status: 'updating' }); } }); }, 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 cb2d23b048e..868c7acdab7 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 @@ -31,6 +31,7 @@ const Plugins = Backbone.Collection.extend({ initialize () { this._installedCount = 0; + this._updatedCount = 0; this._uninstalledCount = 0; this.listenTo(this, 'change:_status', this.onStatusChange); }, @@ -117,12 +118,16 @@ const Plugins = Backbone.Collection.extend({ const installing = r.installing.map(function (plugin) { return { key: plugin.key, _status: 'installing' }; }); + const updating = r.updating.map(function (plugin) { + return { key: plugin.key, _status: 'updating' }; + }); const uninstalling = r.removing.map(function (plugin) { return { key: plugin.key, _status: 'uninstalling' }; }); that._installedCount = installing.length; + that._updatedCount = updating.length; that._uninstalledCount = uninstalling.length; - that._pending = new Plugins([].concat(installing, uninstalling)).models; + that._pending = new Plugins([].concat(installing, updating, uninstalling)).models; } }; return Backbone.ajax(opts); @@ -198,6 +203,7 @@ const Plugins = Backbone.Collection.extend({ url: window.baseUrl + '/api/plugins/cancel_all', success () { that._installedCount = 0; + that._updatedCount = 0; that._uninstalledCount = 0; that.forEach(function (model) { model.unset('_status'); @@ -212,6 +218,9 @@ const Plugins = Backbone.Collection.extend({ if (status === 'installing') { this._installedCount++; } + if (status === 'updating') { + this._updatedCount++; + } if (status === 'uninstalling') { this._uninstalledCount++; } diff --git a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-header.hbs b/server/sonar-web/src/main/js/apps/update-center/templates/update-center-header.hbs index a89a1112d5c..d70d165fd6b 100644 --- a/server/sonar-web/src/main/js/apps/update-center/templates/update-center-header.hbs +++ b/server/sonar-web/src/main/js/apps/update-center/templates/update-center-header.hbs @@ -3,23 +3,30 @@

{{t 'update_center.page.description'}}

-{{#any installing uninstalling}} +{{#any installing updating uninstalling}}
-

- SonarQube needs to be restarted in order to +

SonarQube needs to be restarted in order to

+
    {{#if installing}} - install - {{installing}} plugins +
  • + install + {{installing}} plugins +
  • + {{/if}} + {{#if updating}} +
  • + update + {{updating}} plugins +
  • {{/if}} - {{#all installing uninstalling}} - and - {{/all}} {{#if uninstalling}} - uninstall - {{uninstalling}} plugins +
  • + uninstall + {{uninstalling}} plugins +
  • {{/if}} -

    +
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 0252fce327e..bf0ecdbaf4a 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 @@ -91,7 +91,11 @@ {{#eq _status 'installing'}} -

{{#if version}}Update{{else}}Install{{/if}} Pending

+

Install Pending

+ {{/eq}} + + {{#eq _status 'updating'}} +

Update Pending

{{/eq}} {{#eq _status 'uninstalling'}} -- 2.39.5