From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 91CEE91558 for ; Fri, 10 Mar 2023 15:41:43 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6236522823 for ; Fri, 10 Mar 2023 15:41:43 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 10 Mar 2023 15:41:42 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 9799244154 for ; Fri, 10 Mar 2023 15:41:41 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Date: Fri, 10 Mar 2023 15:41:31 +0100 Message-Id: <20230310144131.402390-1-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.051 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% 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 Subject: [pve-devel] applied: [PATCH] ui: fire config change: always pass required parameters 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: , X-List-Received-Date: Fri, 10 Mar 2023 14:41:43 -0000 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 --- www/manager6/UIOptions.js | 4 +--- www/manager6/data/ResourceStore.js | 9 +++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/www/manager6/UIOptions.js b/www/manager6/UIOptions.js index cb5a1755..057c8f03 100644 --- a/www/manager6/UIOptions.js +++ b/www/manager6/UIOptions.js @@ -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'); }, }); diff --git a/www/manager6/data/ResourceStore.js b/www/manager6/data/ResourceStore.js index f3a5c4d8..76da3f08 100644 --- a/www/manager6/data/ResourceStore.js +++ b/www/manager6/data/ResourceStore.js @@ -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; -- 2.39.2