From ea57e7a786a0962bc89bcd564b1d55a3f5deb9ab Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Mon, 16 Feb 2015 15:56:50 +0100 Subject: [PATCH] History: Do not write abort requests to browser history Remove req.historyTriggered and introduce req.addToHistory. --- public/js/icinga/history.js | 5 ++--- public/js/icinga/loader.js | 9 ++++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/public/js/icinga/history.js b/public/js/icinga/history.js index db08c95cb..96711f709 100644 --- a/public/js/icinga/history.js +++ b/public/js/icinga/history.js @@ -106,7 +106,6 @@ push: function (url) { url = url.replace(/[\?&]?_(render|reload)=[a-z0-9]+/g, ''); - console.log("URL:", url); if (this.lastPushUrl === url) { return; } @@ -159,7 +158,7 @@ icinga.loader.loadUrl( main, $('#col1') - ).historyTriggered = true; + ).addToHistory = false; } if (document.location.hash && document.location.hash.match(/^#!/)) { @@ -176,7 +175,7 @@ icinga.loader.loadUrl( parts[1], $('#col2') - ).historyTriggered = true; + ).addToHistory = false; } } diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js index 481a149ec..811b8ad00 100644 --- a/public/js/icinga/loader.js +++ b/public/js/icinga/loader.js @@ -114,10 +114,10 @@ req.done(this.onResponse); req.fail(this.onFailure); req.complete(this.onComplete); - req.historyTriggered = false; req.autorefresh = autorefresh; req.action = action; req.failure = false; + req.addToHistory = true; if (id) { this.requests[id] = req; @@ -553,7 +553,7 @@ // Update history when necessary. Don't do so for requests triggered // by history or autorefresh events - if (! req.historyTriggered && ! req.autorefresh) { + if (! req.autorefresh && req.addToHistory) { if (req.$target.hasClass('container') && ! req.failure) { // We only want to care about top-level containers if (req.$target.parent().closest('.container').length === 0) { @@ -597,7 +597,7 @@ /* * Test if a manual actions comes in and autorefresh is active: Stop refreshing */ - if (! req.historyTriggered && ! req.autorefresh && req.$target.data('icingaRefresh') > 0 + if (req.addToHistory && ! req.autorefresh && req.$target.data('icingaRefresh') > 0 && req.$target.data('icingaUrl') !== url) { req.$target.data('icingaRefresh', 0); req.$target.data('icingaUrl', url); @@ -621,6 +621,9 @@ 'Request to ' + url + ' has been aborted for ', req.$target ); + + // Aborted requests should not be added to browser history + req.addToHistory = false; } else { if (this.failureNotice === null) { this.failureNotice = this.createNotice(