[icinga-checkins] icinga.org: icingaweb2/master: Failure requests: Fix auto refresh and history II

git at icinga.org git at icinga.org
Mon Feb 2 16:53:56 CET 2015


Module: icingaweb2
Branch: master
Commit: 8bb0e4e0a0ba9d3924a16f3f569ee38cbda0291c
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=8bb0e4e0a0ba9d3924a16f3f569ee38cbda0291c

Author: Johannes Meyer <johannes.meyer at netways.de>
Date:   Mon Feb  2 16:34:29 2015 +0100

Failure requests: Fix auto refresh and history II

Allow to change url's in history and stop auto auto refresh if
the container URL is not up to date.

Use variable after ajax call and the check is more robust.

---

 public/js/icinga/loader.js |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js
index 6a85a51..417c47c 100644
--- a/public/js/icinga/loader.js
+++ b/public/js/icinga/loader.js
@@ -118,6 +118,8 @@
             req.historyTriggered = false;
             req.autorefresh = autorefresh;
             req.action = action;
+            req.failure = false;
+
             if (id) {
                 this.requests[id] = req;
             }
@@ -555,7 +557,7 @@
             // Update history when necessary. Don't do so for requests triggered
             // by history or autorefresh events
             if (! req.historyTriggered && ! req.autorefresh) {
-                if (req.$target.hasClass('container')) {
+                if (req.$target.hasClass('container') && ! req.failure) {
                     // We only want to care about top-level containers
                     if (req.$target.parent().closest('.container').length === 0) {
                         this.icinga.history.pushCurrentState();
@@ -591,6 +593,17 @@
         onFailure: function (req, textStatus, errorThrown) {
             var url = req.url;
 
+            req.failure = true;
+
+            /*
+             * Test if a manual actions comes in and autorefresh is active: Stop refreshing
+             */
+            if (! req.historyTriggered && ! req.autorefresh && req.$target.data('icingaRefresh') > 0
+            && req.$target.data('icingaUrl') !== url) {
+                req.$target.data('icingaRefresh', 0);
+                req.$target.data('icingaUrl', url);
+            }
+
             if (req.status > 0) {
                 this.icinga.logger.error(
                     req.status,



More information about the icinga-checkins mailing list