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

Hannes Laimer h.laimer at proxmox.com
Wed Nov 13 16:00:51 CET 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 b8e866df..7b6aff1e 100644
--- a/www/window/DataStoreEdit.js
+++ b/www/window/DataStoreEdit.js
@@ -63,6 +63,20 @@ Ext.define('PBS.DataStoreEdit', {
 			emptyText: gettext('An absolute path'),
 			validator: val => val?.trim() !== '/',
 		    },
+		    {
+			xtype: 'pmxDisplayEditField',
+			fieldLabel: gettext('Device'),
+			name: 'backing-device',
+			disabled: true,
+			cbind: {
+			    editable: '{isCreate}',
+			},
+			editConfig: {
+			    xtype: 'pbsPartitionSelector',
+			    allowBlank: true,
+			},
+			emptyText: gettext('Device path'),
+		    },
 		],
 		column2: [
 		    {
@@ -88,6 +102,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.5





More information about the pbs-devel mailing list