From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 78BC61FF17C for ; Wed, 3 Sep 2025 14:08:36 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id DC9B0BB99; Wed, 3 Sep 2025 14:08:50 +0200 (CEST) From: Hannes Laimer To: pbs-devel@lists.proxmox.com Date: Wed, 3 Sep 2025 14:08:44 +0200 Message-ID: <20250903120844.211292-3-h.laimer@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250903120844.211292-1-h.laimer@proxmox.com> References: <20250903120844.211292-1-h.laimer@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1756901311828 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.025 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_MSPIKE_H2 0.001 Average reputation (+2) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup v2 2/2] fix #6195: ui: add button/window for moving a namespace X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Signed-off-by: Hannes Laimer --- 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 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel