]>
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
);
30 me
.title
= 'CT ' + 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('vzsuspend', vmid
);
57 Ext
.Msg
.confirm(gettext('Confirm'), msg
, function(btn
) {
62 vm_command('suspend');
67 text
: gettext('Resume'),
68 iconCls
: 'fa fa-fw fa-play',
74 text
: gettext('Shutdown'),
75 iconCls
: 'fa fa-fw fa-power-off',
77 var msg
= PVE
.Utils
.format_task_description('vzshutdown', vmid
);
78 Ext
.Msg
.confirm(gettext('Confirm'), msg
, function(btn
) {
83 vm_command('shutdown');
88 text
: gettext('Stop'),
89 iconCls
: 'fa fa-fw fa-stop',
91 var msg
= PVE
.Utils
.format_task_description('vzstop', vmid
);
92 Ext
.Msg
.confirm(gettext('Confirm'), msg
, function(btn
) {
102 // text: gettext('Convert to template'),
103 // icon: '/pve2/images/forward.png',
104 // handler: function() {
105 // var msg = PVE.Utils.format_task_description('vztemplate', vmid);
106 // Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
107 // if (btn !== 'yes') {
111 // PVE.Utils.API2Request({
112 // url: '/nodes/' + nodename + '/lxc/' + vmid + '/template',
114 // failure: function(response, opts) {
115 // Ext.Msg.alert('Error', response.htmlStatus);
122 text
: gettext('Console'),
123 iconCls
: 'fa fa-fw fa-terminal',
124 handler: function() {
125 PVE
.Utils
.openDefaultConsoleWindow(true, 'lxc', vmid
, nodename
, vmname
);