[pve-devel] [PATCH manager v2] Bugfix Only set a content when we have a selection

Emmanuel Kasper e.kasper at proxmox.com
Wed Sep 14 11:31:11 CEST 2016


Removing a node via updateTree() would cause the selection to be lost temporary
which in turn via the selectionchange listener would select an
empty content.
Now we only set a content if we have a selection.
This fix a graphical glitch where a migrated VM would not be properly
re-selected at its new position in tree.

The bug was introduced by:
    Clear sensitive content when logging out fixes #1060
    192f1ad2827c895bfd91465dfa4d3537ce02e9d2
---
changes since V1:
 * move var definitions inside the selected.length test since they
  are not used otherwise

 www/manager6/Workspace.js | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js
index 8b7b239..06357a0 100644
--- a/www/manager6/Workspace.js
+++ b/www/manager6/Workspace.js
@@ -291,19 +291,17 @@ Ext.define('PVE.StdWorkspace', {
 		selType: 'treemodel',
 		listeners: {
 		    selectionchange: function(sm, selected) {
-			var comp;
-			var tlckup = {
-			    root: 'PVE.dc.Config',
-			    node: 'PVE.node.Config',
-			    qemu: 'PVE.qemu.Config',
-			    lxc: 'PVE.lxc.Config',
-			    storage: 'PVE.storage.Browser',
-			    pool: 'pvePoolConfig'
-			};
-			
 			if (selected.length > 0) {
 			    var n = selected[0];
-			    comp = {
+			    var tlckup = {
+				root: 'PVE.dc.Config',
+				node: 'PVE.node.Config',
+				qemu: 'PVE.qemu.Config',
+				lxc: 'PVE.lxc.Config',
+				storage: 'PVE.storage.Browser',
+				pool: 'pvePoolConfig'
+			    };
+			    var comp = {
 				xtype: tlckup[n.data.type || 'root'] || 
 				    'pvePanelConfig',
 				showSearch: (n.data.id === 'root') ||
@@ -313,9 +311,8 @@ Ext.define('PVE.StdWorkspace', {
 				viewFilter: selview.getViewFilter()
 			    };
 			    PVE.curSelectedNode = n;
+			    me.setContent(comp);
 			}
-
-			me.setContent(comp);
 		    }
 		}
 	    }
-- 
2.1.4




More information about the pve-devel mailing list