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 A2D4B69CFF for ; Fri, 12 Mar 2021 13:29:45 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A0BAD324F8 for ; Fri, 12 Mar 2021 13:29:15 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (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 id 7001B324E2 for ; Fri, 12 Mar 2021 13:29:14 +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 35A8B4637F for ; Fri, 12 Mar 2021 13:29:14 +0100 (CET) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Fri, 12 Mar 2021 13:29:13 +0100 Message-Id: <20210312122913.29451-3-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210312122913.29451-1-d.csapak@proxmox.com> References: <20210312122913.29451-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.189 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup 2/2] ui: refactor reloadTapeStore X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 12:29:45 -0000 by making use of the Ext.StoreManager and moving the code to PBS.Utils. This is ok since the store exists for the whole time of the UI (if it does at all). Signed-off-by: Dominik Csapak --- www/NavigationTree.js | 10 +--------- www/Utils.js | 4 ++++ www/tape/ChangerConfig.js | 7 +------ www/tape/DriveConfig.js | 7 +------ 4 files changed, 7 insertions(+), 21 deletions(-) diff --git a/www/NavigationTree.js b/www/NavigationTree.js index c609d9a4..35edacc5 100644 --- a/www/NavigationTree.js +++ b/www/NavigationTree.js @@ -121,6 +121,7 @@ Ext.define('PBS.view.main.NavigationTree', { if (view.tapestore === undefined) { view.tapestore = Ext.create('Proxmox.data.UpdateStore', { autoStart: true, + storeId: 'pbs-tape-drive-list', interval: 60 * 1000, model: 'pbs-tape-drive-list', }); @@ -267,15 +268,6 @@ Ext.define('PBS.view.main.NavigationTree', { }, }, - reloadTapeStore: function() { - let me = this; - if (!PBS.enableTapeUI) { - return; - } - - me.tapestore.load(); - }, - select: function(path, silent) { var me = this; if (me.rstore.isLoaded() && (!PBS.enableTapeUI || me.tapestore.isLoaded())) { diff --git a/www/Utils.js b/www/Utils.js index 6c8ca5cb..7c54ca41 100644 --- a/www/Utils.js +++ b/www/Utils.js @@ -620,6 +620,10 @@ Ext.define('PBS.Utils', { return `${icon} ${value}`; }, + reloadTapeStore() { + Ext.StoreManager.get('pbs-tape-drive-list').load(); + }, + }); Ext.define('PBS.Async', { diff --git a/www/tape/ChangerConfig.js b/www/tape/ChangerConfig.js index 0d9f6db6..8de61ff0 100644 --- a/www/tape/ChangerConfig.js +++ b/www/tape/ChangerConfig.js @@ -11,11 +11,6 @@ Ext.define('PBS.TapeManagement.ChangerPanel', { controller: { xclass: 'Ext.app.ViewController', - reloadTapeStore: function() { - let navtree = Ext.ComponentQuery.query('navigationtree')[0]; - navtree.reloadTapeStore(); - }, - onAdd: function() { let me = this; Ext.create('PBS.TapeManagement.ChangerEditWindow', { @@ -45,7 +40,7 @@ Ext.define('PBS.TapeManagement.ChangerPanel', { reload: function() { this.getView().getStore().rstore.load(); - this.reloadTapeStore(); + PBS.Utils.reloadTapeStore(); }, stopStore: function() { diff --git a/www/tape/DriveConfig.js b/www/tape/DriveConfig.js index a65de63a..ed73d028 100644 --- a/www/tape/DriveConfig.js +++ b/www/tape/DriveConfig.js @@ -19,11 +19,6 @@ Ext.define('PBS.TapeManagement.DrivePanel', { controller: { xclass: 'Ext.app.ViewController', - reloadTapeStore: function() { - let navtree = Ext.ComponentQuery.query('navigationtree')[0]; - navtree.reloadTapeStore(); - }, - onAdd: function() { let me = this; Ext.create('PBS.TapeManagement.DriveEditWindow', { @@ -62,7 +57,7 @@ Ext.define('PBS.TapeManagement.DrivePanel', { reload: function() { this.getView().getStore().rstore.load(); - this.reloadTapeStore(); + PBS.Utils.reloadTapeStore(); }, stopStore: function() { -- 2.20.1