[pbs-devel] [PATCH proxmox-backup 3/5] ui: tape: only add tapestore and nav element once

Dominik Csapak d.csapak at proxmox.com
Wed Mar 3 15:00:51 CET 2021


Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/NavigationTree.js | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/www/NavigationTree.js b/www/NavigationTree.js
index 1c33d52d..4b25114e 100644
--- a/www/NavigationTree.js
+++ b/www/NavigationTree.js
@@ -119,25 +119,28 @@ Ext.define('PBS.view.main.NavigationTree', {
 	    view.on('destroy', view.rstore.stopUpdate);
 
 	    if (PBS.enableTapeUI) {
-		view.tapestore = Ext.create('Proxmox.data.UpdateStore', {
-		    autoStart: true,
-		    interval: 2 * 1000,
-		    storeid: 'pbs-tape-drive-list',
-		    model: 'pbs-tape-drive-list',
-		});
+		if (view.tapestore === undefined) {
+		    view.tapestore = Ext.create('Proxmox.data.UpdateStore', {
+			autoStart: true,
+			interval: 2 * 1000,
+			storeid: 'pbs-tape-drive-list',
+			model: 'pbs-tape-drive-list',
+		    });
+		    view.tapestore.on('load', this.onTapeDriveLoad, this);
+		    view.on('destroy', view.tapestore.stopUpdate);
+		}
 
 		let root = view.getStore().getRoot();
-		root.insertChild(3, {
-		    text: "Tape Backup",
-		    iconCls: 'pbs-icon-tape',
-		    id: 'tape_management',
-		    path: 'pbsTapeManagement',
-		    expanded: true,
-		    children: [],
-		});
-
-		view.tapestore.on('load', this.onTapeDriveLoad, this);
-		view.on('destroy', view.tapestore.stopUpdate);
+		if (root.findChild('id', 'tape_management', false) === null) {
+		    root.insertChild(3, {
+			text: "Tape Backup",
+			iconCls: 'pbs-icon-tape',
+			id: 'tape_management',
+			path: 'pbsTapeManagement',
+			expanded: true,
+			children: [],
+		    });
+		}
 	    }
 	},
 
-- 
2.20.1






More information about the pbs-devel mailing list