[pve-devel] [PATCH widget-toolkit 2/2] ComboGrid: make height for the error configurable

Dominik Csapak d.csapak at proxmox.com
Wed Jan 18 14:12:57 CET 2023


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 at proxmox.com>
---
 src/form/ComboGrid.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/form/ComboGrid.js b/src/form/ComboGrid.js
index e903223..ba3ce40 100644
--- a/src/form/ComboGrid.js
+++ b/src/form/ComboGrid.js
@@ -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;
 	    }
-- 
2.30.2






More information about the pve-devel mailing list