js: Update a form's action if it's a auto submit response with `X-Icinga-Location-Query`
This commit is contained in:
parent
43dd89f946
commit
027e468943
|
@ -786,8 +786,23 @@
|
||||||
if (!! contentSeparator) {
|
if (!! contentSeparator) {
|
||||||
var locationQuery = req.getResponseHeader('X-Icinga-Location-Query');
|
var locationQuery = req.getResponseHeader('X-Icinga-Location-Query');
|
||||||
if (locationQuery !== null) {
|
if (locationQuery !== null) {
|
||||||
var a = this.icinga.utils.getUrlHelper();
|
var a = this.icinga.utils.getUrlHelper().cloneNode(true);
|
||||||
a.search = locationQuery ? '?' + locationQuery : '';
|
a.search = locationQuery ? '?' + locationQuery : '';
|
||||||
|
|
||||||
|
if (autoSubmit) {
|
||||||
|
// Also update a form's action if it doesn't differ from the container's url
|
||||||
|
var $form = $(referrer.forceFocus).closest('form');
|
||||||
|
var formAction = $form.attr('action');
|
||||||
|
if (!! formAction) {
|
||||||
|
formAction = this.icinga.utils.parseUrl(formAction);
|
||||||
|
if (formAction.path === currentUrl.path
|
||||||
|
&& this.icinga.utils.arraysEqual(formAction.params, currentUrl.params)
|
||||||
|
) {
|
||||||
|
$form.attr('action', a.href);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
req.$target.data('icingaUrl', a.href);
|
req.$target.data('icingaUrl', a.href);
|
||||||
this.icinga.history.replaceCurrentState();
|
this.icinga.history.replaceCurrentState();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue