aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/update-center/header-view.js
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-01-13 15:05:58 +0100
committerStas Vilchik <vilchiks@gmail.com>2016-01-13 15:06:05 +0100
commit7ec0fe0237570367de259b69bd71a8add7fa10b9 (patch)
tree707732ade3df3aacb62f3b0d91463d2a70339963 /server/sonar-web/src/main/js/apps/update-center/header-view.js
parentbdadbd0391944ec43d2bee8d499a99e6b0057bb7 (diff)
downloadsonarqube-7ec0fe0237570367de259b69bd71a8add7fa10b9.tar.gz
sonarqube-7ec0fe0237570367de259b69bd71a8add7fa10b9.zip
SONAR-1976 Administrators should be able to request a server restart from web console
Diffstat (limited to 'server/sonar-web/src/main/js/apps/update-center/header-view.js')
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/header-view.js21
1 files changed, 18 insertions, 3 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 4d2672f4f85..0ed3a8f8962 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
@@ -20,6 +20,7 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
import Template from './templates/update-center-header.hbs';
+import { restartAndWait } from '../../api/system';
export default Marionette.ItemView.extend({
template: Template,
@@ -29,17 +30,31 @@ export default Marionette.ItemView.extend({
},
events: {
+ 'click .js-restart': 'restart',
'click .js-cancel-all': 'cancelAll'
},
- cancelAll: function () {
+ initialize () {
+ this.restarting = false;
+ },
+
+ restart () {
+ this.restarting = true;
+ this.render();
+ restartAndWait().then(() => {
+ document.location.reload(true);
+ });
+ },
+
+ cancelAll () {
this.collection.cancelAll();
},
- serializeData: function () {
+ serializeData () {
return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
installing: this.collection._installedCount,
- uninstalling: this.collection._uninstalledCount
+ uninstalling: this.collection._uninstalledCount,
+ restarting: this.restarting
});
}
});