js: Improve logging when pushing history states

This commit is contained in:
Johannes Meyer 2015-09-25 14:08:10 +02:00
parent 67a28a4b47
commit f17c185aed

View File

@ -57,15 +57,11 @@
* TODO: How should we handle POST requests? e.g. search VS login * TODO: How should we handle POST requests? e.g. search VS login
*/ */
pushCurrentState: function () { pushCurrentState: function () {
var icinga = this.icinga;
// No history API, no action // No history API, no action
if (!this.enabled) { if (! this.enabled) {
return; return;
} }
icinga.logger.debug('Pushing current state to history');
var url = ''; var url = '';
// We only store URLs of containers sitting directly under #main: // We only store URLs of containers sitting directly under #main:
@ -85,6 +81,7 @@
// Did we find any URL? Then push it! // Did we find any URL? Then push it!
if (url !== '') { if (url !== '') {
this.icinga.logger.debug('Pushing current state to history');
this.push(url); this.push(url);
} }
}, },
@ -112,6 +109,9 @@
push: function (url) { push: function (url) {
url = url.replace(/[\?&]?_(render|reload)=[a-z0-9]+/g, ''); url = url.replace(/[\?&]?_(render|reload)=[a-z0-9]+/g, '');
if (this.lastPushUrl === url) { if (this.lastPushUrl === url) {
this.icinga.logger.debug(
'Ignoring history state push for url ' + url + ' as it\' currently on top of the stack'
);
return; return;
} }
this.lastPushUrl = url; this.lastPushUrl = url;