mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-31 01:34:09 +02:00
loader.js: Keep using the promise interface for complete callbacks
This commit is contained in:
parent
5cf71c9bbd
commit
6323a065ea
@ -135,14 +135,14 @@
|
|||||||
headers: headers,
|
headers: headers,
|
||||||
context: _this,
|
context: _this,
|
||||||
contentType: contentType,
|
contentType: contentType,
|
||||||
processData: ! isFormData,
|
processData: ! isFormData
|
||||||
complete: this.onComplete
|
|
||||||
});
|
});
|
||||||
|
|
||||||
req.$target = $target;
|
req.$target = $target;
|
||||||
req.url = url;
|
req.url = url;
|
||||||
req.done(this.onResponse);
|
req.done(this.onResponse);
|
||||||
req.fail(this.onFailure);
|
req.fail(this.onFailure);
|
||||||
|
req.always(this.onComplete);
|
||||||
req.autorefresh = autorefresh;
|
req.autorefresh = autorefresh;
|
||||||
req.method = method;
|
req.method = method;
|
||||||
req.action = action;
|
req.action = action;
|
||||||
@ -590,7 +590,15 @@
|
|||||||
/**
|
/**
|
||||||
* Regardless of whether a request succeeded of failed, clean up
|
* Regardless of whether a request succeeded of failed, clean up
|
||||||
*/
|
*/
|
||||||
onComplete: function (req, textStatus) {
|
onComplete: function (dataOrReq, textStatus, reqOrError) {
|
||||||
|
var req;
|
||||||
|
|
||||||
|
if (typeof dataOrReq === 'object') {
|
||||||
|
req = dataOrReq;
|
||||||
|
} else {
|
||||||
|
req = reqOrError;
|
||||||
|
}
|
||||||
|
|
||||||
// Remove 'impact' class if there was such
|
// Remove 'impact' class if there was such
|
||||||
if (req.$target.hasClass('impact')) {
|
if (req.$target.hasClass('impact')) {
|
||||||
req.$target.removeClass('impact');
|
req.$target.removeClass('impact');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user