mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-05-29 17:15:55 +00:00
add right-click menu for nodes
to easier reach the bulk actions, create wizards, and shell Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
05c4b7645d
commit
c11ab8cb4a
@ -13,6 +13,7 @@ JSSRC= \
|
|||||||
qemu/CmdMenu.js \
|
qemu/CmdMenu.js \
|
||||||
qemu/TemplateMenu.js \
|
qemu/TemplateMenu.js \
|
||||||
lxc/CmdMenu.js \
|
lxc/CmdMenu.js \
|
||||||
|
node/CmdMenu.js \
|
||||||
VNCConsole.js \
|
VNCConsole.js \
|
||||||
data/TimezoneStore.js \
|
data/TimezoneStore.js \
|
||||||
data/reader/JsonObject.js \
|
data/reader/JsonObject.js \
|
||||||
|
@ -1336,6 +1336,12 @@ Ext.define('PVE.Utils', { utilities: {
|
|||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
} else if (record.data.type === 'node' ){
|
||||||
|
menu = Ext.create('PVE.node.CmdMenu', {
|
||||||
|
nodename: record.data.node
|
||||||
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
117
www/manager6/node/CmdMenu.js
Normal file
117
www/manager6/node/CmdMenu.js
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
Ext.define('PVE.node.CmdMenu', {
|
||||||
|
extend: 'Ext.menu.Menu',
|
||||||
|
xtype: 'nodeCmdMenu',
|
||||||
|
|
||||||
|
showSeparator: false,
|
||||||
|
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
text: gettext('Create VM'),
|
||||||
|
itemId: 'createvm',
|
||||||
|
iconCls: 'fa fa-desktop',
|
||||||
|
handler: function() {
|
||||||
|
var me = this.up('menu');
|
||||||
|
var wiz = Ext.create('PVE.qemu.CreateWizard', {
|
||||||
|
nodename: me.nodename
|
||||||
|
});
|
||||||
|
wiz.show();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: gettext('Create CT'),
|
||||||
|
itemId: 'createct',
|
||||||
|
iconCls: 'fa fa-cube',
|
||||||
|
handler: function() {
|
||||||
|
var me = this.up('menu');
|
||||||
|
var wiz = Ext.create('PVE.lxc.CreateWizard', {
|
||||||
|
nodename: me.nodename
|
||||||
|
});
|
||||||
|
wiz.show();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ xtype: 'menuseparator' },
|
||||||
|
{
|
||||||
|
text: gettext('Bulk Start'),
|
||||||
|
itemId: 'bulkstart',
|
||||||
|
iconCls: 'fa fa-fw fa-play',
|
||||||
|
handler: function() {
|
||||||
|
var me = this.up('menu');
|
||||||
|
var win = Ext.create('PVE.window.BulkAction', {
|
||||||
|
nodename: me.nodename,
|
||||||
|
title: gettext('Bulk Start'),
|
||||||
|
btnText: gettext('Start'),
|
||||||
|
action: 'startall'
|
||||||
|
});
|
||||||
|
win.show();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: gettext('Bulk Stop'),
|
||||||
|
itemId: 'bulkstop',
|
||||||
|
iconCls: 'fa fa-fw fa-stop',
|
||||||
|
handler: function() {
|
||||||
|
var me = this.up('menu');
|
||||||
|
var win = Ext.create('PVE.window.BulkAction', {
|
||||||
|
nodename: me.nodename,
|
||||||
|
title: gettext('Bulk Stop'),
|
||||||
|
btnText: gettext('Stop'),
|
||||||
|
action: 'stopall'
|
||||||
|
});
|
||||||
|
win.show();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: gettext('Bulk Migrate'),
|
||||||
|
itemId: 'bulkmigrate',
|
||||||
|
iconCls: 'fa fa-fw fa-send-o',
|
||||||
|
handler: function() {
|
||||||
|
var me = this.up('menu');
|
||||||
|
var win = Ext.create('PVE.window.BulkAction', {
|
||||||
|
nodename: me.nodename,
|
||||||
|
title: gettext('Bulk Migrate'),
|
||||||
|
btnText: gettext('Migrate'),
|
||||||
|
action: 'migrateall'
|
||||||
|
});
|
||||||
|
win.show();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ xtype: 'menuseparator' },
|
||||||
|
{
|
||||||
|
text: gettext('Shell'),
|
||||||
|
itemId: 'shell',
|
||||||
|
iconCls: 'fa fa-fw fa-terminal',
|
||||||
|
handler: function() {
|
||||||
|
var me = this.up('menu');
|
||||||
|
PVE.Utils.openDefaultConsoleWindow(true, 'shell', undefined, me.nodename, undefined);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
initComponent: function() {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
if (!me.nodename) {
|
||||||
|
throw 'no nodename specified';
|
||||||
|
}
|
||||||
|
|
||||||
|
me.title = gettext('Node') + " '" + me.nodename + "'";
|
||||||
|
me.callParent();
|
||||||
|
|
||||||
|
var caps = Ext.state.Manager.get('GuiCap');
|
||||||
|
// disable not allowed options
|
||||||
|
if (!caps.vms['VM.Allocate']) {
|
||||||
|
me.getComponent('createct').setDisabled(true);
|
||||||
|
me.getComponent('createvm').setDisabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!caps.nodes['Sys.PowerMgmt']) {
|
||||||
|
me.getComponent('bulkstart').setDisabled(true);
|
||||||
|
me.getComponent('bulkstop').setDisabled(true);
|
||||||
|
me.getComponent('bulkmigrate').setDisabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!caps.nodes['Sys.Console']) {
|
||||||
|
me.getComponent('shell').setDisabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user