Source
const widget = this._widgets.has(data.widgetid) ? this._widgets.get(data.widgetid) : this._addWidget(data);
/*
** Zabbix
** Copyright (C) 2001-2024 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 {
#unique_id_index = 0;
onInitialize() {
this._css_classes = {
this._css_classes,
actions: 'dashboard-grid-iterator-actions',
container: 'dashboard-grid-iterator-container',
contents: 'dashboard-grid-iterator-contents',
messages: 'dashboard-grid-iterator-messages',
body: 'dashboard-grid-iterator-body',
debug: 'dashboard-grid-iterator-debug',
focus: 'dashboard-grid-iterator-focus',
header: 'dashboard-grid-iterator-header',
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;
}
onStart() {
this._events = {
this._events,
widgetEnter: e => {
const widget = e.detail.target;
if (!widget.isEntered()) {
widget.enter();
if (this._view_mode === ZBX_WIDGET_VIEW_MODE_HIDDEN_HEADER) {
this._target.classList.toggle('iterator-double-header', widget.getPos().y === 0);
}
}
},
widgetLeave: e => {
const widget = e.detail.target;
if (widget.isEntered()) {
widget.leave();
}
},
iteratorEnter: e => {
if (e.target.closest('.dashboard-grid-iterator-placeholder') !== null) {
this._target.classList.remove('iterator-double-header');
}
},
previousPageClick: () => {
if (this._page > 1) {
this._page--;
this._startUpdating();
}
},
nextPageClick: () => {
if (this._page < this._page_count) {