all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
To: Hannes Laimer <h.laimer@proxmox.com>
Cc: pbs-devel@lists.proxmox.com
Subject: Re: [PATCH proxmox-backup v6 7/8] ui: add move namespace action
Date: Thu, 2 Apr 2026 11:28:15 +0200	[thread overview]
Message-ID: <6nvauu4yxs4anuy67o2vyenzmgjiiedmvk4jq7ss6cnr6n2rgz@jgr4nsvtgq5r> (raw)
In-Reply-To: <20260331123409.198353-8-h.laimer@proxmox.com>

On Tue, Mar 31, 2026 at 02:34:08PM +0200, Hannes Laimer wrote:
> Add a "Move" action to the namespace action column. Opens a dialog
> where the user selects a new parent namespace and name, then submits
> a PUT to the move_namespace API endpoint.
> 
> The source namespace and its descendants are excluded from the parent
> selector to prevent cycles.
> 
Hey, one comment inline :)
> Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
> ---
>  www/Makefile                  |  1 +
>  www/datastore/Content.js      | 27 +++++++++++-
>  www/form/NamespaceSelector.js | 11 +++++
>  www/window/NamespaceMove.js   | 79 +++++++++++++++++++++++++++++++++++
>  4 files changed, 117 insertions(+), 1 deletion(-)
>  create mode 100644 www/window/NamespaceMove.js
> 
> diff --git a/www/Makefile b/www/Makefile
> index 7745d9f4..f2011af3 100644
> --- a/www/Makefile
> +++ b/www/Makefile
> @@ -80,6 +80,7 @@ JSSRC=							\
>  	window/CreateDirectory.js			\
>  	window/DataStoreEdit.js				\
>  	window/NamespaceEdit.js				\
> +	window/NamespaceMove.js				\
>  	window/MaintenanceOptions.js			\
>  	window/NotesEdit.js				\
>  	window/RemoteEdit.js				\
> diff --git a/www/datastore/Content.js b/www/datastore/Content.js
> index 585a1a2d..b53f9b67 100644
> --- a/www/datastore/Content.js
> +++ b/www/datastore/Content.js
> @@ -668,6 +668,26 @@ Ext.define('PBS.DataStoreContent', {
>              });
>          },
>  
> +        moveNS: function () {
> +            let me = this;
> +            let view = me.getView();
> +            if (!view.namespace || view.namespace === '') {
> +                return;
> +            }
> +            let win = Ext.create('PBS.window.NamespaceMove', {
> +                datastore: view.datastore,
> +                namespace: view.namespace,
> +                taskDone: (success) => {
> +                    if (success) {
> +                        let newNs = win.getNewNamespace();
> +                        view.down('pbsNamespaceSelector').store?.load();
> +                        me.nsChange(null, newNs);
> +                    }
> +                },
> +            });
> +            win.show();
> +        },
> +
>          moveGroup: function (data) {
>              let me = this;
>              let view = me.getView();
> @@ -686,6 +706,8 @@ Ext.define('PBS.DataStoreContent', {
>              let me = this;
>              if (data.ty === 'group') {
>                  me.moveGroup(data);
> +            } else if (data.ty === 'ns') {
> +                me.moveNS();
>              }
>          },
>  
> @@ -1114,10 +1136,13 @@ Ext.define('PBS.DataStoreContent', {
>                          if (data.ty === 'group') {
>                              return Ext.String.format(gettext("Move group '{0}'"), v);
>                          }
> -                        return '';
> +                        return Ext.String.format(gettext("Move namespace '{0}'"), v);
>                      },
>                      getClass: (v, m, { data }) => {
>                          if (data.ty === 'group') { return 'fa fa-arrows'; }
> +                        if (data.ty === 'ns' && !data.isRootNS && data.ns === undefined) {
> +                            return 'fa fa-arrows';
> +                        }
The move action is only accessible when already inside the namespace
being moved. If I want to move `root/x`, I have to navigate to `x` first.
IMO it would be more intuitive/convenient to have the move button on the
`x` row in the root view as well. 
>                          return 'pmx-hidden';
>                      },
>                      isActionDisabled: (v, r, c, i, { data }) => false,
> diff --git a/www/form/NamespaceSelector.js b/www/form/NamespaceSelector.js
> index ddf68254..d349b568 100644
> --- a/www/form/NamespaceSelector.js
> +++ b/www/form/NamespaceSelector.js
> @@ -90,6 +90,17 @@ Ext.define('PBS.form.NamespaceSelector', {
>              },
>          });
>  
> +        if (me.excludeNs) {
> +            me.store.addFilter(
> +                new Ext.util.Filter({
> +                    filterFn: (rec) => {
> +                        let ns = rec.data.ns;
> +                        return ns !== me.excludeNs && !ns.startsWith(`${me.excludeNs}/`);
> +                    },
> +                }),
> +            );
> +        }
> +
>          me.callParent();
>      },
>  });
> diff --git a/www/window/NamespaceMove.js b/www/window/NamespaceMove.js
> new file mode 100644
> index 00000000..415d509d
> --- /dev/null
> +++ b/www/window/NamespaceMove.js
> @@ -0,0 +1,79 @@
> +Ext.define('PBS.window.NamespaceMove', {
> +    extend: 'Proxmox.window.Edit',
> +    alias: 'widget.pbsNamespaceMove',
> +    mixins: ['Proxmox.Mixin.CBind'],
> +
> +    onlineHelp: 'storage-namespaces',
> +
> +    submitText: gettext('Move'),
> +    isCreate: true,
> +    showTaskViewer: true,
> +
> +    cbind: {
> +        url: '/api2/extjs/admin/datastore/{datastore}/namespace',
> +        title: (get) => Ext.String.format(gettext("Move Namespace '{0}'"), get('namespace')),
> +    },
> +    method: 'PUT',
> +
> +    width: 450,
> +    fieldDefaults: {
> +        labelWidth: 120,
> +    },
> +
> +    cbindData: function (initialConfig) {
> +        let ns = initialConfig.namespace ?? '';
> +        let parts = ns.split('/');
> +        return { nsName: parts[parts.length - 1] };
> +    },
> +
> +    // Returns the new-ns path that was submitted, for use by the caller after success.
> +    getNewNamespace: function () {
> +        let me = this;
> +        let parent = me.down('[name=parent]').getValue() || '';
> +        let name = me.down('[name=name]').getValue();
> +        return parent ? `${parent}/${name}` : name;
> +    },
> +
> +    items: {
> +        xtype: 'inputpanel',
> +        onGetValues: function (values) {
> +            let parent = values.parent || '';
> +            let newNs = parent ? `${parent}/${values.name}` : values.name;
> +            return {
> +                ns: this.up('window').namespace,
> +                'new-ns': newNs,
> +            };
> +        },
> +        items: [
> +            {
> +                xtype: 'displayfield',
> +                fieldLabel: gettext('Namespace'),
> +                cbind: {
> +                    value: '{namespace}',
> +                },
> +            },
> +            {
> +                xtype: 'pbsNamespaceSelector',
> +                name: 'parent',
> +                fieldLabel: gettext('New Parent'),
> +                allowBlank: true,
> +                cbind: {
> +                    datastore: '{datastore}',
> +                    excludeNs: '{namespace}',
> +                },
> +            },
> +            {
> +                xtype: 'proxmoxtextfield',
> +                name: 'name',
> +                fieldLabel: gettext('New Name'),
> +                allowBlank: false,
> +                maxLength: 31,
> +                regex: PBS.Utils.SAFE_ID_RE,
> +                regexText: gettext("Only alpha numerical, '_' and '-' (if not at start) allowed"),
> +                cbind: {
> +                    value: '{nsName}',
> +                },
> +            },
> +        ],
> +    },
> +});
> -- 
> 2.47.3
> 
> 
> 
> 
> 




  reply	other threads:[~2026-04-02  9:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31 12:34 [PATCH proxmox-backup v6 0/8] fixes #6195: add support for moving groups and namespaces Hannes Laimer
2026-03-31 12:34 ` [PATCH proxmox-backup v6 1/8] ui: show empty groups Hannes Laimer
2026-03-31 12:34 ` [PATCH proxmox-backup v6 2/8] datastore: add move_group Hannes Laimer
2026-03-31 12:34 ` [PATCH proxmox-backup v6 3/8] datastore: add move_namespace Hannes Laimer
2026-03-31 12:34 ` [PATCH proxmox-backup v6 4/8] api: add PUT endpoint for move_group Hannes Laimer
2026-03-31 12:34 ` [PATCH proxmox-backup v6 5/8] api: add PUT endpoint for move_namespace Hannes Laimer
2026-03-31 12:34 ` [PATCH proxmox-backup v6 6/8] ui: add move group action Hannes Laimer
2026-03-31 12:34 ` [PATCH proxmox-backup v6 7/8] ui: add move namespace action Hannes Laimer
2026-04-02  9:28   ` Arthur Bied-Charreton [this message]
2026-03-31 12:34 ` [PATCH proxmox-backup v6 8/8] cli: add move-namespace and move-group commands Hannes Laimer
2026-04-02  9:22   ` Arthur Bied-Charreton
2026-04-02  9:34 ` [PATCH proxmox-backup v6 0/8] fixes #6195: add support for moving groups and namespaces Arthur Bied-Charreton

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=6nvauu4yxs4anuy67o2vyenzmgjiiedmvk4jq7ss6cnr6n2rgz@jgr4nsvtgq5r \
    --to=a.bied-charreton@proxmox.com \
    --cc=h.laimer@proxmox.com \
    --cc=pbs-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal