js: Restore previous title when closing right column
fixes #3654
(cherry picked from commit 4900040d47
)
Signed-off-by: Johannes Meyer <johannes.meyer@icinga.com>
This commit is contained in:
parent
97e077de5b
commit
aea1cabefb
|
@ -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);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue