[pve-devel] [PATCH manager v2] tree: prepare for ExtJS 6.2.0

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Feb 21 15:32:23 CET 2018


On 2/21/18 10:37 AM, Dominik Csapak wrote:> Tested again on chromium 64.0.3282.119 (debian stretch)
> and saw the same problem again:
> 
> if you have selected any item below node level (e.g. a vm)
> the last element of that group is shown at the root of the tree
> like this https://imgur.com/Eeklyle
> 
> also it can happen that you have multiple items selected
> 

Huh, very strange stuff - but I could now see some similar problems with
two node cluster...

> so we should only add this when we are actually updating to 6.2
> (and have the correct versioned dependencies)

Could you the append version? (use `git am --scissors ...eml`)

IMO we fired the refresh to late for the store, i moved it up to fire
directly after we resume events on the store, i.e. when our store update
window is closed again. So it happens before applying the state and
expanding the rootnode.

Else, applying the state brought already back some elements, and the
refresh event "shot" let than to an unclean - just an elaborate guess.

----8<----
From: Thomas Lamprecht <t.lamprecht at proxmox.com>

Remove the expand/collapse hack needed for an earlier ExtJS version.

Further do not collapse the rootnode before restoring the state, it
may not be collapsible at this time, as it may be still seen as leaf
node, and thus throws exceptions with ExtJS 6.2.0

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 www/manager6/tree/ResourceTree.js | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/www/manager6/tree/ResourceTree.js b/www/manager6/tree/ResourceTree.js
index 78d4cbb0..165ef733 100644
--- a/www/manager6/tree/ResourceTree.js
+++ b/www/manager6/tree/ResourceTree.js
@@ -186,8 +186,6 @@ Ext.define('PVE.tree.ResourceTree', {
 		groupinfo.leaf = false;
 		groupinfo.groupbyid = v; 
 		group = me.addChildSorted(node, groupinfo);
-		// fixme: remove when EXTJS has fixed those bugs?!
-		group.expand(); group.collapse();
 	    }
 	    if (info.type === groupby) {
 		return group;
@@ -346,6 +344,7 @@ Ext.define('PVE.tree.ResourceTree', {
 	    });
 
 	    store.resumeEvents();
+	    store.fireEvent('refresh', store);
 
 	    // select parent node is selection vanished
 	    if (lastsel && !rootnode.findChild('id', lastsel.data.id, true)) {
@@ -363,13 +362,11 @@ Ext.define('PVE.tree.ResourceTree', {
 
 	    // on first tree load set the selection from the stateful provider
 	    if (!pdata.updateCount) {
-		rootnode.collapse();
 		rootnode.expand();
 		me.applyState(sp.get(stateid));
 	    }
 
 	    pdata.updateCount++;
-	    store.fireEvent('refresh', store);
 	};
 
 	var statechange = function(sp, key, value) {
-- 
2.14.2





More information about the pve-devel mailing list