From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 80DF51FF185 for ; Mon, 17 Nov 2025 16:38:05 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6B6911E1EC; Mon, 17 Nov 2025 16:38:07 +0100 (CET) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Mon, 17 Nov 2025 16:37:14 +0100 Message-ID: <20251117153721.3161092-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.030 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [info.id] Subject: [pve-devel] [PATCH manager] ui: resource tree: render clustername consistently X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "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 --- 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 = `${status}${info.text}`; 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