]> git.proxmox.com Git - pve-manager.git/blame - www/manager/lxc/CmdMenu.js
disable animation of charts on load
[pve-manager.git] / www / manager / lxc / CmdMenu.js
CommitLineData
b48c6847
DM
1Ext.define('PVE.lxc.CmdMenu', {
2 extend: 'Ext.menu.Menu',
3
4 initComponent: function() {
5 var me = this;
6
7 var nodename = me.pveSelNode.data.node;
8 if (!nodename) {
9 throw "no node name specified";
10 }
11
12 var vmid = me.pveSelNode.data.vmid;
13 if (!vmid) {
14 throw "no CT ID specified";
15 }
16
17 var vmname = me.pveSelNode.data.name;
18
19 var vm_command = function(cmd, params) {
20 PVE.Utils.API2Request({
21 params: params,
22 url: '/nodes/' + nodename + '/lxc/' + vmid + "/status/" + cmd,
23 method: 'POST',
24 failure: function(response, opts) {
25 Ext.Msg.alert(gettext('Error'), response.htmlStatus);
26 }
27 });
28 };
29
cdac4112 30 me.title = gettext('CT') + ' ' + vmid;
b48c6847
DM
31
32 me.items = [
33 {
34 text: gettext('Start'),
35 icon: '/pve2/images/start.png',
36 handler: function() {
37 vm_command('start');
38 }
39 },
40 {
41 text: gettext('Migrate'),
42 icon: '/pve2/images/forward.png',
43 handler: function() {
44 var win = Ext.create('PVE.window.Migrate', {
45 vmtype: 'lxc',
46 nodename: nodename,
47 vmid: vmid
48 });
49 win.show();
50 }
51 },
52 {
53 text: gettext('Suspend'),
54 icon: '/pve2/images/forward.png',
55 handler: function() {
cdac4112 56 var msg = Ext.String.format(gettext("Do you really want to suspend {0}?"), gettext('CT') + ' ' + vmid);
b48c6847
DM
57 Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
58 if (btn !== 'yes') {
59 return;
60 }
61
62 vm_command('suspend');
63 });
64 }
65 },
66 {
67 text: gettext('Resume'),
68 icon: '/pve2/images/forward.png',
69 handler: function() {
70 vm_command('resume');
71 }
72 },
73 {
74 text: gettext('Shutdown'),
75 icon: '/pve2/images/stop.png',
76 handler: function() {
cdac4112 77 var msg = Ext.String.format(gettext("Do you really want to shutdown {0}?"), gettext('CT') + ' ' + vmid);
b48c6847
DM
78 Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
79 if (btn !== 'yes') {
80 return;
81 }
82
83 vm_command('shutdown');
84 });
85 }
86 },
87 {
88 text: gettext('Stop'),
89 icon: '/pve2/images/gtk-stop.png',
90 handler: function() {
cdac4112 91 var msg = Ext.String.format(gettext("Do you really want to stop {0}?"), gettext('CT') + ' ' + vmid);
b48c6847
DM
92 Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
93 if (btn !== 'yes') {
94 return;
95 }
96
97 vm_command("stop");
98 });
99 }
100 },
eafa845f
DC
101// {
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') {
108// return;
109// }
110//
111// PVE.Utils.API2Request({
112// url: '/nodes/' + nodename + '/lxc/' + vmid + '/template',
113// method: 'POST',
114// failure: function(response, opts) {
115// Ext.Msg.alert('Error', response.htmlStatus);
116// }
117// });
118// });
119// }
120// },
b48c6847
DM
121 {
122 text: gettext('Console'),
123 icon: '/pve2/images/display.png',
124 handler: function() {
125 PVE.Utils.openDefaultConsoleWindow(true, 'lxc', vmid, nodename, vmname);
126 }
127 }
128 ];
129
130 me.callParent();
131 }
132});