Source
xxxxxxxxxx
const widget = this._widgets.has(data.widgetid) ? this._widgets.get(data.widgetid) : this._addWidget(data);
/*
** 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/>.
**/
class CWidgetIterator extends CWidget {
#unique_id_index = 0;
#ready_callback = () => {};
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._widgets_data = 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,
widgetReady: e => {
const widget = e.detail.target;
this._widgets_data.get(widget.getWidgetId()).is_ready = true;
let is_ready = true;
for (const data of this._widgets_data.values()) {
if (!data.is_ready) {
is_ready = false;
break;
}
}
if (is_ready) {
this.#ready_callback();
}
},
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();
}