[pbs-devel] [PATCH proxmox-backup] ui: tape/Restore: fix form validation for datastore mapping

Dominik Csapak d.csapak at proxmox.com
Tue May 17 11:47:04 CEST 2022


'defaultStore' can be '' or null, so check for truthyness
also, we want the mapping to be a formField so that the validation
triggers and the restore button gets en/disabled accordingly. We
still have to call 'getValue' manually, because the onGetValues will get
it as string instead of an array

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/tape/window/TapeRestore.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/www/tape/window/TapeRestore.js b/www/tape/window/TapeRestore.js
index 08010085..8a6f6c2f 100644
--- a/www/tape/window/TapeRestore.js
+++ b/www/tape/window/TapeRestore.js
@@ -383,6 +383,8 @@ Ext.define('PBS.TapeManagement.TapeRestoreWindow', {
 			let defaultNs = values.defaultNs;
 			delete values.defaultNs;
 
+			// we have to get it manually but want it to be a form field
+			delete values.mapping;
 			let [ds_map, ns_map] = me.down('pbsDataStoreMappingField').getValue();
 			if (ds_map !== '') {
 			    datastores.push(ds_map);
@@ -474,7 +476,7 @@ Ext.define('PBS.TapeManagement.TapeRestoreWindow', {
 			},
 			{
 			    xtype: 'pbsDataStoreMappingField',
-			    isFormField: false,
+			    name: 'mapping',
 			    reference: 'mappingGrid',
 			    height: 240,
 			    defaultBindProperty: 'value',
@@ -565,7 +567,7 @@ Ext.define('PBS.TapeManagement.DataStoreMappingGrid', {
 	let me = this;
 	let error = false;
 
-	if (me.getViewModel().get('defaultStore') !== '') {
+	if (!me.getViewModel().get('defaultStore')) {
 	    error = true;
 	    me.getStore().each(rec => {
 		if (rec.data.target) {
-- 
2.30.2






More information about the pbs-devel mailing list