History: Do not write abort requests to browser history

Remove req.historyTriggered and introduce req.addToHistory.
This commit is contained in:
Marius Hein 2015-02-16 15:56:50 +01:00
parent 6cc428d0e1
commit ea57e7a786
2 changed files with 8 additions and 6 deletions

View File

@ -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;
}
}

View File

@ -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(