Utils: add errorCallback to monStoreErrors

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@proxmox.com>
This commit is contained in:
Stefan Reiter 2021-04-22 17:34:55 +02:00 committed by Thomas Lamprecht
parent 1334cdcabc
commit 661faeedf5

View File

@ -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);
}
});
},