]>
git.proxmox.com Git - pve-manager.git/blob - www/manager/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
= gettext('CT') + ' ' + 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('CT') + ' ' + vmid
);
57 Ext
.Msg
.confirm(gettext('Confirm'), msg
, function(btn
) {
62 vm_command('suspend');
67 text
: gettext('Resume'),
68 icon
: '/pve2/images/forward.png',
74 text
: gettext('Shutdown'),
75 icon
: '/pve2/images/stop.png',
77 var msg
= Ext
.String
.format(gettext("Do you really want to shutdown {0}?"), gettext('CT') + ' ' + vmid
);
78 Ext
.Msg
.confirm(gettext('Confirm'), msg
, function(btn
) {
83 vm_command('shutdown');
88 text
: gettext('Stop'),
89 icon
: '/pve2/images/gtk-stop.png',
91 var msg
= Ext
.String
.format(gettext("Do you really want to stop {0}?"), gettext('CT') + ' ' + 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 = Ext.String.format(gettext("Do you really want to convert {0} into a template?"), gettext('CT') + ' ' + 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 icon
: '/pve2/images/display.png',
124 handler: function() {
125 PVE
.Utils
.openDefaultConsoleWindow(true, 'lxc', vmid
, nodename
, vmname
);