loader.js: Refresh left twice in case right has been closed..

..if the redirect target is `__BACK__`
This commit is contained in:
Johannes Meyer 2019-11-04 17:25:05 +01:00
parent 42e596f457
commit da565f4d16
1 changed files with 18 additions and 0 deletions

View File

@ -458,8 +458,26 @@
redirect = redirect.replace(/__SELF__/, req.url);
}
} else if (redirect.match(/__BACK__/)) {
// We may just close the right column, refresh the left one in this case
$(window).on('popstate.__back__', { self: this }, function (event) {
var _this = event.data.self;
if (icinga.ui.isOneColLayout()) {
var $col1 = $('#col1');
_this.loadUrl($col1.data('icingaUrl'), $col1).autorefresh = true;
// TODO: Find a better solution than a hardcoded one
setTimeout(function () {
_this.loadUrl($col1.data('icingaUrl'), $col1).autorefresh = true;
}, 1000);
}
$(window).off('popstate.__back__');
});
// Navigate back, no redirect desired
window.history.back();
return true;
}