public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager v2] ui: pool create: allow selecting parent pool via selector
@ 2026-01-23  7:42 Dominik Csapak
  2026-08-31  9:26 ` Dominik Csapak
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-01-23  7:42 UTC (permalink / raw)
  To: pve-devel

instead of having to type out the full path, e.g. 'foo/bar/baz',
show a 'pool selector' to select the parent pool.

Forbid using slashes in the name field so it's not possible to specify
the structure with both the name and parent pool field.

This makes creating nested pools more obvious and easier.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
changes from v1:
* always delete 'parentPool' from values so we don't accidentally submit it
* only consider parentPool if it's a non-empty string
* add regex to the namefield to disallow slashes
* add emptyText to the poolselector

 www/manager6/dc/PoolEdit.js | 52 +++++++++++++++++++++++++++----------
 1 file changed, 39 insertions(+), 13 deletions(-)

diff --git a/www/manager6/dc/PoolEdit.js b/www/manager6/dc/PoolEdit.js
index 72a084ac..ee39137a 100644
--- a/www/manager6/dc/PoolEdit.js
+++ b/www/manager6/dc/PoolEdit.js
@@ -17,20 +17,46 @@ Ext.define('PVE.dc.PoolEdit', {
 
     items: [
         {
-            xtype: 'pmxDisplayEditField',
-            fieldLabel: gettext('Name'),
-            cbind: {
-                editable: '{isCreate}',
-                value: '{poolid}',
+            xtype: 'inputpanel',
+            onGetValues: function (values) {
+                if (Ext.isString(values.parentPool) && values.parentPool.length > 0) {
+                    values.poolid = values.parentPool + '/' + values.poolid;
+                }
+                delete values.parentPool;
+                return values;
             },
-            name: 'poolid',
-            allowBlank: false,
-        },
-        {
-            xtype: 'textfield',
-            fieldLabel: gettext('Comment'),
-            name: 'comment',
-            allowBlank: true,
+            items: [
+                {
+                    xtype: 'pmxDisplayEditField',
+                    fieldLabel: gettext('Name'),
+                    cbind: {
+                        editable: '{isCreate}',
+                        value: '{poolid}',
+                    },
+                    editConfig: {
+                        regex: /^[^/]+$/,
+                    },
+                    name: 'poolid',
+                    allowBlank: false,
+                },
+                {
+                    xtype: 'pvePoolSelector',
+                    name: 'parentPool',
+                    fieldLabel: gettext('Parent Pool'),
+                    allowBlank: true,
+                    emptyText: Proxmox.Utils.NoneText,
+                    cbind: {
+                        disabled: '{!isCreate}',
+                        hidden: '{!isCreate}',
+                    },
+                },
+                {
+                    xtype: 'textfield',
+                    fieldLabel: gettext('Comment'),
+                    name: 'comment',
+                    allowBlank: true,
+                },
+            ],
         },
     ],
 
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* Re: [pve-devel] [PATCH manager v2] ui: pool create: allow selecting parent pool via selector
  2026-01-23  7:42 [pve-devel] [PATCH manager v2] ui: pool create: allow selecting parent pool via selector Dominik Csapak
@ 2026-08-31  9:26 ` Dominik Csapak
  2026-08-31 13:43 ` Jakob Klocker
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-08-31  9:26 UTC (permalink / raw)
  To: pve-devel

ping




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

* Re: [pve-devel] [PATCH manager v2] ui: pool create: allow selecting parent pool via selector
  2026-01-23  7:42 [pve-devel] [PATCH manager v2] ui: pool create: allow selecting parent pool via selector Dominik Csapak
  2026-08-31  9:26 ` Dominik Csapak
@ 2026-08-31 13:43 ` Jakob Klocker
  2026-08-31 14:03 ` Aaron Lauterer
  2026-09-01  7:18 ` superseded: " Dominik Csapak
  3 siblings, 0 replies; 5+ messages in thread
From: Jakob Klocker @ 2026-08-31 13:43 UTC (permalink / raw)
  To: Proxmox VE development discussion

Thanks for the patch.

Tested on top of current master. Went through:

- creating a top-level pool (no parent selected) -- submits the plain name
- creating child and grandchild pools via the selector (`a/b`, `a/b/c`)
- the name field rejects slashes, preventing pool creation
- selector is hidden in edit mode
- adding a child under parents with max depth shows an error
- checking that `parentPool` isn't submited

Not touched, but made sure it still works:

- Permissions -- gave a user rights to `a/b`, confirmed it can't edit `a`
- can't remove a parent while it still has children

Everything works as expected.

One thing that _could_ be added: hiding parents already at max
depth (3), since children can't be created under them. Though one 
could argue the current behavior -- keeping them and showing the
correct error -- is better, so users aren't confused about why those
pools are missing.

Code looks good to me as well, consider this:

Reviewed-by: Jakob Klocker <j.klocker@proxmox.com>
Tested-by: Jakob Klocker <j.klocker@proxmox.com>

On Fri Jan 23, 2026 at 8:42 AM CET, Dominik Csapak wrote:
> instead of having to type out the full path, e.g. 'foo/bar/baz',
> show a 'pool selector' to select the parent pool.
>
> Forbid using slashes in the name field so it's not possible to specify
> the structure with both the name and parent pool field.
>
> This makes creating nested pools more obvious and easier.
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> changes from v1:
> * always delete 'parentPool' from values so we don't accidentally submit it
> * only consider parentPool if it's a non-empty string
> * add regex to the namefield to disallow slashes
> * add emptyText to the poolselector
>
>  www/manager6/dc/PoolEdit.js | 52 +++++++++++++++++++++++++++----------
>  1 file changed, 39 insertions(+), 13 deletions(-)
>  [SNIP]




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

* Re: [pve-devel] [PATCH manager v2] ui: pool create: allow selecting parent pool via selector
  2026-01-23  7:42 [pve-devel] [PATCH manager v2] ui: pool create: allow selecting parent pool via selector Dominik Csapak
  2026-08-31  9:26 ` Dominik Csapak
  2026-08-31 13:43 ` Jakob Klocker
@ 2026-08-31 14:03 ` Aaron Lauterer
  2026-09-01  7:18 ` superseded: " Dominik Csapak
  3 siblings, 0 replies; 5+ messages in thread
From: Aaron Lauterer @ 2026-08-31 14:03 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

Gave this a quick test.
Works as expected.

I guess that handling the 3rd level pools differently but still showing 
them in the selector with a marking and not selectable will make the 
whole thing a lot more complex. As in, a custom component potentially, 
if the pvePoolSelector cannot do it.

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

On  2026-01-23  08:44, Dominik Csapak wrote:
> instead of having to type out the full path, e.g. 'foo/bar/baz',
> show a 'pool selector' to select the parent pool.
> 
> Forbid using slashes in the name field so it's not possible to specify
> the structure with both the name and parent pool field.
> 
> This makes creating nested pools more obvious and easier.
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> changes from v1:
> * always delete 'parentPool' from values so we don't accidentally submit it
> * only consider parentPool if it's a non-empty string
> * add regex to the namefield to disallow slashes
> * add emptyText to the poolselector
> 
>   www/manager6/dc/PoolEdit.js | 52 +++++++++++++++++++++++++++----------
>   1 file changed, 39 insertions(+), 13 deletions(-)
> 
> diff --git a/www/manager6/dc/PoolEdit.js b/www/manager6/dc/PoolEdit.js
> index 72a084ac..ee39137a 100644
> --- a/www/manager6/dc/PoolEdit.js
> +++ b/www/manager6/dc/PoolEdit.js
> @@ -17,20 +17,46 @@ Ext.define('PVE.dc.PoolEdit', {
>   
>       items: [
>           {
> -            xtype: 'pmxDisplayEditField',
> -            fieldLabel: gettext('Name'),
> -            cbind: {
> -                editable: '{isCreate}',
> -                value: '{poolid}',
> +            xtype: 'inputpanel',
> +            onGetValues: function (values) {
> +                if (Ext.isString(values.parentPool) && values.parentPool.length > 0) {
> +                    values.poolid = values.parentPool + '/' + values.poolid;
> +                }
> +                delete values.parentPool;
> +                return values;
>               },
> -            name: 'poolid',
> -            allowBlank: false,
> -        },
> -        {
> -            xtype: 'textfield',
> -            fieldLabel: gettext('Comment'),
> -            name: 'comment',
> -            allowBlank: true,
> +            items: [
> +                {
> +                    xtype: 'pmxDisplayEditField',
> +                    fieldLabel: gettext('Name'),
> +                    cbind: {
> +                        editable: '{isCreate}',
> +                        value: '{poolid}',
> +                    },
> +                    editConfig: {
> +                        regex: /^[^/]+$/,
> +                    },
> +                    name: 'poolid',
> +                    allowBlank: false,
> +                },
> +                {
> +                    xtype: 'pvePoolSelector',
> +                    name: 'parentPool',
> +                    fieldLabel: gettext('Parent Pool'),
> +                    allowBlank: true,
> +                    emptyText: Proxmox.Utils.NoneText,
> +                    cbind: {
> +                        disabled: '{!isCreate}',
> +                        hidden: '{!isCreate}',
> +                    },
> +                },
> +                {
> +                    xtype: 'textfield',
> +                    fieldLabel: gettext('Comment'),
> +                    name: 'comment',
> +                    allowBlank: true,
> +                },
> +            ],
>           },
>       ],
>   





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

* superseded: [pve-devel] [PATCH manager v2] ui: pool create: allow selecting parent pool via selector
  2026-01-23  7:42 [pve-devel] [PATCH manager v2] ui: pool create: allow selecting parent pool via selector Dominik Csapak
                   ` (2 preceding siblings ...)
  2026-08-31 14:03 ` Aaron Lauterer
@ 2026-09-01  7:18 ` Dominik Csapak
  3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2026-09-01  7:18 UTC (permalink / raw)
  To: pve-devel

superseded by v3:
https://lore.proxmox.com/pve-devel/20260901071815.599766-1-d.csapak@proxmox.com/T/#u




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

end of thread, other threads:[~2026-09-01  7:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-23  7:42 [pve-devel] [PATCH manager v2] ui: pool create: allow selecting parent pool via selector Dominik Csapak
2026-08-31  9:26 ` Dominik Csapak
2026-08-31 13:43 ` Jakob Klocker
2026-08-31 14:03 ` Aaron Lauterer
2026-09-01  7:18 ` superseded: " Dominik Csapak

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