[pve-devel] [PATCH manager 15/17] hide migrate in contextmenu when no cluster or no rights

Dominik Csapak d.csapak at proxmox.com
Wed Jul 19 15:45:27 CEST 2017


Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/lxc/CmdMenu.js  | 9 ++++++++-
 www/manager6/qemu/CmdMenu.js | 3 ++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/www/manager6/lxc/CmdMenu.js b/www/manager6/lxc/CmdMenu.js
index a96618af..f02f19c4 100644
--- a/www/manager6/lxc/CmdMenu.js
+++ b/www/manager6/lxc/CmdMenu.js
@@ -27,9 +27,12 @@ Ext.define('PVE.lxc.CmdMenu', {
 	    });
 	};
 
+	var caps = Ext.state.Manager.get('GuiCap');
+
 	var running = false;
 	var stopped = true;
 	var suspended = false;
+	var standalone = PVE.data.ResourceStore.getNodes().length < 2;
 
 	switch (me.pveSelNode.data.status) {
 	    case 'running':
@@ -108,10 +111,14 @@ Ext.define('PVE.lxc.CmdMenu', {
 		    });
 		}
 	    },
-	    { xtype: 'menuseparator' },
+	    {
+		xtype: 'menuseparator',
+		hidden: standalone // we only have 1 element between to separators
+	    },
 	    {
 		text: gettext('Migrate'),
 		iconCls: 'fa fa-fw fa-send-o',
+		hidden: standalone || (caps.vms['VM.Migrate'] ? false : true),
 		handler: function() {
 		    var win = Ext.create('PVE.window.Migrate', {
 			vmtype: 'lxc',
diff --git a/www/manager6/qemu/CmdMenu.js b/www/manager6/qemu/CmdMenu.js
index aa525b84..0fb832d4 100644
--- a/www/manager6/qemu/CmdMenu.js
+++ b/www/manager6/qemu/CmdMenu.js
@@ -33,6 +33,7 @@ Ext.define('PVE.qemu.CmdMenu', {
 	var running = false;
 	var stopped = true;
 	var suspended = false;
+	var standalone = PVE.data.ResourceStore.getNodes().length < 2;
 
 	switch (me.pveSelNode.data.status) {
 	    case 'running':
@@ -114,7 +115,7 @@ Ext.define('PVE.qemu.CmdMenu', {
 	    {
 		text: gettext('Migrate'),
 		iconCls: 'fa fa-fw fa-send-o',
-		hidden: caps.vms['VM.Migrate'] ? false : true,
+		hidden: standalone || (caps.vms['VM.Migrate'] ? false : true),
 		handler: function() {
 		    var win = Ext.create('PVE.window.Migrate', {
 			vmtype: 'qemu',
-- 
2.11.0





More information about the pve-devel mailing list