diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js index 5473212517..a34b4a3450 100644 --- a/public/js/icinga/loader.js +++ b/public/js/icinga/loader.js @@ -873,7 +873,7 @@ } }) } else { - this.renderContentToContainer( + let rendered = this.renderContentToContainer( req.responseText, req.$target, req.action, @@ -882,6 +882,10 @@ req.autosubmit || autoSubmit, req.scripted ); + + if (! rendered) { + req.discarded = true; + } } if (oldNotifications) { @@ -905,6 +909,14 @@ req = reqOrError; } + req.$target.data('lastUpdate', (new Date()).getTime()); + delete this.requests[req.$target.attr('id')]; + this.icinga.ui.fadeNotificationsAway(); + + if (req.discarded) { + return; + } + // Remove 'impact' class if there was such if (req.$target.hasClass('impact')) { req.$target.removeClass('impact'); @@ -957,10 +969,6 @@ } } - req.$target.data('lastUpdate', (new Date()).getTime()); - delete this.requests[req.$target.attr('id')]; - this.icinga.ui.fadeNotificationsAway(); - var extraUpdates = req.getResponseHeader('X-Icinga-Extra-Updates'); if (!! extraUpdates && req.getResponseHeader('X-Icinga-Redirect-Http') !== 'yes') { $.each(extraUpdates.split(','), function (idx, el) { @@ -1253,8 +1261,6 @@ } } - $container.trigger('beforerender', [content, action, autorefresh, scripted, autoSubmit]); - var discard = false; $.each(_this.icinga.behaviors, function(name, behavior) { if (behavior.renderHook) { @@ -1272,6 +1278,8 @@ }); if (! discard) { + $container.trigger('beforerender', [content, action, autorefresh, scripted, autoSubmit]); + if ($container.closest('.dashboard').length) { var title = $('h1', $container).first().detach(); $container.html(title).append(content); @@ -1337,6 +1345,8 @@ // Re-enable all click events (disabled as of performance reasons) // $('*').off('click'); + + return ! discard; }, /**