]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/lxc/CmdMenu.js
1 Ext
.define('PVE.lxc.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 CT ID specified";
17 var vmname
= me
.pveSelNode
.data
.name
;
19 var vm_command = function(cmd
, params
) {
20 PVE
.Utils
.API2Request({
22 url
: '/nodes/' + nodename
+ '/lxc/' + vmid
+ "/status/" + cmd
,
24 failure: function(response
, opts
) {
25 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
32 var suspended
= false;
34 switch (me
.pveSelNode
.data
.status
) {
46 me
.title
= 'CT ' + vmid
;
50 text
: gettext('Start'),
51 iconCls
: 'fa fa-fw fa-play',
58 text
: gettext('Migrate'),
59 iconCls
: 'fa fa-fw fa-send-o',
61 var win
= Ext
.create('PVE.window.Migrate', {
70 text
: gettext('Suspend'),
71 iconCls
: 'fa fa-fw fa-pause',
72 disabled
: stopped
|| suspended
,
74 var msg
= PVE
.Utils
.format_task_description('vzsuspend', vmid
);
75 Ext
.Msg
.confirm(gettext('Confirm'), msg
, function(btn
) {
80 vm_command('suspend');
85 text
: gettext('Resume'),
86 iconCls
: 'fa fa-fw fa-play',
93 text
: gettext('Shutdown'),
94 iconCls
: 'fa fa-fw fa-power-off',
95 disabled
: stopped
|| suspended
,
97 var msg
= PVE
.Utils
.format_task_description('vzshutdown', vmid
);
98 Ext
.Msg
.confirm(gettext('Confirm'), msg
, function(btn
) {
103 vm_command('shutdown');
108 text
: gettext('Stop'),
109 iconCls
: 'fa fa-fw fa-stop',
111 handler: function() {
112 var msg
= PVE
.Utils
.format_task_description('vzstop', vmid
);
113 Ext
.Msg
.confirm(gettext('Confirm'), msg
, function(btn
) {
123 // text: gettext('Convert to template'),
124 // icon: '/pve2/images/forward.png',
125 // handler: function() {
126 // var msg = PVE.Utils.format_task_description('vztemplate', vmid);
127 // Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
128 // if (btn !== 'yes') {
132 // PVE.Utils.API2Request({
133 // url: '/nodes/' + nodename + '/lxc/' + vmid + '/template',
135 // failure: function(response, opts) {
136 // Ext.Msg.alert('Error', response.htmlStatus);
143 text
: gettext('Console'),
144 iconCls
: 'fa fa-fw fa-terminal',
145 handler: function() {
146 PVE
.Utils
.openDefaultConsoleWindow(true, 'lxc', vmid
, nodename
, vmname
);