[pve-devel] [PATCH manager 7/7] ui: lxc: add 'more' button with HA manage menu item to panel

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Oct 11 12:09:47 CEST 2017


Move the remove button into the more button and add a 'Manage HA'
button there, mirroring the changes from the qemu panel.

Allows to add an unmanaged CT to HA or to edit the HA settings of a
managed one.

Fixes: #1518
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 www/manager6/lxc/Config.js | 42 ++++++++++++++++++++++++++++++------------
 1 file changed, 30 insertions(+), 12 deletions(-)

diff --git a/www/manager6/lxc/Config.js b/www/manager6/lxc/Config.js
index d5a6ff7c..4dde5805 100644
--- a/www/manager6/lxc/Config.js
+++ b/www/manager6/lxc/Config.js
@@ -98,16 +98,34 @@ Ext.define('PVE.lxc.Config', {
 	    iconCls: 'fa fa-send-o'
 	});
 
-	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: 'CT', id: vmid }
-		}).show();
-	    },
-	    iconCls: 'fa fa-trash-o'
+	var moreBtn = Ext.create('PVE.button.Button', {
+	    text: gettext('More'),
+	    menu: { items: [
+		{
+		    iconCls: 'fa fa-heartbeat ',
+		    hidden: !caps.nodes['Sys.Console'],
+		    text: gettext('Manage HA'),
+		    handler: function() {
+			var ha = me.pveSelNode.data.hastate;
+			Ext.create('PVE.ha.VMResourceEdit', {
+			    vmid: vmid,
+			    isCreate: (!ha || ha === 'unmanaged')
+			}).show();
+		    }
+		},
+		{
+		    text: gettext('Remove'),
+		    disabled: !caps.vms['VM.Allocate'],
+		    itemId: 'removeBtn',
+		    handler: function() {
+			Ext.create('PVE.window.SafeDestroy', {
+			    url: base_url,
+			    item: { type: 'CT', id: vmid }
+			}).show();
+		    },
+		    iconCls: 'fa fa-trash-o'
+		}
+	    ]}
 	});
 
 	var vm = me.pveSelNode.data;
@@ -124,7 +142,7 @@ Ext.define('PVE.lxc.Config', {
 	Ext.apply(me, {
 	    title: Ext.String.format(gettext("Container {0} on node '{1}'"), vm.text, nodename),
 	    hstateid: 'lxctab',
-	    tbar: [ startBtn, shutdownBtn, umountBtn, removeBtn,
+	    tbar: [ startBtn, shutdownBtn, umountBtn, moreBtn,
 		    migrateBtn, consoleBtn ],
 	    defaults: { statusStore: me.statusStore },
 	    items: [
@@ -283,7 +301,7 @@ Ext.define('PVE.lxc.Config', {
 	    startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'running' || template);
 	    shutdownBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
 	    stopBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'stopped');
-	    removeBtn.setDisabled(!caps.vms['VM.Allocate'] || status !== 'stopped');
+	    me.down('#removeBtn').setDisabled(!caps.vms['VM.Allocate'] || status !== 'stopped');
 	    consoleBtn.setDisabled(template);
 
 	    if (status === 'mounted') {
-- 
2.11.0





More information about the pve-devel mailing list