[pve-devel] [RFC manager] cleanup of contextmenus

Dominik Csapak d.csapak at proxmox.com
Mon Apr 11 12:53:46 CEST 2016


change the order of the contextmenu items to
group functions, also introducing separators

like this:

***
power options
***
moving options
***
console
***

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

diff --git a/www/manager6/lxc/CmdMenu.js b/www/manager6/lxc/CmdMenu.js
index 5506c26..467ce6e 100644
--- a/www/manager6/lxc/CmdMenu.js
+++ b/www/manager6/lxc/CmdMenu.js
@@ -1,6 +1,7 @@
 Ext.define('PVE.lxc.CmdMenu', {
     extend: 'Ext.menu.Menu',
 
+    showSeparator: false,
     initComponent: function() {
 	var me = this;
 
@@ -53,21 +54,10 @@ Ext.define('PVE.lxc.CmdMenu', {
 		    vm_command('start');
 		}
 	    },
-	    {
-		text: gettext('Migrate'),
-		iconCls: 'fa fa-fw fa-send-o',
-		handler: function() {
-		    var win = Ext.create('PVE.window.Migrate', {
-			vmtype: 'lxc',
-			nodename: nodename,
-			vmid: vmid
-		    });
-		    win.show();
-		}
-	    },
 //	    {
 //		text: gettext('Suspend'),
 //		iconCls: 'fa fa-fw fa-pause',
+//		hidde: suspended,
 //		disabled: stopped || suspended,
 //		handler: function() {
 //		    var msg = PVE.Utils.format_task_description('vzsuspend', vmid);
@@ -83,7 +73,7 @@ Ext.define('PVE.lxc.CmdMenu', {
 //	    {
 //		text: gettext('Resume'),
 //		iconCls: 'fa fa-fw fa-play',
-//		disabled: !suspended,
+//		hidden: !suspended,
 //		handler: function() {
 //		    vm_command('resume');
 //		}
@@ -118,6 +108,19 @@ Ext.define('PVE.lxc.CmdMenu', {
 		    });
 		}
 	    },
+	    { xtype: 'menuseparator', },
+	    {
+		text: gettext('Migrate'),
+		iconCls: 'fa fa-fw fa-send-o',
+		handler: function() {
+		    var win = Ext.create('PVE.window.Migrate', {
+			vmtype: 'lxc',
+			nodename: nodename,
+			vmid: vmid
+		    });
+		    win.show();
+		}
+	    },
 //	    {
 //		text: gettext('Convert to template'),
 //		icon: '/pve2/images/forward.png',
@@ -138,6 +141,7 @@ Ext.define('PVE.lxc.CmdMenu', {
 //		    });
 //		}
 //	    },
+	    { xtype: 'menuseparator', },
 	    {
 		text: gettext('Console'),
 		iconCls: 'fa fa-fw fa-terminal',
diff --git a/www/manager6/qemu/CmdMenu.js b/www/manager6/qemu/CmdMenu.js
index 0869c91..3865e3d 100644
--- a/www/manager6/qemu/CmdMenu.js
+++ b/www/manager6/qemu/CmdMenu.js
@@ -1,6 +1,7 @@
 Ext.define('PVE.qemu.CmdMenu', {
     extend: 'Ext.menu.Menu',
 
+    showSeparator: false,
     initComponent: function() {
 	var me = this;
 
@@ -55,20 +56,9 @@ Ext.define('PVE.qemu.CmdMenu', {
 		}
 	    },
 	    {
-		text: gettext('Migrate'),
-		iconCls: 'fa fa-fw fa-send-o',
-		handler: function() {
-		    var win = Ext.create('PVE.window.Migrate', {
-			vmtype: 'qemu',
-			nodename: nodename,
-			vmid: vmid
-		    });
-		    win.show();
-		}
-	    },
-	    {
 		text: gettext('Suspend'),
 		iconCls: 'fa fa-fw fa-pause',
+		hidden: suspended,
 		disabled: stopped || suspended,
 		handler: function() {
 		    var msg = PVE.Utils.format_task_description('qmsuspend', vmid);
@@ -83,7 +73,7 @@ Ext.define('PVE.qemu.CmdMenu', {
 	    {
 		text: gettext('Resume'),
 		iconCls: 'fa fa-fw fa-play',
-		disabled: !suspended,
+		hidden: !suspended,
 		handler: function() {
 		    vm_command('resume');
 		}
@@ -118,6 +108,19 @@ Ext.define('PVE.qemu.CmdMenu', {
 		    });
 		}
 	    },
+	    { xtype: 'menuseparator' },
+	    {
+		text: gettext('Migrate'),
+		iconCls: 'fa fa-fw fa-send-o',
+		handler: function() {
+		    var win = Ext.create('PVE.window.Migrate', {
+			vmtype: 'qemu',
+			nodename: nodename,
+			vmid: vmid
+		    });
+		    win.show();
+		}
+	    },
 	    {
 		text: gettext('Clone'),
 		iconCls: 'fa fa-fw fa-clone',
@@ -149,6 +152,7 @@ Ext.define('PVE.qemu.CmdMenu', {
 		    });
 		}
 	    },
+	    { xtype: 'menuseparator' },
 	    {
 		text: gettext('Console'),
 		iconCls: 'fa fa-fw fa-terminal',
-- 
2.1.4




More information about the pve-devel mailing list