From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [RFC PATCH widget-toolkit] comboGrid: set errorMask on store load failure
Date: Wed, 4 Nov 2020 15:17:40 +0100 [thread overview]
Message-ID: <20201104141740.365-1-d.csapak@proxmox.com> (raw)
if there occured an error in the api call of the store, show this error
on the picker when opened, instead of just showing an empty picker
this makes it possible to see that there was an error while accessing the api
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
altough i tested this, i'd like for someone else to test it too, since
we basically use this anywhere and i am not sure if i forgot some edge
case...
src/form/ComboGrid.js | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/form/ComboGrid.js b/src/form/ComboGrid.js
index e5a1920..20c9455 100644
--- a/src/form/ComboGrid.js
+++ b/src/form/ComboGrid.js
@@ -304,6 +304,11 @@ Ext.define('Proxmox.form.ComboGrid', {
me.savedMinHeight = picker.getMinHeight();
picker.setMinHeight(100);
}
+ if (me.loadError) {
+ Proxmox.Utils.setErrorMask(picker, me.loadError);
+ delete me.loadError;
+ picker.updateLayout();
+ }
});
picker.getNavigationModel().navigateOnSpace = false;
@@ -415,6 +420,7 @@ Ext.define('Proxmox.form.ComboGrid', {
me.mon(me.store, 'load', function(store, r, success, o) {
if (success) {
me.clearInvalid();
+ delete me.loadError;
if (me.enableLoadMask) {
delete me.enableLoadMask;
@@ -425,6 +431,7 @@ Ext.define('Proxmox.form.ComboGrid', {
// gets not recalculated
if (me.picker) {
me.picker.setMinHeight(me.savedMinHeight || 0);
+ Proxmox.Utils.setErrorMask(me.picker);
delete me.savedMinHeight;
me.picker.updateLayout();
}
@@ -451,6 +458,12 @@ Ext.define('Proxmox.form.ComboGrid', {
}
}
}
+ } else {
+ let msg = Proxmox.Utils.getResponseErrorMessage(o.getError());
+ if (me.picker) {
+ Proxmox.Utils.setErrorMask(me.picker, msg);
+ }
+ me.loadError = msg;
}
});
},
--
2.20.1
next reply other threads:[~2020-11-04 14:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-04 14:17 Dominik Csapak [this message]
2020-11-05 10:09 ` Fabian Grünbichler
2020-11-09 7:02 ` [pve-devel] applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201104141740.365-1-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal