diff --git a/www/Makefile b/www/Makefile index 461b5522..429da3f8 100644 --- a/www/Makefile +++ b/www/Makefile @@ -16,6 +16,7 @@ JSSRC= \ DataStoreConfig.js \ DataStoreStatus.js \ DataStoreContent.js \ + ServerStatus.js \ ServerAdministration.js \ Dashboard.js \ NavigationTree.js \ diff --git a/www/ServerAdministration.js b/www/ServerAdministration.js index de3522d7..edbc0ee3 100644 --- a/www/ServerAdministration.js +++ b/www/ServerAdministration.js @@ -18,10 +18,10 @@ Ext.define('PBS.ServerAdministration', { }, items: [ -// { -// xtype: 'pbsServerStatus', -// itemId: 'status' -// }, + { + xtype: 'pbsServerStatus', + itemId: 'status' + }, { xtype: 'proxmoxNodeServiceView', title: gettext('Services'), diff --git a/www/ServerStatus.js b/www/ServerStatus.js new file mode 100644 index 00000000..808f4d56 --- /dev/null +++ b/www/ServerStatus.js @@ -0,0 +1,49 @@ +Ext.define('PBS.ServerStatus', { + extend: 'Ext.panel.Panel', + alias: 'widget.pbsServerStatus', + + title: gettext('ServerStatus'), + + html: "Add Something usefule here ?", + + initComponent: function() { + var me = this; + + var node_command = function(cmd) { + Proxmox.Utils.API2Request({ + params: { command: cmd }, + url: '/nodes/localhost/status', + method: 'POST', + waitMsgTarget: me, + failure: function(response, opts) { + Ext.Msg.alert(gettext('Error'), response.htmlStatus); + } + }); + }; + + var restartBtn = Ext.create('Proxmox.button.Button', { + text: gettext('Reboot'), + dangerous: true, + confirmMsg: gettext("Reboot backup server?"), + handler: function() { + node_command('reboot'); + }, + iconCls: 'fa fa-undo' + }); + + var shutdownBtn = Ext.create('Proxmox.button.Button', { + text: gettext('Shutdown'), + dangerous: true, + confirmMsg: gettext("Shutdown backup server?"), + handler: function() { + node_command('shutdown'); + }, + iconCls: 'fa fa-power-off' + }); + + me.tbar = [ restartBtn, shutdownBtn ]; + + me.callParent(); + } + +});