JS/history: handle also requests out of containers

On login/logout (not only) we have requests not rendered to containers.
History handling only cared about them and failed.

fixes #6466
This commit is contained in:
Thomas Gelf 2014-06-21 01:57:59 +02:00
parent 216c2ca770
commit 747083d322
2 changed files with 18 additions and 3 deletions

View File

@ -94,6 +94,14 @@
}
},
pushUrl: function (url) {
// No history API, no action
if (!this.enabled) {
return;
}
window.history.pushState({icinga: true}, null, url);
},
/**
* Event handler for pop events
*

View File

@ -499,9 +499,16 @@
// Update history when necessary. Don't do so for requests triggered
// by history or autorefresh events
if (! req.historyTriggered && ! req.autorefresh) {
// We only want to care about top-level containers
if (req.$target.parent().closest('.container').length === 0) {
this.icinga.history.pushCurrentState();
if (req.$target.hasClass('container')) {
// We only want to care about top-level containers
if (req.$target.parent().closest('.container').length === 0) {
this.icinga.history.pushCurrentState();
this.icinga.logger.info('Pushing state');
}
} else {
// Request wasn't for a container, so it's usually the body
// or the full layout. Push request URL to history:
this.icinga.history.pushUrl(req.url);
}
}