public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] fix #4370: ui: fix regression of preselecting tree element on login
@ 2022-11-28 12:34 Dominik Csapak
  2022-11-28 17:01 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2022-11-28 12:34 UTC (permalink / raw)
  To: pve-devel

We want to select a tree element based on the fragment in the url after
a login. For which we must wait for the tree (ResourceStore) to load.

Since we recently introduced the loading of '/cluster/options' to
load the overrides of tags, etc. we fire a 'load' event with the
intention of triggering a rerender of the tree (to include the new
colors). If that triggers before the ResourceStore is loaded,
we try to set the element once (which fails) and nothing is selected.

To fix this, we only trigger it if it was already loaded and is not
currently loading. Otherwise it will be either redrawn after the ongoing
load, or by the first load.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/Utils.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 4dd3cb93e..8c118fa25 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1918,7 +1918,10 @@ Ext.define('PVE.Utils', {
 	}
 
 	Ext.ComponentQuery.query('pveResourceTree')[0].setUserCls(`proxmox-tags-${shape}`);
-	PVE.data.ResourceStore.fireEvent('load');
+
+	if (!PVE.data.ResourceStore.isLoading() && PVE.data.ResourceStore.isLoaded()) {
+	    PVE.data.ResourceStore.fireEvent('load');
+	}
 	Ext.GlobalEvents.fireEvent('loadedUiOptions');
     },
 
-- 
2.30.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-28 17:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-28 12:34 [pve-devel] [PATCH manager] fix #4370: ui: fix regression of preselecting tree element on login Dominik Csapak
2022-11-28 17:01 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal