public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager v2] ui: resourcetree: move guest position on template creation
@ 2021-10-04  7:50 Dominik Csapak
  2021-10-21  9:41 ` Aaron Lauterer
  2021-10-21  9:49 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 2 replies; 3+ messages in thread
From: Dominik Csapak @ 2021-10-04  7:50 UTC (permalink / raw)
  To: pve-devel

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pve-devel] [PATCH manager v2] ui: resourcetree: move guest position on template creation
  2021-10-04  7:50 [pve-devel] [PATCH manager v2] ui: resourcetree: move guest position on template creation Dominik Csapak
@ 2021-10-21  9:41 ` Aaron Lauterer
  2021-10-21  9:49 ` [pve-devel] applied: " Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Aaron Lauterer @ 2021-10-21  9:41 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

Tested with containers and VMs. Seems to work fine.

Tested-By: Aaron Lauterer <a.lauterer@proxmox.com>

On 10/4/21 09:50, Dominik Csapak wrote:
> 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']) {
> 




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] applied: [PATCH manager v2] ui: resourcetree: move guest position on template creation
  2021-10-04  7:50 [pve-devel] [PATCH manager v2] ui: resourcetree: move guest position on template creation Dominik Csapak
  2021-10-21  9:41 ` Aaron Lauterer
@ 2021-10-21  9:49 ` Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2021-10-21  9:49 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

On 04.10.21 09:50, Dominik Csapak wrote:
> 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(-)
> 
>

with Aaron's T-b applied, thanks to both!




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-21  9:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-04  7:50 [pve-devel] [PATCH manager v2] ui: resourcetree: move guest position on template creation Dominik Csapak
2021-10-21  9:41 ` Aaron Lauterer
2021-10-21  9:49 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal