From 3ae4dab4b9817f5b6ef63634367307de9be1d77c Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Tue, 17 May 2022 11:47:04 +0200 Subject: [PATCH] ui: tape restore: fix form validation for datastore mapping '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 Signed-off-by: Thomas Lamprecht --- 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) {