fix #4370: ui: fix regression of preselecting tree element on login

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>
This commit is contained in:
Dominik Csapak 2022-11-28 13:34:00 +01:00 committed by Thomas Lamprecht
parent d1bb39d448
commit ad02432922

View File

@ -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');
},