ui: resourcetree: move guest position on template creation

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>
This commit is contained in:
Dominik Csapak 2021-10-04 09:50:00 +02:00 committed by Thomas Lamprecht
parent e8c41dc561
commit d8da55382a

View 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']) {