]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: fire config change: always pass required parameters
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 10 Mar 2023 14:38:17 +0000 (15:38 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 10 Mar 2023 14:38:21 +0000 (15:38 +0100)
As otherwise the listeners might choke on the missing records.

For our usage it was only a problem when one changed the tree UI
options while having the Datacenter -> Summary panel open, as that
listens to the UI changes to adapt the shown gauges for e.g., memory,
storage, or CPUs, and thus actually uses the current result (unlike
we do in the store load listener).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/manager6/UIOptions.js
www/manager6/data/ResourceStore.js

index cb5a1755224d6888abcc5e27322dd72f237d5287..057c8f031ca67ee0efc11ab49e0aeca9ea6c5f73 100644 (file)
@@ -99,9 +99,7 @@ Ext.define('PVE.UIOptions', {
     },
 
     fireUIConfigChanged: function() {
-       if (!PVE.data.ResourceStore.isLoading() && PVE.data.ResourceStore.isLoaded()) {
-           PVE.data.ResourceStore.fireEvent('load');
-       }
+       PVE.data.ResourceStore.refresh();
        Ext.GlobalEvents.fireEvent('loadedUiOptions');
     },
 });
index f3a5c4d81ea35845033a9f8acb79c20d2e1db900..76da3f0824bd665bf7c13cf30d785aec069b1c1f 100644 (file)
@@ -53,6 +53,15 @@ Ext.define('PVE.data.ResourceStore', {
        return '';
     },
 
+    refresh: function() {
+       let me = this;
+       // can only refresh if we're loaded at least once and are not currently loading
+       if (!me.isLoading() && me.isLoaded()) {
+           let records = (me.getData().getSource() || me.getData()).getRange()
+           me.fireEvent('load', me, records);
+       }
+    },
+
     constructor: function(config) {
        let me = this;