add ServerStatus.js GUI with Reboot and Shutdown buttons

This commit is contained in:
Dietmar Maurer 2020-04-30 12:11:08 +02:00
parent ed751dc2ab
commit ecb53af6d9
3 changed files with 54 additions and 4 deletions

View File

@ -16,6 +16,7 @@ JSSRC= \
DataStoreConfig.js \
DataStoreStatus.js \
DataStoreContent.js \
ServerStatus.js \
ServerAdministration.js \
Dashboard.js \
NavigationTree.js \

View File

@ -18,10 +18,10 @@ Ext.define('PBS.ServerAdministration', {
},
items: [
// {
// xtype: 'pbsServerStatus',
// itemId: 'status'
// },
{
xtype: 'pbsServerStatus',
itemId: 'status'
},
{
xtype: 'proxmoxNodeServiceView',
title: gettext('Services'),

49
www/ServerStatus.js Normal file
View File

@ -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();
}
});