From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] ui: resource tree: render clustername consistently
Date: Mon, 17 Nov 2025 16:37:14 +0100 [thread overview]
Message-ID: <20251117153721.3161092-1-d.csapak@proxmox.com> (raw)
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@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
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next reply other threads:[~2025-11-17 15:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-17 15:37 Dominik Csapak [this message]
2025-11-17 17:04 ` [pve-devel] applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251117153721.3161092-1-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox