[pve-devel] [PATCH manager v2] ui: resourcetree: move guest position on template creation
Aaron Lauterer
a.lauterer at proxmox.com
Thu Oct 21 11:41:00 CEST 2021
Tested with containers and VMs. Seems to work fine.
Tested-By: Aaron Lauterer <a.lauterer at 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 at 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']) {
>
More information about the pve-devel
mailing list