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 B69BE748F8 for ; Fri, 9 Jul 2021 16:49:23 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id ABC9C2829A for ; Fri, 9 Jul 2021 16:49:23 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 4885028291 for ; Fri, 9 Jul 2021 16:49:20 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 13D8440FA6 for ; Fri, 9 Jul 2021 16:49:20 +0200 (CEST) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Fri, 9 Jul 2021 16:49:19 +0200 Message-Id: <20210709144919.2849617-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.629 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment 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] ui: check tabpanel subitems before setting activeTab 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, 09 Jul 2021 14:49:23 -0000 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 --- 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