public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] ui: check tabpanel subitems before setting activeTab
@ 2021-07-09 14:49 Dominik Csapak
  0 siblings, 0 replies; only message in thread
From: Dominik Csapak @ 2021-07-09 14:49 UTC (permalink / raw)
  To: pbs-devel

instead of blindy using the subpath of the routing for the activeTab,
check the prototype of the wanted class if that even exists, otherwise
delete subpath, and the first tab will be selected

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

diff --git a/www/MainView.js b/www/MainView.js
index d8f89979..4b0c40a2 100644
--- a/www/MainView.js
+++ b/www/MainView.js
@@ -97,6 +97,15 @@ Ext.define('PBS.MainView', {
 
 	    let [xtype, config] = me.parseRouterPath(path);
 	    var obj;
+
+	    let cls = Ext.ClassManager.getByAlias(`widget.${xtype}`); // must exist
+	    if (subpath && cls.prototype.getActiveTab) { // assume a tabpanel
+		let has_tab = cls.prototype.items.some((item) => item.itemId === subpath);
+		if (!has_tab) {
+		    subpath = undefined;
+		}
+	    }
+
 	    if (PBS.Utils.isDataStorePath(path)) {
 		if (lastpanel && lastpanel.xtype === xtype && !subpath) {
 		    let activeTab = lastpanel.getActiveTab();
-- 
2.30.2





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-09 14:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09 14:49 [pbs-devel] [PATCH proxmox-backup] ui: check tabpanel subitems before setting activeTab Dominik Csapak

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