From da565f4d16879bc3c362f07254dc7253db2adf39 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 4 Nov 2019 17:25:05 +0100 Subject: [PATCH] loader.js: Refresh left twice in case right has been closed.. ..if the redirect target is `__BACK__` --- public/js/icinga/loader.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js index 7c9962051..a3130f3c2 100644 --- a/public/js/icinga/loader.js +++ b/public/js/icinga/loader.js @@ -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; }