Refresh container if X-Icinga-Extra-Updates with length 1 is defined (#3970)

* Refresh container if X-Icinga-Extra-Updates with length 1 is defined
This commit is contained in:
ValeDaRold 2019-12-12 13:50:03 +01:00 committed by Johannes Meyer
parent d6677bfb66
commit 5edd267f2a
1 changed files with 20 additions and 8 deletions

View File

@ -840,18 +840,30 @@
if (!! extraUpdates && req.getResponseHeader('X-Icinga-Redirect-Http') !== 'yes') {
$.each(extraUpdates.split(','), function (idx, el) {
var parts = el.trim().split(';');
if (parts.length !== 2) {
var $target;
var url;
if (parts.length === 2) {
$target = $('#' + parts[0]);
if (! $target.length) {
_this.icinga.logger.warn('Invalid target ID. Cannot load extra URL', el);
return;
}
url = parts[1];
} else if (parts.length === 1) {
$target = $(parts[0]).closest(".container").not(req.$target);
if (! $target.length) {
_this.icinga.logger.warn('Invalid target ID. Cannot load extra URL', el);
return;
}
url = $target.data('icingaUrl');
} else {
_this.icinga.logger.error('Invalid extra update', el);
return;
}
var $target = $('#' + parts[0]);
if (! $target.length) {
_this.icinga.logger.warn('Invalid target ID. Cannot load extra URL', el);
return;
}
_this.loadUrl(parts[1], $target).addToHistory = false;
_this.loadUrl(url, $target).addToHistory = false;
});
}