loader.js: Introduce new header `X-Icinga-Location-Query`

This header is only used in case the response includes
multipart content. It's meant to provide a new query
string that replaces the one of the targeted container
and the resulting change also replaces the current
history entry.
This commit is contained in:
Johannes Meyer 2020-10-15 09:50:47 +02:00
parent 70c3023f3c
commit 0b94489c7e
1 changed files with 8 additions and 0 deletions

View File

@ -762,6 +762,14 @@
var contentSeparator = req.getResponseHeader('X-Icinga-Multipart-Content');
if (!! contentSeparator) {
var locationQuery = req.getResponseHeader('X-Icinga-Location-Query');
if (locationQuery !== null) {
var a = this.icinga.utils.getUrlHelper();
a.search = locationQuery ? '?' + locationQuery : '';
req.$target.data('icingaUrl', a.href);
this.icinga.history.replaceCurrentState();
}
$.each(req.responseText.split(contentSeparator), function (idx, el) {
var match = el.match(/for=(\S+)\s+(.*)/ms);
if (!! match) {