]> git.proxmox.com Git - pve-manager.git/blame - www/manager6/node/CmdMenu.js
ui: add panel for listing APT repositories
[pve-manager.git] / www / manager6 / node / CmdMenu.js
CommitLineData
c11ab8cb
DC
1Ext.define('PVE.node.CmdMenu', {
2 extend: 'Ext.menu.Menu',
3 xtype: 'nodeCmdMenu',
4
5 showSeparator: false,
6
7 items: [
8 {
9 text: gettext('Create VM'),
10 itemId: 'createvm',
11 iconCls: 'fa fa-desktop',
12 handler: function() {
ecbe890b
TL
13 Ext.create('PVE.qemu.CreateWizard', {
14 nodename: this.up('menu').nodename,
15 autoShow: true,
c11ab8cb 16 });
f6710aac 17 },
c11ab8cb
DC
18 },
19 {
20 text: gettext('Create CT'),
21 itemId: 'createct',
22 iconCls: 'fa fa-cube',
23 handler: function() {
ecbe890b
TL
24 Ext.create('PVE.lxc.CreateWizard', {
25 nodename: this.up('menu').nodename,
26 autoShow: true,
c11ab8cb 27 });
f6710aac 28 },
c11ab8cb
DC
29 },
30 { xtype: 'menuseparator' },
31 {
32 text: gettext('Bulk Start'),
33 itemId: 'bulkstart',
34 iconCls: 'fa fa-fw fa-play',
35 handler: function() {
ecbe890b
TL
36 Ext.create('PVE.window.BulkAction', {
37 nodename: this.up('menu').nodename,
c11ab8cb
DC
38 title: gettext('Bulk Start'),
39 btnText: gettext('Start'),
f6710aac 40 action: 'startall',
ecbe890b 41 autoShow: true,
c11ab8cb 42 });
f6710aac 43 },
c11ab8cb
DC
44 },
45 {
46 text: gettext('Bulk Stop'),
47 itemId: 'bulkstop',
48 iconCls: 'fa fa-fw fa-stop',
49 handler: function() {
ecbe890b
TL
50 Ext.create('PVE.window.BulkAction', {
51 nodename: this.up('menu').nodename,
c11ab8cb
DC
52 title: gettext('Bulk Stop'),
53 btnText: gettext('Stop'),
f6710aac 54 action: 'stopall',
ecbe890b 55 autoShow: true,
c11ab8cb 56 });
f6710aac 57 },
c11ab8cb
DC
58 },
59 {
60 text: gettext('Bulk Migrate'),
61 itemId: 'bulkmigrate',
62 iconCls: 'fa fa-fw fa-send-o',
63 handler: function() {
ecbe890b
TL
64 Ext.create('PVE.window.BulkAction', {
65 nodename: this.up('menu').nodename,
c11ab8cb
DC
66 title: gettext('Bulk Migrate'),
67 btnText: gettext('Migrate'),
f6710aac 68 action: 'migrateall',
ecbe890b 69 autoShow: true,
c11ab8cb 70 });
f6710aac 71 },
c11ab8cb
DC
72 },
73 { xtype: 'menuseparator' },
74 {
75 text: gettext('Shell'),
76 itemId: 'shell',
77 iconCls: 'fa fa-fw fa-terminal',
78 handler: function() {
ecbe890b
TL
79 let nodename = this.up('menu').nodename;
80 PVE.Utils.openDefaultConsoleWindow(true, 'shell', undefined, nodename, undefined);
f6710aac 81 },
06406206
CE
82 },
83 { xtype: 'menuseparator' },
84 {
85 text: gettext('Wake-on-LAN'),
86 itemId: 'wakeonlan',
87 iconCls: 'fa fa-fw fa-power-off',
88 handler: function() {
ecbe890b 89 let nodename = this.up('menu').nodename;
06406206 90 Proxmox.Utils.API2Request({
ecbe890b 91 url: `/nodes/${nodename}/wakeonlan`,
06406206 92 method: 'POST',
ecbe890b 93 failure: (response, opts) => Ext.Msg.alert(gettext('Error'), response.htmlStatus),
06406206
CE
94 success: function(response, opts) {
95 Ext.Msg.show({
96 title: 'Success',
97 icon: Ext.Msg.INFO,
ecbe890b
TL
98 msg: Ext.String.format(
99 gettext("Wake on LAN packet send for '{0}': '{1}'"),
100 nodename,
101 response.result.data,
102 ),
06406206 103 });
f6710aac 104 },
06406206 105 });
f6710aac
TL
106 },
107 },
c11ab8cb
DC
108 ],
109
110 initComponent: function() {
ecbe890b 111 let me = this;
c11ab8cb
DC
112
113 if (!me.nodename) {
114 throw 'no nodename specified';
115 }
116
117 me.title = gettext('Node') + " '" + me.nodename + "'";
118 me.callParent();
119
ecbe890b
TL
120 let caps = Ext.state.Manager.get('GuiCap');
121
c11ab8cb
DC
122 if (!caps.vms['VM.Allocate']) {
123 me.getComponent('createct').setDisabled(true);
124 me.getComponent('createvm').setDisabled(true);
125 }
c11ab8cb
DC
126 if (!caps.nodes['Sys.PowerMgmt']) {
127 me.getComponent('bulkstart').setDisabled(true);
128 me.getComponent('bulkstop').setDisabled(true);
129 me.getComponent('bulkmigrate').setDisabled(true);
06406206 130 me.getComponent('wakeonlan').setDisabled(true);
c11ab8cb 131 }
c11ab8cb
DC
132 if (!caps.nodes['Sys.Console']) {
133 me.getComponent('shell').setDisabled(true);
134 }
06406206
CE
135 if (me.pveSelNode.data.running) {
136 me.getComponent('wakeonlan').setDisabled(true);
137 }
f6710aac 138 },
c11ab8cb 139});