From 0604d303489b3650130c46daab160d7a503f531d Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 24 Jun 2014 07:01:37 +0200 Subject: [PATCH] js/loader: stop pending subcontainer requests When redrawing a container we should cancel it's subcontainers pending requests. This also fixes stopPendingRequestsFor(), it didn't really work before. --- public/js/icinga/loader.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js index 63d1f726b..e09bc167a 100644 --- a/public/js/icinga/loader.js +++ b/public/js/icinga/loader.js @@ -141,11 +141,11 @@ stopPendingRequestsFor: function ($el) { var id; - if (typeof $el !== 'undefined' || ! (id = $el.attr('id'))) { + if (typeof $el === 'undefined' || ! (id = $el.attr('id'))) { return; } - if (id in this.requests) { + if (typeof this.requests[id] !== 'undefined') { this.requests[id].abort(); } }, @@ -623,6 +623,7 @@ renderContentToContainer: function (content, $container, action, autorefresh) { // Container update happens here var scrollPos = false; + var self = this; var containerId = $container.attr('id'); if (typeof containerId !== 'undefined') { scrollPos = $container.scrollTop(); @@ -644,6 +645,9 @@ event.preventDefault(); }); + $('.container', $container).each(function() { + self.stopPendingRequestsFor($(this)); + }); if (false && $('.dashboard', $content).length > 0 &&