Source
// TODO: remove, do not use timestamp passing to server and back to ensure newest content will be shown.
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
(function($) {
window.flickerfreeScreen = {
screens: [],
responsiveness: 10000,
/**
* Set or reset UI in progress state for element with id.
*
* @param {boolean} in_progress
* @param {string} id
*/
setElementProgressState: function(id, in_progress) {
var elm = $('#flickerfreescreen_'+id);
if (in_progress) {
elm.addClass('is-loading is-loading-fadein delayed-15s');
}
else {
elm.removeClass('is-loading is-loading-fadein delayed-15s');
}
},
add: function(screen) {
// switch off time control refreshing using full page refresh
timeControl.refreshPage = false;
// init screen item
this.screens[screen.id] = screen;
this.screens[screen.id].interval = (screen.interval > 0) ? screen.interval * 1000 : 0;
this.screens[screen.id].timestamp = 0;
this.screens[screen.id].timestampResponsiveness = 0;
this.screens[screen.id].timestampActual = 0;
this.screens[screen.id].isRefreshing = false;
this.screens[screen.id].isReRefreshRequire = false;
this.screens[screen.id].error = 0;
// SCREEN_RESOURCE_MAP
if (screen.resourcetype == 2) {
this.screens[screen.id].data = new SVGMap(this.screens[screen.id].data);
$(screen.data.container).attr({'aria-label': screen.data.options.aria_label, 'tabindex': 0})
.find('svg').attr('aria-hidden', 'true');
}
// init refresh plan
if (screen.isFlickerfree && screen.interval > 0) {
this.screens[screen.id].timeoutHandler = window.setTimeout(