Source
this._flickerfreescreen_container = this._flickerfreescreen.querySelector('.dashboard-widget-graph-link');
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
class CWidgetGraph extends CWidget {
_init() {
super._init();
this._is_graph_mode = false;
}
_doActivate() {
if (this._is_graph_mode) {
this._activateGraph();
}
super._doActivate();
}
_doDeactivate() {
if (this._is_graph_mode) {
this._deactivateGraph();
}
super._doDeactivate();
}
resize() {
super.resize();
if (this._is_graph_mode && this.getState() === WIDGET_STATE_ACTIVE) {
const graph_size = this._getGraphSize();
if (graph_size.width <= 0 || graph_size.height <= 0) {
return;
}
const image = document.getElementById('graph_' + this._unique_id);
if (!image.complete) {
image.addEventListener('load', () => this.resize(), {once: true});
return;
}
timeControl.objectList['graph_' + this._unique_id].objDims.width = graph_size.width;
timeControl.objectList['graph_' + this._unique_id].objDims.graphHeight = graph_size.height;
const image_curl = new Curl(image.src, false);
image_curl.setArgument('width', graph_size.width);
image_curl.setArgument('height', graph_size.height);
image_curl.setArgument('_', (new Date).getTime().toString(34));
image.src = image_curl.getUrl();
}
}
updateProperties({name, view_mode, fields, configuration}) {
if (this._state === WIDGET_STATE_ACTIVE) {
this._stopUpdating(true);
}
this._is_graph_mode = false;
super.updateProperties({name, view_mode, fields, configuration});
}
setEditMode() {
super.setEditMode();
if (this._is_graph_mode && this._graph_url !== null) {
this._flickerfreescreen_container.href = 'javascript:void(0)';
this._flickerfreescreen_container.setAttribute('role', 'button');
}