diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js index 363ef5045..34f83bace 100644 --- a/public/js/icinga/events.js +++ b/public/js/icinga/events.js @@ -531,8 +531,25 @@ $target = _this.getLinkTargetFor($a); } + var additionalHeader; + + if ($a.data('icinga-modal') === true) { + additionalHeader = { + 'X-Icinga-Modal': true + }; + } + // Load link URL - icinga.loader.loadUrl(href, $target); + icinga.loader.loadUrl( + href, + $target, + undefined, + undefined, + undefined, + undefined, + undefined, + additionalHeader + ); if ($a.closest('#menu').length > 0) { // Menu links should remove all but the first layout column diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js index 8cfcfe1f1..4912fd47d 100644 --- a/public/js/icinga/loader.js +++ b/public/js/icinga/loader.js @@ -50,15 +50,16 @@ /** * Load the given URL to the given target * - * @param {string} url URL to be loaded - * @param {object} target Target jQuery element - * @param {object} data Optional parameters, usually for POST requests - * @param {string} method HTTP method, default is 'GET' - * @param {string} action How to handle the response ('replace' or 'append'), default is 'replace' - * @param {boolean} autorefresh Whether the cause is a autorefresh or not - * @param {object} progressTimer A timer to be stopped when the request is done + * @param {string} url URL to be loaded + * @param {object} target Target jQuery element + * @param {object} data Optional parameters, usually for POST requests + * @param {string} method HTTP method, default is 'GET' + * @param {string} action How to handle the response ('replace' or 'append'), default is 'replace' + * @param {boolean} autorefresh Whether the cause is a autorefresh or not + * @param {object} progressTimer A timer to be stopped when the request is done + * @param {object} additionalHeader Custom request headers */ - loadUrl: function (url, $target, data, method, action, autorefresh, progressTimer) { + loadUrl: function (url, $target, data, method, action, autorefresh, progressTimer, additionalHeader) { var id = null; // Default method is GET @@ -105,6 +106,10 @@ // Not sure whether we need this Accept-header var headers = { 'X-Icinga-Accept': 'text/html' }; + if (typeof additionalHeader === 'object') { + headers = $.extend(headers, additionalHeader); + } + // Ask for a new window id in case we don't already have one if (this.icinga.ui.hasWindowId()) { var windowId = this.icinga.ui.getWindowId(); @@ -146,7 +151,7 @@ req.autorefresh = autorefresh; req.method = method; req.action = action; - req.addToHistory = true; + req.addToHistory = headers['X-Icinga-Modal'] !== true && true; req.progressTimer = progressTimer; if (url.match(/#/)) {