diff --git a/public/js/icinga/history.js b/public/js/icinga/history.js index d0f6f6612..7d2173f57 100644 --- a/public/js/icinga/history.js +++ b/public/js/icinga/history.js @@ -63,10 +63,13 @@ } var url = ''; + var title = ''; // We only store URLs of containers sitting directly under #main: $('#main > .container').each(function (idx, container) { - var cUrl = $(container).data('icingaUrl'); + var $container = $(container), + cUrl = $container.data('icingaUrl'), + cTitle = $container.data('icingaTitle'); // TODO: I'd prefer to have the rightmost URL first if ('undefined' !== typeof cUrl) { @@ -77,6 +80,10 @@ url = url + '#!' + cUrl; } } + + if (typeof cTitle !== 'undefined') { + title = cTitle; // Only uses the rightmost title + } }); // Did we find any URL? Then push it! @@ -84,6 +91,9 @@ this.icinga.logger.debug('Pushing current state to history'); this.push(url); } + if (title !== '') { + this.icinga.ui.setTitle(title); + } }, /** diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js index b2d23322b..08fe6939c 100644 --- a/public/js/icinga/loader.js +++ b/public/js/icinga/loader.js @@ -544,7 +544,7 @@ var title = req.getResponseHeader('X-Icinga-Title'); if (title && ! req.autorefresh && req.$target.closest('.dashboard').length === 0) { - this.icinga.ui.setTitle(decodeURIComponent(title)); + req.$target.data('icingaTitle', decodeURIComponent(title)); } // Set a window identifier if the server asks us to do so diff --git a/public/js/icinga/ui.js b/public/js/icinga/ui.js index 58228a0ba..5d26a6c3f 100644 --- a/public/js/icinga/ui.js +++ b/public/js/icinga/ui.js @@ -194,6 +194,7 @@ 'elements': $('#' + $col.attr('id') + ' > *').detach(), 'data': { 'data-icinga-url': $col.data('icingaUrl'), + 'data-icinga-title': $col.data('icingaTitle'), 'data-icinga-refresh': $col.data('icingaRefresh'), 'data-last-update': $col.data('lastUpdate'), 'data-icinga-module': $col.data('icingaModule'), @@ -203,6 +204,7 @@ }; this.icinga.loader.stopPendingRequestsFor($col); $col.removeData('icingaUrl'); + $col.removeData('icingaTitle'); $col.removeData('icingaRefresh'); $col.removeData('lastUpdate'); $col.removeData('icingaModule'); @@ -215,6 +217,7 @@ backup['elements'].appendTo($col); $col.attr('class', backup['class']); // TODO: ie memleak? remove first? $col.data('icingaUrl', backup['data']['data-icinga-url']); + $col.data('icingaTitle', backup['data']['data-icinga-title']); $col.data('icingaRefresh', backup['data']['data-icinga-refresh']); $col.data('lastUpdate', backup['data']['data-last-update']); $col.data('icingaModule', backup['data']['data-icinga-module']); @@ -297,6 +300,7 @@ closeContainer: function($c) { $c.removeData('icingaUrl'); + $c.removeData('icingaTitle'); $c.removeData('icingaRefresh'); $c.removeData('lastUpdate'); $c.removeData('icingaModule');