[pve-devel] [PATCH v2 proxmox-widget-toolkit 11/13] Utils: add errorCallback to monStoreErrors
Stefan Reiter
s.reiter at proxmox.com
Thu Apr 22 17:34:55 CEST 2021
Call a function to decide if we want to mask the component. If the
callback returns true, we assume it has already handled the error (i.e.
shown a messagebox or similar) and skip masking.
Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---
new in v2
src/Utils.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/Utils.js b/src/Utils.js
index 3fd8f91..ee30027 100644
--- a/src/Utils.js
+++ b/src/Utils.js
@@ -317,7 +317,7 @@ utilities: {
return msg.join('<br>');
},
- monStoreErrors: function(component, store, clearMaskBeforeLoad) {
+ monStoreErrors: function(component, store, clearMaskBeforeLoad, errorCallback) {
if (clearMaskBeforeLoad) {
component.mon(store, 'beforeload', function(s, operation, eOpts) {
Proxmox.Utils.setErrorMask(component, false);
@@ -342,7 +342,9 @@ utilities: {
let error = request._operation.getError();
let msg = Proxmox.Utils.getResponseErrorMessage(error);
- Proxmox.Utils.setErrorMask(component, msg);
+ if (!errorCallback || !errorCallback(error, msg)) {
+ Proxmox.Utils.setErrorMask(component, msg);
+ }
});
},
--
2.20.1
More information about the pve-devel
mailing list