]> git.proxmox.com Git - proxmox-backup.git/blob - www/ServerStatus.js
add ServerStatus.js GUI with Reboot and Shutdown buttons
[proxmox-backup.git] / www / ServerStatus.js
1 Ext.define('PBS.ServerStatus', {
2 extend: 'Ext.panel.Panel',
3 alias: 'widget.pbsServerStatus',
4
5 title: gettext('ServerStatus'),
6
7 html: "Add Something usefule here ?",
8
9 initComponent: function() {
10 var me = this;
11
12 var node_command = function(cmd) {
13 Proxmox.Utils.API2Request({
14 params: { command: cmd },
15 url: '/nodes/localhost/status',
16 method: 'POST',
17 waitMsgTarget: me,
18 failure: function(response, opts) {
19 Ext.Msg.alert(gettext('Error'), response.htmlStatus);
20 }
21 });
22 };
23
24 var restartBtn = Ext.create('Proxmox.button.Button', {
25 text: gettext('Reboot'),
26 dangerous: true,
27 confirmMsg: gettext("Reboot backup server?"),
28 handler: function() {
29 node_command('reboot');
30 },
31 iconCls: 'fa fa-undo'
32 });
33
34 var shutdownBtn = Ext.create('Proxmox.button.Button', {
35 text: gettext('Shutdown'),
36 dangerous: true,
37 confirmMsg: gettext("Shutdown backup server?"),
38 handler: function() {
39 node_command('shutdown');
40 },
41 iconCls: 'fa fa-power-off'
42 });
43
44 me.tbar = [ restartBtn, shutdownBtn ];
45
46 me.callParent();
47 }
48
49 });