[pbs-devel] [PATCH proxmox-backup 8/8] ui: DataStorePanel: save active tab statefully

Dominik Csapak d.csapak at proxmox.com
Tue Oct 27 16:20:11 CET 2020


so that the last selected tab for datastores will get selected
the next time any datastore is selected, even across browser
reloads

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/DataStorePanel.js | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/www/DataStorePanel.js b/www/DataStorePanel.js
index 059fd3b2..0da94361 100644
--- a/www/DataStorePanel.js
+++ b/www/DataStorePanel.js
@@ -10,6 +10,25 @@ Ext.define('PBS.DataStorePanel', {
 	};
     },
 
+    stateId: 'pbs-datastore-panel',
+    stateful: true,
+
+    stateEvents: ['tabchange'],
+
+    applyState: function(state) {
+	let me = this;
+	if (state.tab !== undefined) {
+	    me.setActiveTab(state.tab);
+	}
+    },
+
+    getState: function() {
+	let me = this;
+	return {
+	    tab: me.getActiveTab().getItemId(),
+	};
+    },
+
     border: false,
     defaults: {
 	border: false,
-- 
2.20.1






More information about the pbs-devel mailing list