public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 2/2] ui: refactor reloadTapeStore
Date: Fri, 12 Mar 2021 13:29:13 +0100	[thread overview]
Message-ID: <20210312122913.29451-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20210312122913.29451-1-d.csapak@proxmox.com>

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 <d.csapak@proxmox.com>
---
 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





      parent reply	other threads:[~2021-03-12 12:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12 12:29 [pbs-devel] [PATCH proxmox-backup 0/2] removing of 'storeid'/refactor tapeStore Dominik Csapak
2021-03-12 12:29 ` [pbs-devel] [PATCH proxmox-backup 1/2] ui: remove unecessary storeids Dominik Csapak
2021-03-12 12:29 ` Dominik Csapak [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210312122913.29451-3-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal