ui: tape/TapeRestore: fix small DataStoreMappingGrid bugs

enable scrolling by default, and handle the case that getErrors gets
called when the component is not yet rendered

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-05-21 12:20:18 +02:00 committed by Thomas Lamprecht
parent af39c399bc
commit 5e989333cd
1 changed files with 9 additions and 2 deletions

View File

@ -203,6 +203,8 @@ Ext.define('PBS.TapeManagement.DataStoreMappingGrid', {
alias: 'widget.pbsDataStoreMappingField', alias: 'widget.pbsDataStoreMappingField',
mixins: ['Ext.form.field.Field'], mixins: ['Ext.form.field.Field'],
scrollable: true,
getValue: function() { getValue: function() {
let me = this; let me = this;
let datastores = []; let datastores = [];
@ -246,15 +248,20 @@ Ext.define('PBS.TapeManagement.DataStoreMappingGrid', {
}); });
} }
let el = me.getActionEl();
if (error) { if (error) {
me.addCls(['x-form-trigger-wrap-default', 'x-form-trigger-wrap-invalid']); me.addCls(['x-form-trigger-wrap-default', 'x-form-trigger-wrap-invalid']);
let errorMsg = gettext("Need at least one mapping"); let errorMsg = gettext("Need at least one mapping");
me.getActionEl().dom.setAttribute('data-errorqtip', errorMsg); if (el) {
el.dom.setAttribute('data-errorqtip', errorMsg);
}
return [errorMsg]; return [errorMsg];
} }
me.removeCls(['x-form-trigger-wrap-default', 'x-form-trigger-wrap-invalid']); me.removeCls(['x-form-trigger-wrap-default', 'x-form-trigger-wrap-invalid']);
me.getActionEl().dom.setAttribute('data-errorqtip', ""); if (el) {
el.dom.setAttribute('data-errorqtip', "");
}
return []; return [];
}, },