From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager v2] ui: resourcetree: move guest position on template creation
Date: Mon, 4 Oct 2021 09:50:00 +0200 [thread overview]
Message-ID: <20211004075000.922030-1-d.csapak@proxmox.com> (raw)
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>
---
changes from v1:
* create an array where we append the additional attributes to check
instead of having the checks separate, this way, we can easily
add new attributes to the list if we want to
www/manager6/tree/ResourceTree.js | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/www/manager6/tree/ResourceTree.js b/www/manager6/tree/ResourceTree.js
index 3b883d23..be90d4f7 100644
--- a/www/manager6/tree/ResourceTree.js
+++ b/www/manager6/tree/ResourceTree.js
@@ -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']) {
--
2.30.2
next reply other threads:[~2021-10-04 7:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-04 7:50 Dominik Csapak [this message]
2021-10-21 9:41 ` Aaron Lauterer
2021-10-21 9:49 ` [pve-devel] applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211004075000.922030-1-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox