[pve-devel] [PATCH manager 5/8] ui: qemu: combine system changing buttons

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Oct 17 11:48:03 CEST 2017


add a 'More' Button to the VM and CT Config Panel (its base panel)
and move all buttons which may result in config changes there.
After that we have separated power/migrate actions from system
affecting actions (clone, remove, convert to template).

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
Acked-By: Dominik Csapak <d.csapak at proxmox.com>
---

* changed order of moreBtn so that is as rightmost as possible

 www/manager6/qemu/Config.js | 55 ++++++++++++++++++++++++---------------------
 1 file changed, 29 insertions(+), 26 deletions(-)

diff --git a/www/manager6/qemu/Config.js b/www/manager6/qemu/Config.js
index f1666f8b..208c3580 100644
--- a/www/manager6/qemu/Config.js
+++ b/www/manager6/qemu/Config.js
@@ -76,17 +76,21 @@ Ext.define('PVE.qemu.Config', {
 	    iconCls: 'fa fa-send-o'
 	});
 
-	var cloneBtn = Ext.create('PVE.button.Split', {
-	    text: gettext('Clone'),
-	    iconCls: 'fa fa-fw fa-clone',
-	    hidden: caps.vms['VM.Clone'] ? false : true,
-	    handler: function() {
-		PVE.window.Clone.wrap(nodename, vmid, template);
-	    },
-	    menu: {
-		items: [{
+	var moreBtn = Ext.create('PVE.button.Button', {
+	    text: gettext('More'),
+	    menu: { items: [
+		{
+		    text: gettext('Clone'),
+		    iconCls: 'fa fa-fw fa-clone',
+		    hidden: caps.vms['VM.Clone'] ? false : true,
+		    handler: function() {
+			PVE.window.Clone.wrap(nodename, vmid, template);
+		    }
+		},
+		{
 		    text: gettext('Convert to template'),
 		    disabled: template,
+		    xtype: 'pveMenuItem',
 		    iconCls: 'fa fa-fw fa-file-o',
 		    hidden: caps.vms['VM.Allocate'] ? false : true,
 		    confirmMsg: PVE.Utils.format_task_description('qmtemplate', vmid),
@@ -100,8 +104,20 @@ Ext.define('PVE.qemu.Config', {
 			    }
 			});
 		    }
-		}]
-	    }
+		},
+		{
+		    text: gettext('Remove'),
+		    itemId: 'removeBtn',
+		    disabled: !caps.vms['VM.Allocate'],
+		    handler: function() {
+			Ext.create('PVE.window.SafeDestroy', {
+			    url: base_url,
+			    item: { type: 'VM', id: vmid }
+			}).show();
+		    },
+		    iconCls: 'fa fa-trash-o'
+		}
+	    ]}
 	});
 
 	var shutdownBtn = Ext.create('PVE.button.Split', {
@@ -135,18 +151,6 @@ Ext.define('PVE.qemu.Config', {
 	    iconCls: 'fa fa-power-off'
 	});
 
-	var removeBtn = Ext.create('PVE.button.Button', {
-	    text: gettext('Remove'),
-	    disabled: !caps.vms['VM.Allocate'],
-	    handler: function() {
-		Ext.create('PVE.window.SafeDestroy', {
-		    url: base_url,
-		    item: { type: 'VM', id: vmid }
-		}).show();
-	    },
-	    iconCls: 'fa fa-trash-o'
-	});
-
 	var vm = me.pveSelNode.data;
 
 	var consoleBtn = Ext.create('PVE.button.ConsoleButton', {
@@ -162,8 +166,7 @@ Ext.define('PVE.qemu.Config', {
 	Ext.apply(me, {
 	    title: Ext.String.format(gettext("Virtual Machine {0} on node '{1}'"), vm.text, nodename),
 	    hstateid: 'kvmtab',
-	    tbar: [ resumeBtn, startBtn, shutdownBtn,
-		    removeBtn, migrateBtn, cloneBtn, consoleBtn],
+	    tbar: [ resumeBtn, startBtn, shutdownBtn, migrateBtn, consoleBtn, moreBtn ],
 	    defaults: { statusStore: me.statusStore },
 	    items: [
 		{
@@ -339,7 +342,7 @@ Ext.define('PVE.qemu.Config', {
 
 	    startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'running' || template);
 	    shutdownBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
-	    removeBtn.setDisabled(!caps.vms['VM.Allocate'] || status !== 'stopped');
+	    me.down('#removeBtn').setDisabled(!caps.vms['VM.Allocate'] || status !== 'stopped');
 	    consoleBtn.setDisabled(template);
 	});
 
-- 
2.11.0





More information about the pve-devel mailing list