]>
git.proxmox.com Git - pve-manager.git/blob - www/manager/node/Summary.js
1 Ext
.define('PVE.node.Summary', {
2 extend
: 'Ext.panel.Panel',
3 alias
: 'widget.pveNodeSummary',
5 initComponent: function() {
8 var nodename
= me
.pveSelNode
.data
.node
;
10 throw "no node name specified";
13 var statusview
= Ext
.create('PVE.node.StatusView', {
15 pveSelNode
: me
.pveSelNode
,
16 style
: 'padding-top:0px'
19 var rstore
= statusview
.rstore
;
21 var node_command = function(cmd
) {
22 PVE
.Utils
.API2Request({
23 params
: { command
: cmd
},
24 url
: '/nodes/' + nodename
+ '/status',
27 failure: function(response
, opts
) {
28 Ext
.Msg
.alert('Error', response
.htmlStatus
);
33 var rrdurl
= "/api2/png/nodes/" + nodename
+ "/rrd";
35 var tbar
= Ext
.create('Ext.toolbar.Toolbar', {
41 var msg
= "Do you really want to reboot node '" + nodename
+ "'?";
42 Ext
.Msg
.confirm('Confirm', msg
, function(btn
) {
46 node_command('reboot');
54 var msg
= "Do you really want to shutdown node '" + nodename
+ "'?";
55 Ext
.Msg
.confirm('Confirm', msg
, function(btn
) {
59 node_command('shutdown');
67 var url
= Ext
.urlEncode({
71 var nw
= window
.open("?" + url
, '_blank',
72 "innerWidth=745,innerheight=427");
77 xtype
: 'pveRRDTypeSelector'
82 me
.mon(rstore
, 'load', function(s
, records
, success
) {
83 var uptimerec
= s
.data
.get('uptime');
84 var uptime
= uptimerec
? uptimerec
.data
.value
: false;
86 tbar
.down('#reboot').setDisabled(!uptime
);
87 tbar
.down('#shutdown').setDisabled(!uptime
);
88 tbar
.down('#shell').setDisabled(!uptime
);
93 bodyStyle
: 'padding:10px',
96 style
: 'padding-top:10px'
103 title
: "CPU usage %",
104 datasource
: 'cpu,iowait',
109 title
: "Server load",
110 datasource
: 'loadavg',
115 title
: "Memory usage",
116 datasource
: 'memtotal,memused',
121 title
: "Network traffic",
122 datasource
: 'netin,netout',
128 me
.on('show', rstore
.startUpdate
);
129 me
.on('hide', rstore
.stopUpdate
);
130 me
.on('destroy', rstore
.stopUpdate
);