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 <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Dominik Csapak 2022-05-17 11:47:04 +02:00 committed by Thomas Lamprecht
parent d74172bfc1
commit 3ae4dab4b9
1 changed files with 4 additions and 2 deletions

View File

@ -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) {