]>
git.proxmox.com Git - pve-manager.git/blob - www/manager/qemu/Summary.js
1 Ext
.define('PVE.qemu.Summary', {
2 extend
: 'Ext.panel.Panel',
3 alias
: 'widget.pveQemuSummary',
5 initComponent: function() {
8 var nodename
= me
.pveSelNode
.data
.node
;
10 throw "no node name specified";
13 var vmid
= me
.pveSelNode
.data
.vmid
;
15 throw "no VM ID specified";
18 var statusview
= Ext
.create('PVE.qemu.StatusView', {
20 pveSelNode
: me
.pveSelNode
,
24 var rstore
= statusview
.rstore
;
26 var rrdurl
= "/api2/png/nodes/" + nodename
+ "/qemu/" + vmid
+ "/rrd";
28 var vm_command = function(cmd
) {
29 PVE
.Utils
.API2Request({
30 params
: { command
: cmd
},
31 url
: '/nodes/' + nodename
+ '/qemu/' + vmid
+ "/status",
34 failure: function(response
, opts
) {
35 Ext
.Msg
.alert('Error', response
.htmlStatus
);
40 var tbar
= Ext
.create('Ext.toolbar.Toolbar', {
53 var msg
= "Do you really want to stop the VM?";
54 Ext
.Msg
.confirm('Confirm', msg
, function(btn
) {
66 var msg
= "Do you really want to reset the VM?";
67 Ext
.Msg
.confirm('Confirm', msg
, function(btn
) {
79 var msg
= "Do you really want to shutdown the VM?";
80 Ext
.Msg
.confirm('Confirm', msg
, function(btn
) {
84 vm_command('shutdown');
92 var msg
= 'Are you sure you want to remove VM ' +
93 vmid
+ '? This will permanently erase all VM data.';
94 Ext
.Msg
.confirm('Confirm', msg
, function(btn
) {
98 PVE
.Utils
.API2Request({
99 url
: '/nodes/' + nodename
+ '/qemu/' + vmid
,
102 failure: function(response
, opts
) {
103 Ext
.Msg
.alert('Error', response
.htmlStatus
);
112 handler: function() {
113 var url
= Ext
.urlEncode({
118 var nw
= window
.open("?" + url
, '_blank',
119 "innerWidth=745,innerheight=427");
124 xtype
: 'pveRRDTypeSelector'
129 me
.mon(rstore
, 'load', function(s
, records
, success
) {
130 var rec
= s
.data
.get('status');
131 var status
= rec
? rec
.data
.value
: 'unknown';
133 tbar
.down('#start').setDisabled(status
=== 'running');
134 tbar
.down('#reset').setDisabled(status
!== 'running');
135 tbar
.down('#shutdown').setDisabled(status
!== 'running');
136 tbar
.down('#stop').setDisabled(status
=== 'stopped');
137 tbar
.down('#console').setDisabled(status
!== 'running');
138 tbar
.down('#remove').setDisabled(status
!== 'stopped');
141 var notesview
= Ext
.create('PVE.qemu.NotesView', {
142 pveSelNode
: me
.pveSelNode
,
149 bodyStyle
: 'padding:10px',
151 style
: 'padding-top:10px',
156 style
: 'padding-top:0px',
162 items
: [ statusview
, notesview
]
166 title
: "CPU usage %",
167 pveSelNode
: me
.pveSelNode
,
173 title
: "Memory usage",
174 pveSelNode
: me
.pveSelNode
,
175 datasource
: 'mem,maxmem',
180 title
: "Network traffic",
181 pveSelNode
: me
.pveSelNode
,
182 datasource
: 'netin,netout',
188 pveSelNode
: me
.pveSelNode
,
189 datasource
: 'diskread,diskwrite',
195 me
.on('show', function() {
196 rstore
.startUpdate();
200 me
.on('hide', rstore
.stopUpdate
);
201 me
.on('destroy', rstore
.stopUpdate
);