[pve-devel] [PATCH pve-manager 1/2] fix tree update when migrating a VM/CT
Emmanuel Kasper
e.kasper at proxmox.com
Thu Mar 24 13:37:02 CET 2016
original bug:
migrated items where not appearing under the target server
implentation:
remove items whose 'node' property has changed
as these items need to be removed before being re-added
also rename the local variable 'changed' to 'moved' to
better differentiate between what is updated in place, and
what needs to be redisplayed
---
www/manager6/tree/ResourceTree.js | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/www/manager6/tree/ResourceTree.js b/www/manager6/tree/ResourceTree.js
index c81d9c9..908638e 100644
--- a/www/manager6/tree/ResourceTree.js
+++ b/www/manager6/tree/ResourceTree.js
@@ -217,7 +217,8 @@ Ext.define('PVE.tree.ResourceTree', {
var groups = me.viewFilter.groups || [];
var filterfn = me.viewFilter.filterfn;
- // remove vanished or changed items
+ // remove vanished or moved items
+ // update in place changed items
var key;
for (key in index) {
if (index.hasOwnProperty(key)) {
@@ -228,19 +229,22 @@ Ext.define('PVE.tree.ResourceTree', {
var item = rstore.data.get(olditem.data.id);
var changed = false;
+ var moved = false;
if (item) {
// test if any grouping attributes changed
+ // this will also catch migrated nodes
var i, len;
for (i = 0, len = groups.length; i < len; i++) {
var attr = groups[i];
if (item.data[attr] != olditem.data[attr]) {
//console.log("changed " + attr);
- changed = true;
+ moved = true;
break;
}
}
+
+ // tree item has been updated
if ((item.data.text !== olditem.data.text) ||
- (item.data.node !== olditem.data.node) ||
(item.data.running !== olditem.data.running) ||
(item.data.template !== olditem.data.template)) {
//console.log("changed node/text/running " + olditem.data.id);
@@ -258,7 +262,7 @@ Ext.define('PVE.tree.ResourceTree', {
me.setIconCls(info);
olditem.commit();
}
- if (!item && olditem.isLeaf()) {
+ if ((!item || moved) && olditem.isLeaf()) {
//console.log("REM UID: " + key + " ITEM " + olditem.data.id);
delete index[key];
var parentNode = olditem.parentNode;
--
2.1.4
More information about the pve-devel
mailing list