JS: Always request application-state

Icinga Web 2 version 2.5.0 suspends auto-refresh if the tab is inactive.
This also pauses the application-state requests which are intended to refresh the session and announcements.
If a tab is inactive for longer than the PHP session timeout (session.gc_maxlifetime in php.ini), users are automatically logged out.
With this patch Web 2 will always request application-state. Even if auto-refresh is disabled.
This commit is contained in:
Eric Lippmann 2017-12-04 14:25:23 +01:00
parent 208e49a616
commit cb83a7dea3
1 changed files with 7 additions and 3 deletions

View File

@ -217,13 +217,17 @@
autorefresh: function () { autorefresh: function () {
var _this = this; var _this = this;
if (! _this.autorefreshEnabled || _this.autorefreshSuspended) {
return;
}
$('.container').filter(this.filterAutorefreshingContainers).each(function (idx, el) { $('.container').filter(this.filterAutorefreshingContainers).each(function (idx, el) {
var $el = $(el); var $el = $(el);
var id = $el.attr('id'); var id = $el.attr('id');
// Always request application-state
if (id !== 'application-state' && (! _this.autorefreshEnabled || _this.autorefreshSuspended)) {
// Continue
return true;
}
if (typeof _this.requests[id] !== 'undefined') { if (typeof _this.requests[id] !== 'undefined') {
_this.icinga.logger.debug('No refresh, request pending for ', id); _this.icinga.logger.debug('No refresh, request pending for ', id);
return; return;