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] ui: check tabpanel subitems before setting activeTab
Date: Fri,  9 Jul 2021 16:49:19 +0200	[thread overview]
Message-ID: <20210709144919.2849617-1-d.csapak@proxmox.com> (raw)

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





                 reply	other threads:[~2021-07-09 14:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210709144919.2849617-1-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