]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/lxc/CmdMenu.js
1 Ext
.define('PVE.lxc.CmdMenu', {
2 extend
: 'Ext.menu.Menu',
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 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('Suspend'),
59 // iconCls: 'fa fa-fw fa-pause',
61 // disabled: stopped || suspended,
62 // handler: function() {
63 // var msg = PVE.Utils.format_task_description('vzsuspend', vmid);
64 // Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
65 // if (btn !== 'yes') {
69 // vm_command('suspend');
74 // text: gettext('Resume'),
75 // iconCls: 'fa fa-fw fa-play',
76 // hidden: !suspended,
77 // handler: function() {
78 // vm_command('resume');
82 text
: gettext('Shutdown'),
83 iconCls
: 'fa fa-fw fa-power-off',
84 disabled
: stopped
|| suspended
,
86 var msg
= PVE
.Utils
.format_task_description('vzshutdown', vmid
);
87 Ext
.Msg
.confirm(gettext('Confirm'), msg
, function(btn
) {
92 vm_command('shutdown');
97 text
: gettext('Stop'),
98 iconCls
: 'fa fa-fw fa-stop',
100 handler: function() {
101 var msg
= PVE
.Utils
.format_task_description('vzstop', vmid
);
102 Ext
.Msg
.confirm(gettext('Confirm'), msg
, function(btn
) {
111 { xtype
: 'menuseparator' },
113 text
: gettext('Migrate'),
114 iconCls
: 'fa fa-fw fa-send-o',
115 handler: function() {
116 var win
= Ext
.create('PVE.window.Migrate', {
125 // text: gettext('Convert to template'),
126 // icon: '/pve2/images/forward.png',
127 // handler: function() {
128 // var msg = PVE.Utils.format_task_description('vztemplate', vmid);
129 // Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
130 // if (btn !== 'yes') {
134 // PVE.Utils.API2Request({
135 // url: '/nodes/' + nodename + '/lxc/' + vmid + '/template',
137 // failure: function(response, opts) {
138 // Ext.Msg.alert('Error', response.htmlStatus);
144 { xtype
: 'menuseparator' },
146 text
: gettext('Console'),
147 iconCls
: 'fa fa-fw fa-terminal',
148 handler: function() {
149 PVE
.Utils
.openDefaultConsoleWindow(true, 'lxc', vmid
, nodename
, vmname
);