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.lampre...@proxmox.com>
Acked-By: Dominik Csapak <d.csa...@proxmox.com>
---

* changed order of moreBtn so that is as rightmost as possible
* add guestType to ha mange button so that it gets the correct caption
  (thanks emmanuel for noticing)

 www/manager6/lxc/Config.js | 43 +++++++++++++++++++++++++++++++------------
 1 file changed, 31 insertions(+), 12 deletions(-)

diff --git a/www/manager6/lxc/Config.js b/www/manager6/lxc/Config.js
index 3a8783a9..563ab8e8 100644
--- a/www/manager6/lxc/Config.js
+++ b/www/manager6/lxc/Config.js
@@ -89,16 +89,35 @@ 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,
+                           guestType: 'ct',
+                           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;
@@ -115,7 +134,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, removeBtn, migrateBtn, consoleBtn ],
+           tbar: [ startBtn, shutdownBtn, migrateBtn, consoleBtn, moreBtn ],
            defaults: { statusStore: me.statusStore },
            items: [
                {
@@ -273,7 +292,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);
        });
 
-- 
2.11.0


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to