* [pve-devel] [PATCH manager] ui: resource tree: render clustername consistently
@ 2025-11-17 15:37 Dominik Csapak
2025-11-17 17:04 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2025-11-17 15:37 UTC (permalink / raw)
To: pve-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pve-devel] applied: [PATCH manager] ui: resource tree: render clustername consistently
2025-11-17 15:37 [pve-devel] [PATCH manager] ui: resource tree: render clustername consistently Dominik Csapak
@ 2025-11-17 17:04 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-11-17 17:04 UTC (permalink / raw)
To: pve-devel, Dominik Csapak
On Mon, 17 Nov 2025 16:37:14 +0100, Dominik Csapak wrote:
> 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.
>
> [...]
Applied, thanks!
I wasn't sure if I had the separate function back when I added this to also
cope with a new cluster create showing up faster (on next login), but tbh.,
not sure at all (about that having worked nor that being really a goal), just
wanted to put it out the in case I remember more of it (or in the unlikely case
that we get some report about this).
[1/1] ui: resource tree: render clustername consistently
commit: 5d345fab0b48d9e9da820cb45c98bf8a3dc71b68
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-17 17:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-17 15:37 [pve-devel] [PATCH manager] ui: resource tree: render clustername consistently Dominik Csapak
2025-11-17 17:04 ` [pve-devel] applied: " Thomas Lamprecht
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.