[pbs-devel] [PATCH proxmox-backup v2 2/2] fix #6195: ui: add button/window for moving a namespace
Hannes Laimer
h.laimer at proxmox.com
Wed Sep 3 14:08:44 CEST 2025
Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
---
www/Makefile | 1 +
www/datastore/Content.js | 38 ++++++++++++++++++++++++++++++
www/window/NamespaceMove.js | 47 +++++++++++++++++++++++++++++++++++++
3 files changed, 86 insertions(+)
create mode 100644 www/window/NamespaceMove.js
diff --git a/www/Makefile b/www/Makefile
index 9ebf0445..d0b4592c 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -79,6 +79,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 075022e9..ad9733c1 100644
--- a/www/datastore/Content.js
+++ b/www/datastore/Content.js
@@ -447,6 +447,22 @@ Ext.define('PBS.DataStoreContent', {
win.on('destroy', this.reload, this);
},
+ onMove: function (table, rI, cI, item, e, rec) {
+ let me = this;
+ let view = me.getView();
+ if (!rec.data.ns || rec.data.ty !== 'ns' || !view.datastore) {
+ return;
+ }
+ Ext.create('PBS.NamespaceMove', {
+ autoShow: true,
+ datastore: view.datastore,
+ ns: rec.data.ns,
+ listeners: {
+ destroy: () => me.reload(),
+ },
+ });
+ },
+
onPrune: function (table, rI, cI, item, e, rec) {
let me = this;
let view = me.getView();
@@ -1058,6 +1074,18 @@ Ext.define('PBS.DataStoreContent', {
data.ty === 'group' ? 'fa fa-scissors' : 'pmx-hidden',
isActionDisabled: (v, r, c, i, { data }) => data.ty !== 'group',
},
+ {
+ handler: 'onMove',
+ getTip: (v, m, rec) => Ext.String.format(gettext("Move '{0}'"), v),
+ getClass: (v, m, { data }) => {
+ if (data.parentId !== 'root' && !!data.ns && data.ty === 'ns' && !data.isRootNS) {
+ return 'fa fa-arrow-right';
+ } else {
+ return 'pmx-hidden';
+ }
+ },
+ isActionDisabled: (v, r, c, i, { data }) => data.ty !== 'ns',
+ },
{
handler: 'onProtectionChange',
getTip: (v, m, rec) =>
@@ -1439,6 +1467,16 @@ Ext.define('PBS.datastore.GroupCmdMenu', {
hidden: '{!onPrune}',
},
},
+ {
+ text: gettext('Move'),
+ iconCls: 'fa fa-arrow-right',
+ handler: function () {
+ this.up('menu').onMove();
+ },
+ cbind: {
+ hidden: '{!onMove}',
+ },
+ },
{ xtype: 'menuseparator' },
{
text: gettext('Remove'),
diff --git a/www/window/NamespaceMove.js b/www/window/NamespaceMove.js
new file mode 100644
index 00000000..b294bf6f
--- /dev/null
+++ b/www/window/NamespaceMove.js
@@ -0,0 +1,47 @@
+Ext.define('PBS.NamespaceMove', {
+ extend: 'Proxmox.window.Edit',
+ alias: 'widget.pbsNamespaceMove',
+ mixins: ['Proxmox.Mixin.CBind'],
+
+ onlineHelp: 'changing-backup-owner',
+
+ submitText: gettext('Move Namespace'),
+ width: 350,
+
+ initComponent: function () {
+ let me = this;
+
+ if (!me.datastore) {
+ throw 'no datastore specified';
+ }
+ if (!me.ns) {
+ throw 'no namespace specified';
+ }
+
+ Ext.apply(me, {
+ url: `/api2/extjs/admin/datastore/${me.datastore}/namespace/move`,
+ method: 'POST',
+ subject: gettext('Move Namespace') + ` - ${me.ns}`,
+ items: {
+ xtype: 'inputpanel',
+ onGetValues: function (values) {
+ values.ns = me.ns;
+ return values;
+ },
+
+ items: [
+ {
+ xtype: 'pbsNamespaceSelector',
+ datastore: me.datastore,
+ name: 'target-ns',
+ value: me.ns,
+ fieldLabel: gettext('Target'),
+ allowBlank: true,
+ },
+ ],
+ },
+ });
+
+ me.callParent();
+ },
+});
--
2.47.2
More information about the pbs-devel
mailing list