From 180a6f08f59f3523889d8b3a8291338bf36a5ecb Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Sun, 22 Jun 2014 19:55:50 +0200 Subject: [PATCH] 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. --- public/js/icinga/loader.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js index 384a75348..c1ceddbfe 100644 --- a/public/js/icinga/loader.js +++ b/public/js/icinga/loader.js @@ -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]); }