]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/qemu/CmdMenu.js
864060b3f41b50f7c830a535b044eb045ebe5880
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 iconCls
: 'fa fa-fw fa-play',
41 text
: gettext('Migrate'),
42 iconCls
: 'fa fa-fw fa-send-o',
44 var win
= Ext
.create('PVE.window.Migrate', {
53 text
: gettext('Suspend'),
54 iconCls
: 'fa fa-fw fa-pause',
56 var msg
= PVE
.Utils
.format_task_description('qmsuspend', vmid
);
57 Ext
.Msg
.confirm(gettext('Confirm'), msg
, function(btn
) {
61 vm_command('suspend');
66 text
: gettext('Resume'),
67 iconCls
: 'fa fa-fw fa-play',
73 text
: gettext('Shutdown'),
74 iconCls
: 'fa fa-fw fa-power-off',
76 var msg
= PVE
.Utils
.format_task_description('qmshutdown', vmid
);
77 Ext
.Msg
.confirm(gettext('Confirm'), msg
, function(btn
) {
82 vm_command('shutdown');
87 text
: gettext('Stop'),
88 iconCls
: 'fa fa-fw fa-stop',
90 var msg
= PVE
.Utils
.format_task_description('qmstop', vmid
);
91 Ext
.Msg
.confirm(gettext('Confirm'), msg
, function(btn
) {
101 text
: gettext('Clone'),
102 iconCls
: 'fa fa-fw fa-clone',
103 handler: function() {
104 var win
= Ext
.create('PVE.window.Clone', {
112 text
: gettext('Convert to template'),
113 iconCls
: 'fa fa-fw fa-sticky-note-o',
114 handler: function() {
115 var msg
= PVE
.Utils
.format_task_description('qmtemplate', 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 iconCls
: 'fa fa-fw fa-terminal',
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
);