js/loader: notifications should survive new layout

Once replacing the whole layout we used to override notifications.
This is now fixed, they are going to be detached and re-attached
before and after re-rendering the page content.
This commit is contained in:
Thomas Gelf 2014-06-22 19:55:50 +02:00
parent 7444ab7d26
commit 180a6f08f5
1 changed files with 7 additions and 1 deletions

View File

@ -334,6 +334,7 @@
var target = req.getResponseHeader('X-Icinga-Container');
var newBody = false;
var oldNotifications = false;
if (target) {
if (target === 'ignore') {
return;
@ -343,7 +344,9 @@
delete this.requests[req.$target.attr('id')];
req.$target = $('#' + target);
if (target === 'layout') {
oldNotifications = $('#notifications li').detach();
}
// We assume target === 'layout' right now. This might not be correct
this.icinga.ui.layout1col();
newBody = true;
@ -449,6 +452,9 @@
// .html() removes outer div we added above
this.renderContentToContainer($resp.html(), req.$target, req.action, req.autorefresh);
if (oldNotifications) {
oldNotifications.appendTo($('#notifications'));
}
if (url.match(/#/)) {
this.icinga.ui.scrollContainerToAnchor(req.$target, url.split(/#/)[1]);
}