Source
const widget = this._widgets.has(data.widgetid) ? this._widgets.get(data.widgetid) : this._addWidget(data);
/*
** 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 CWidgetIterator extends CWidget {
_init() {
super._init();
this._css_classes = {
this._css_classes,
actions: 'dashboard-grid-iterator-actions',
container: 'dashboard-grid-iterator-container',
content: 'dashboard-grid-iterator-content',
focus: 'dashboard-grid-iterator-focus',
head: 'dashboard-grid-iterator-head',
hidden_header: 'dashboard-grid-iterator-hidden-header',
mask: 'dashboard-grid-iterator-mask',
root: 'dashboard-grid-iterator'
};
this._widgets = new Map();
this._placeholders = [];
this._grid_pos = [];
this._has_contents = false;
this._has_alt_content = false;
this._page = 1;
this._page_count = 1;
}
_doDeactivate() {
if (this._has_contents) {
for (const widget of this._widgets.values()) {
if (widget._state === WIDGET_STATE_ACTIVE) {
widget.deactivate();
this._removeWidgetEventListeners(widget);
}
}
}
super._doDeactivate();
}
getNumHeaderLines() {
if (this._view_mode == ZBX_WIDGET_VIEW_MODE_HIDDEN_HEADER
&& this._target.classList.contains('iterator-double-header')) {
return 2;
}
return 1;
}
resize() {
super.resize();
if (this._has_contents && !this._isTooSmall()) {
this._updatePager();
}
if (this._has_alt_content || this._isTooSmall() || this._isResizing()) {
return;
}
for (const widget of this._widgets.values()) {
widget.resize();
}
}
_setViewMode(view_mode) {
super._setViewMode(view_mode);
for (const widget of this._widgets.values()) {