From 2de3d5385c7d949f3a9f77bf522ba45c4a0fabfa Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Mon, 25 Nov 2024 20:34:35 +0100 Subject: [PATCH] ui: datastore summary: only start/stop other stores on edges Disabling basically was already done only on an transition edge from "success" -> "failure" (= !success), as we stopped the periodic store load in that case, thus we never trigger to "failures" after each other without any user input. But on success we always unconditionally fired an activate, which cause the status store to start its store updates, which in turn immediately triggered as store load. So the verbose status call of the info panel was now coupled to the 1s update period of the encompassing summary panel, not the slower 5s period it actually wanted to trigger an update. So save the last state and check if it actually differs before causing such action. Signed-off-by: Thomas Lamprecht --- www/datastore/Summary.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/www/datastore/Summary.js b/www/datastore/Summary.js index 2ae94be6..53414c11 100644 --- a/www/datastore/Summary.js +++ b/www/datastore/Summary.js @@ -368,10 +368,13 @@ Ext.define('PBS.DataStoreSummary', { interval: 1000, }); + let lastRequestWasFailue = false; me.mon(me.statusStore, 'load', (s, records, success) => { let mountBtn = me.lookupReferenceHolder().lookupReference('mountButton'); let unmountBtn = me.lookupReferenceHolder().lookupReference('unmountButton'); if (!success) { + lastRequestWasFailue = true; + me.statusStore.stopUpdate(); me.down('pbsDataStoreInfo').fireEvent('deactivate'); Proxmox.Utils.API2Request({ @@ -395,9 +398,13 @@ Ext.define('PBS.DataStoreSummary', { }, }); } else { - me.down('pbsDataStoreInfo').fireEvent('activate'); + // only trigger on edges, else we couple our interval to the info one + if (lastRequestWasFailue) { + me.down('pbsDataStoreInfo').fireEvent('activate'); + } unmountBtn.setDisabled(false); mountBtn.setDisabled(true); + lastRequestWasFailue = false; } });