]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: resourcetree: move guest position on template creation
authorDominik Csapak <d.csapak@proxmox.com>
Mon, 4 Oct 2021 07:50:00 +0000 (09:50 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 21 Oct 2021 09:48:38 +0000 (11:48 +0200)
we sort templates at the end normally, but if we convert a guest to a
template, it was not moved in the tree

add it to the list of attributes that are checked for a move

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-By: Aaron Lauterer <a.lauterer@proxmox.com>
www/manager6/tree/ResourceTree.js

index 3b883d23ad707c445ca0756e87d5fe49c8054761..be90d4f7a28f3d9e98e4a0c06e10530fb5aaf6bb 100644 (file)
@@ -239,6 +239,8 @@ Ext.define('PVE.tree.ResourceTree', {
            }
 
            let groups = me.viewFilter.groups || [];
+           // explicitly check for node/template, as those are not always grouping attributes
+           let moveCheckAttrs = groups.concat(['node', 'template']);
            let filterfn = me.viewFilter.filterfn;
 
            let reselect = false; // for disappeared nodes
@@ -251,16 +253,12 @@ Ext.define('PVE.tree.ResourceTree', {
                let changed = false, moved = false;
                if (item) {
                    // test if any grouping attributes changed, catches migrated tree-nodes in server view too
-                   for (const attr of groups) {
+                   for (const attr of moveCheckAttrs) {
                        if (item.data[attr] !== olditem.data[attr]) {
                            moved = true;
                            break;
                        }
                    }
-                   // explicitly check for node, as node is not a grouping attribute in some views
-                   if (!moved && item.data.node !== olditem.data.node) {
-                       moved = true;
-                   }
 
                    // tree item has been updated
                    for (const field of ['text', 'running', 'template', 'status', 'qmpstatus', 'hastate', 'lock']) {