when switching from a vm to a template, if you
have a tab selected which does not exists in a template
(for example console or task history) you break
the site

this patch checks if the wanted tab actually exists,
and leave it on default (the first) when it does not

Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
---
 www/manager6/panel/ConfigPanel.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/www/manager6/panel/ConfigPanel.js 
b/www/manager6/panel/ConfigPanel.js
index 9afdd7d..489eb3b 100644
--- a/www/manager6/panel/ConfigPanel.js
+++ b/www/manager6/panel/ConfigPanel.js
@@ -23,7 +23,13 @@ Ext.define('PVE.panel.Config', {
            var state = sp.get(stateid);
            if (state && state.value) {
                var res = hsregex.exec(state.value);
-               if (res && res[1]) {
+               if (res && res[1] && Ext.isArray(me.items)) {
+                   me.items.forEach(function(item) {
+                       if (item.itemId === res[1]) {
+                           activeTab = res[1];
+                       }
+                   });
+               } else if (res && res[1] && me.items && me.items.itemId === 
res[1]) {
                    activeTab = res[1];
                }
            }
-- 
2.1.4


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to