From e008e6e44fcb457b58952bdbd8cda05ec3d16fd4 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Wed, 1 Jun 2016 16:17:07 +0200 Subject: [PATCH] check if tabs exist before selecting them 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 --- 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 9afdd7d4..489eb3b9 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]; } }