[pve-devel] [PATCH manager 3/4] check if tabs exist before selecting them

Dominik Csapak d.csapak at proxmox.com
Wed Jun 1 16:17:07 CEST 2016


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.csapak at 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





More information about the pve-devel mailing list