ComboGrid: make height for the error configurable

by introducing a errorHeight config property. This is necessary when
the ComboGrid has e.g. a toolbar and we show the error in the grid body
only, 100 pixels is not enough then. To solve that without hardcoding
different heights, let the subclass/caller configure that

also set this when the store load fails completely (was not done until now)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2023-01-18 14:12:57 +01:00 committed by Thomas Lamprecht
parent aa157deb47
commit c071b0c302

View File

@ -31,6 +31,7 @@ Ext.define('Proxmox.form.ComboGrid', {
skipEmptyText: false,
notFoundIsValid: false,
deleteEmpty: false,
errorHeight: 100,
},
// needed to trigger onKeyUp etc.
@ -302,8 +303,8 @@ Ext.define('Proxmox.form.ComboGrid', {
picker.on('show', function() {
me.store.fireEvent('refresh');
if (me.enableLoadMask) {
me.savedMinHeight = picker.getMinHeight();
picker.setMinHeight(100);
me.savedMinHeight = me.savedMinHeight ?? picker.getMinHeight();
picker.setMinHeight(me.errorHeight);
}
if (me.loadError) {
Proxmox.Utils.setErrorMask(picker.getView(), me.loadError);
@ -463,7 +464,10 @@ Ext.define('Proxmox.form.ComboGrid', {
} else {
let msg = Proxmox.Utils.getResponseErrorMessage(o.getError());
if (me.picker) {
me.savedMinHeight = me.savedMinHeight ?? me.picker.getMinHeight();
me.picker.setMinHeight(me.errorHeight);
Proxmox.Utils.setErrorMask(me.picker.getView(), msg);
me.picker.updateLayout();
}
me.loadError = msg;
}