[pbs-devel] [PATCH proxmox-backup v10 16/26] ui: add removable datastore creation support

Hannes Laimer h.laimer at proxmox.com
Thu Apr 25 08:53:05 CEST 2024


Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
---
 www/window/DataStoreEdit.js | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/www/window/DataStoreEdit.js b/www/window/DataStoreEdit.js
index b6115460..54929382 100644
--- a/www/window/DataStoreEdit.js
+++ b/www/window/DataStoreEdit.js
@@ -62,6 +62,20 @@ Ext.define('PBS.DataStoreEdit', {
 			fieldLabel: gettext('Backing Path'),
 			emptyText: gettext('An absolute path'),
 		    },
+		    {
+			xtype: 'pmxDisplayEditField',
+			fieldLabel: gettext('Device'),
+			name: 'backing-device',
+			disabled: true,
+			cbind: {
+			    editable: '{isCreate}',
+			},
+			editConfig: {
+			    xtype: 'pbsPartitionSelector',
+			    allowBlank: true,
+			},
+			emptyText: gettext('Device path'),
+		    },
 		],
 		column2: [
 		    {
@@ -87,6 +101,29 @@ Ext.define('PBS.DataStoreEdit', {
 		    },
 		],
 		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 uuidField = inputPanel.down('pbsPartitionSelector[name=backing-device]');
+				let uuidEditField = inputPanel.down('[name=backing-device]');
+
+				uuidField.allowBlank = !isRemovable;
+				uuidEditField.setDisabled(!isRemovable);
+				uuidField.setDisabled(!isRemovable);
+				uuidField.setValue('');
+				if (isRemovable) {
+				    pathField.setFieldLabel(gettext('On device path'));
+				} else {
+				    pathField.setFieldLabel(gettext('Backing Path'));
+				}
+			    },
+			},
+		    },
 		    {
 			xtype: 'textfield',
 			name: 'comment',
-- 
2.39.2





More information about the pbs-devel mailing list