[pve-devel] [PATCH manager] ui: resource tree: render clustername consistently

Dominik Csapak d.csapak at proxmox.com
Mon Nov 17 16:37:14 CET 2025


since we changed the tree to create the store outside the component on
first load, setting the clustername on the root element of the tree
could be race against the recreation of that node on the first load.

This made the display of the cluster name inconsistent, iow. sometimes
the clustername vanished after the first load.

To prevent that, don't set the clustername on the store record directly,
but adapt the render method to add the clustername from the global
`PVE.ClusterName` variable if it exists. Since this happens on login
(which happens before the load for the resource tree is triggered)
it happens before the rendering.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Workspace.js         |  4 +---
 www/manager6/tree/ResourceTree.js | 17 +++++------------
 2 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js
index 447dfe48..ce7ea21f 100644
--- a/www/manager6/Workspace.js
+++ b/www/manager6/Workspace.js
@@ -25,8 +25,6 @@ Ext.define('PVE.Workspace', {
         me.loginData = loginData;
         Proxmox.Utils.setAuthData(loginData);
 
-        let rt = me.down('pveResourceTree');
-        rt.setDatacenterText(loginData.clustername);
         PVE.ClusterName = loginData.clustername;
 
         if (loginData.cap) {
@@ -454,7 +452,7 @@ Ext.define('PVE.StdWorkspace', {
                                         me.showLogin();
                                         me.setContent(null);
                                         var rt = me.down('pveResourceTree');
-                                        rt.setDatacenterText(undefined);
+                                        PVE.ClusterName = undefined;
                                         rt.clearTree();
 
                                         // empty the stores of the StatusPanel child items
diff --git a/www/manager6/tree/ResourceTree.js b/www/manager6/tree/ResourceTree.js
index 770f7555..b55f124a 100644
--- a/www/manager6/tree/ResourceTree.js
+++ b/www/manager6/tree/ResourceTree.js
@@ -74,6 +74,11 @@ Ext.define('PVE.tree.ResourceTree', {
                 }
                 text = `<span>${status}${info.text}</span>`;
                 text += PVE.Utils.renderTags(info.tags, PVE.UIOptions.tagOverrides);
+
+                if (info.id === 'root' && PVE.ClusterName) {
+                    text += ` (${PVE.ClusterName})`;
+                }
+
                 return (info.renderedText = text);
             },
         },
@@ -554,18 +559,6 @@ Ext.define('PVE.tree.ResourceTree', {
                 me.clearTree();
                 updateTree();
             },
-            setDatacenterText: function (clustername) {
-                let rootnode = me.store.getRootNode();
-
-                let rnodeText = gettext('Datacenter');
-                if (clustername !== undefined) {
-                    rnodeText += ' (' + clustername + ')';
-                }
-
-                rootnode.beginEdit();
-                rootnode.data.text = rnodeText;
-                rootnode.commit();
-            },
             clearTree: function () {
                 pdata.updateCount = 0;
                 let rootnode = me.store.getRootNode();
-- 
2.47.3





More information about the pve-devel mailing list