[pve-devel] [PATCH manager v2 3/5] ui: ha: hide ha groups if use-location-rules is enabled

Daniel Kral d.kral at proxmox.com
Fri Jun 20 16:31:46 CEST 2025


Remove the HA Groups entry from the datacenter's config tabs if the
use-location-rules feature flag is enabled.

As changing the use-location-rules feature flag doesn't automatically
reload the web interface, show an empty message if the HA Groups page is
still open.

Remove the 'ha-groups' from the state provider as the ha-groups page
only exists conditionally now and the StateProvider expects all entries
to exist at any time.

Signed-off-by: Daniel Kral <d.kral at proxmox.com>
---
changes since v1:
    - NEW!

 www/manager6/StateProvider.js |  1 -
 www/manager6/Workspace.js     | 20 ++++++++++++++++++++
 www/manager6/dc/Config.js     | 24 ++++++++++++++----------
 www/manager6/ha/Groups.js     |  6 ++++++
 4 files changed, 40 insertions(+), 11 deletions(-)

diff --git a/www/manager6/StateProvider.js b/www/manager6/StateProvider.js
index 5137ee55..d8686014 100644
--- a/www/manager6/StateProvider.js
+++ b/www/manager6/StateProvider.js
@@ -54,7 +54,6 @@ Ext.define('PVE.StateProvider', {
         system: 50,
         monitor: 49,
         'ha-fencing': 48,
-        'ha-groups': 47,
         'ha-resources': 46,
         'ceph-log': 45,
         'ceph-crushmap': 44,
diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js
index e6b18bf7..f9680429 100644
--- a/www/manager6/Workspace.js
+++ b/www/manager6/Workspace.js
@@ -164,6 +164,26 @@ Ext.define('PVE.StdWorkspace', {
 
             PVE.UIOptions.update();
 
+            Proxmox.Utils.API2Request({
+                url: '/cluster/options',
+                method: 'GET',
+                success: function (response) {
+                    let dcConfig = response.result?.data ?? {};
+                    PVE.HALocationEnabled = dcConfig?.ha?.['use-location-rules'] === 1;
+
+                    // remove HA Groups menu item if HA Location rules are enabled
+                    if (PVE.HALocationEnabled) {
+                        let haMenu = Ext.ComponentQuery.query('treelistitem[text="HA"]')[0];
+                        let haGroupsMenu = Object.values(haMenu?.itemMap ?? {}).find(
+                            (element) => element.getText() === 'Groups',
+                        );
+                        if (haGroupsMenu) {
+                            haGroupsMenu.addCls('x-hidden-display');
+                        }
+                    }
+                },
+            });
+
             Proxmox.Utils.API2Request({
                 url: '/cluster/sdn',
                 method: 'GET',
diff --git a/www/manager6/dc/Config.js b/www/manager6/dc/Config.js
index 6173a9b2..7e39c85f 100644
--- a/www/manager6/dc/Config.js
+++ b/www/manager6/dc/Config.js
@@ -169,21 +169,25 @@ Ext.define('PVE.dc.Config', {
                     iconCls: 'fa fa-heartbeat',
                     itemId: 'ha',
                 },
-                {
+            );
+
+            if (!PVE.HALocationEnabled) {
+                me.items.push({
                     title: gettext('Groups'),
                     groups: ['ha'],
                     xtype: 'pveHAGroupsView',
                     iconCls: 'fa fa-object-group',
                     itemId: 'ha-groups',
-                },
-                {
-                    title: gettext('Fencing'),
-                    groups: ['ha'],
-                    iconCls: 'fa fa-bolt',
-                    xtype: 'pveFencingView',
-                    itemId: 'ha-fencing',
-                },
-            );
+                });
+            }
+
+            me.items.push({
+                title: gettext('Fencing'),
+                groups: ['ha'],
+                iconCls: 'fa fa-bolt',
+                xtype: 'pveFencingView',
+                itemId: 'ha-fencing',
+            });
             // always show on initial load, will be hiddea later if the SDN API calls don't exist,
             // else it won't be shown at first if the user initially loads with DC selected
             if (PVE.SDNInfo || PVE.SDNInfo === undefined) {
diff --git a/www/manager6/ha/Groups.js b/www/manager6/ha/Groups.js
index 6b4958f0..4aad0dda 100644
--- a/www/manager6/ha/Groups.js
+++ b/www/manager6/ha/Groups.js
@@ -112,6 +112,12 @@ Ext.define('PVE.ha.GroupsView', {
             },
         });
 
+        PVE.Utils.getHALocationFeatureStatus().then((isHALocationEnabled) => {
+            if (isHALocationEnabled) {
+                me.emptyText = gettext('HA Location rules are used instead of HA Groups');
+            }
+        });
+
         me.callParent();
     },
 });
-- 
2.39.5





More information about the pve-devel mailing list