]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/qemu/CmdMenu.js
1 Ext
.define('PVE.qemu.CmdMenu', {
2 extend
: 'Ext.menu.Menu',
4 initComponent: function() {
7 var nodename
= me
.pveSelNode
.data
.node
;
9 throw "no node name specified";
12 var vmid
= me
.pveSelNode
.data
.vmid
;
14 throw "no VM ID specified";
17 var vmname
= me
.pveSelNode
.data
.name
;
19 var vm_command = function(cmd
, params
) {
20 PVE
.Utils
.API2Request({
22 url
: '/nodes/' + nodename
+ '/qemu/' + vmid
+ "/status/" + cmd
,
24 failure: function(response
, opts
) {
25 Ext
.Msg
.alert('Error', response
.htmlStatus
);
30 me
.title
= "VM " + vmid
;
34 text
: gettext('Start'),
35 icon
: '/pve2/images/start.png',
41 text
: gettext('Migrate'),
42 icon
: '/pve2/images/forward.png',
44 var win
= Ext
.create('PVE.window.Migrate', {
53 text
: gettext('Suspend'),
54 icon
: '/pve2/images/forward.png',
56 var msg
= Ext
.String
.format(gettext("Do you really want to suspend {0}?"), gettext('VM') + ' ' + vmid
);
57 Ext
.Msg
.confirm(gettext('Confirm'), msg
, function(btn
) {
61 vm_command('suspend');
66 text
: gettext('Resume'),
67 icon
: '/pve2/images/forward.png',
73 text
: gettext('Shutdown'),
74 icon
: '/pve2/images/stop.png',
76 var msg
= Ext
.String
.format(gettext("Do you really want to shutdown {0}?"), gettext('VM') + ' ' + vmid
);
77 Ext
.Msg
.confirm(gettext('Confirm'), msg
, function(btn
) {
82 vm_command('shutdown');
87 text
: gettext('Stop'),
88 icon
: '/pve2/images/gtk-stop.png',
90 var msg
= Ext
.String
.format(gettext("Do you really want to stop {0}?"), gettext('VM') + ' ' + vmid
);
91 Ext
.Msg
.confirm(gettext('Confirm'), msg
, function(btn
) {
101 text
: gettext('Clone'),
102 icon
: '/pve2/images/forward.png',
103 handler: function() {
104 var win
= Ext
.create('PVE.window.Clone', {
112 text
: gettext('Convert to template'),
113 icon
: '/pve2/images/forward.png',
114 handler: function() {
115 var msg
= Ext
.String
.format(gettext("Do you really want to convert {0} into a template?"), gettext('VM') + ' ' + vmid
);
116 Ext
.Msg
.confirm(gettext('Confirm'), msg
, function(btn
) {
121 PVE
.Utils
.API2Request({
122 url
: '/nodes/' + nodename
+ '/qemu/' + vmid
+ '/template',
124 failure: function(response
, opts
) {
125 Ext
.Msg
.alert('Error', response
.htmlStatus
);
132 text
: gettext('Console'),
133 icon
: '/pve2/images/display.png',
134 handler: function() {
135 PVE
.Utils
.API2Request({
136 url
: '/nodes/' + nodename
+ '/qemu/' + vmid
+ '/status/current',
137 failure: function(response
, opts
) {
138 Ext
.Msg
.alert('Error', response
.htmlStatus
);
140 success: function(response
, opts
) {
141 var allowSpice
= response
.result
.data
.spice
;
142 PVE
.Utils
.openDefaultConsoleWindow(allowSpice
, 'kvm', vmid
, nodename
, vmname
);