[pve-devel] [PATCH pve-manager v2] update leaf nodes instead of removing / readding them
Emmanuel Kasper
e.kasper at proxmox.com
Mon Mar 14 10:31:43 CET 2016
if the selected node has its status changed between stop &
running, the node was removed and then readded
during the remove / add process the 'selected' status of the node
was lost if it has one
instead of deleting / readding the node, we update now its content
this was the default behaviour for server nodes, but not for leaf nodes
this fixes a graphical bug where starting/stopping a VM/container would lose
the current selection in the ressource tree
---
www/manager6/tree/ResourceTree.js | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/www/manager6/tree/ResourceTree.js b/www/manager6/tree/ResourceTree.js
index 711a386..c81d9c9 100644
--- a/www/manager6/tree/ResourceTree.js
+++ b/www/manager6/tree/ResourceTree.js
@@ -250,22 +250,19 @@ Ext.define('PVE.tree.ResourceTree', {
// fixme: also test filterfn()?
}
- if (!item || changed) {
+ if (changed) {
+ olditem.beginEdit();
+ //console.log("REM UPDATE UID: " + key + " ITEM " + item.data.running);
+ var info = olditem.data;
+ Ext.apply(info, item.data);
+ me.setIconCls(info);
+ olditem.commit();
+ }
+ if (!item && olditem.isLeaf()) {
//console.log("REM UID: " + key + " ITEM " + olditem.data.id);
- if (olditem.isLeaf()) {
- delete index[key];
- var parentNode = olditem.parentNode;
- parentNode.removeChild(olditem, true);
- } else {
- if (item && changed) {
- olditem.beginEdit();
- //console.log("REM UPDATE UID: " + key + " ITEM " + item.data.running);
- var info = olditem.data;
- Ext.apply(info, item.data);
- me.setIconCls(info);
- olditem.commit();
- }
- }
+ delete index[key];
+ var parentNode = olditem.parentNode;
+ parentNode.removeChild(olditem, true);
}
}
}
@@ -303,6 +300,7 @@ Ext.define('PVE.tree.ResourceTree', {
me.selectById(lastsel.data.id);
}
+ // on first tree load set the selection from the stateful provider
if (!pdata.updateCount) {
rootnode.collapse();
rootnode.expand();
--
2.1.4
More information about the pve-devel
mailing list