From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id BE05D1FF185 for ; Mon, 21 Jul 2025 18:48:50 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 63226170E6; Mon, 21 Jul 2025 18:49:58 +0200 (CEST) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Mon, 21 Jul 2025 18:44:44 +0200 Message-ID: <20250721164507.1045869-27-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250721164507.1045869-1-c.ebner@proxmox.com> References: <20250721164507.1045869-1-c.ebner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1753116309742 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.045 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 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 v10 23/46] ui: add datastore type selector and reorganize component layout 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" In preparation for adding the S3 backed datastore variant to the edit window. Introduce a datastore type selector in order to distinguish between creation of regular and removable datastores, instead of using the checkbox as is currently the case. This allows to more easily expand for further datastore type variants while keeping the datastore edit window compact. Since selecting the type is one of the first steps during datastore creation, position the component right below the datastore name field and re-organize the components related to the removable datastore creation, while keeping additional required components for the S3 backed datastore creation in mind. Signed-off-by: Christian Ebner --- changes since version 9: - no changes www/window/DataStoreEdit.js | 78 +++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 33 deletions(-) diff --git a/www/window/DataStoreEdit.js b/www/window/DataStoreEdit.js index 372984e37..c91b93cd9 100644 --- a/www/window/DataStoreEdit.js +++ b/www/window/DataStoreEdit.js @@ -52,6 +52,41 @@ Ext.define('PBS.DataStoreEdit', { allowBlank: false, fieldLabel: gettext('Name'), }, + { + xtype: 'proxmoxKVComboBox', + name: 'datastore-type', + fieldLabel: gettext('Datastore Type'), + value: '__default__', + submitValue: false, + comboItems: [ + ['__default__', gettext('Local')], + ['removable', gettext('Removable')], + ], + cbind: { + disabled: '{!isCreate}', + }, + listeners: { + change: function (checkbox, selected) { + let isRemovable = selected === 'removable'; + + let inputPanel = checkbox.up('inputpanel'); + let pathField = inputPanel.down('[name=path]'); + let uuidEditField = inputPanel.down('[name=backing-device]'); + + uuidEditField.setDisabled(!isRemovable); + uuidEditField.allowBlank = !isRemovable; + uuidEditField.setValue(''); + + if (isRemovable) { + pathField.setFieldLabel(gettext('Path on Device')); + pathField.setEmptyText(gettext('A relative path')); + } else { + pathField.setFieldLabel(gettext('Backing Path')); + pathField.setEmptyText(gettext('An absolute path')); + } + }, + }, + }, { xtype: 'pmxDisplayEditField', cbind: { @@ -63,17 +98,6 @@ Ext.define('PBS.DataStoreEdit', { emptyText: gettext('An absolute path'), validator: (val) => val?.trim() !== '/', }, - { - xtype: 'pbsPartitionSelector', - fieldLabel: gettext('Device'), - name: 'backing-device', - disabled: true, - allowBlank: true, - cbind: { - editable: '{isCreate}', - }, - emptyText: gettext('Device path'), - }, ], column2: [ { @@ -97,31 +121,19 @@ Ext.define('PBS.DataStoreEdit', { value: '{scheduleValue}', }, }, - ], - columnB: [ { - xtype: 'checkbox', - boxLabel: gettext('Removable datastore'), - submitValue: false, - listeners: { - change: function (checkbox, isRemovable) { - let inputPanel = checkbox.up('inputpanel'); - let pathField = inputPanel.down('[name=path]'); - let uuidEditField = inputPanel.down('[name=backing-device]'); - - uuidEditField.setDisabled(!isRemovable); - uuidEditField.allowBlank = !isRemovable; - uuidEditField.setValue(''); - if (isRemovable) { - pathField.setFieldLabel(gettext('Path on Device')); - pathField.setEmptyText(gettext('A relative path')); - } else { - pathField.setFieldLabel(gettext('Backing Path')); - pathField.setEmptyText(gettext('An absolute path')); - } - }, + xtype: 'pbsPartitionSelector', + fieldLabel: gettext('Device'), + name: 'backing-device', + disabled: true, + allowBlank: true, + cbind: { + editable: '{isCreate}', }, + emptyText: gettext('Device path'), }, + ], + columnB: [ { xtype: 'textfield', name: 'comment', -- 2.47.2 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel