Source
const time_period_show = parseInt(document.getElementById('aggregate_function').value) != <?= AGGREGATE_NONE ?>;
<?php declare(strict_types = 0);
/*
** 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 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/>.
**/
use Widgets\TopItems\Includes\CWidgetFieldColumnsList;
?>
window.topitems_column_edit_form = new class {
/**
* @type {Overlay}
*/
#overlay;
/**
* @type {HTMLElement}
*/
#dialogue;
/**
* @type {HTMLFormElement}
*/
#form;
/**
* @type {HTMLTableElement}
*/
#thresholds_table;
/**
* @type {HTMLTableElement}
*/
#highlights_table;
init({form_id, thresholds, highlights, colors}) {
this.#overlay = overlays_stack.getById('topitems-column-edit-overlay');
this.#dialogue = this.#overlay.$dialogue[0];
this.#form = document.getElementById(form_id);
this.#thresholds_table = document.getElementById('thresholds_table');
this.#highlights_table = document.getElementById('highlights_table');
this.#form
.querySelectorAll(
'[name="display_value_as"], [name="aggregate_function"], [name="display"], [name="history"]'
)
.forEach(element => {
element.addEventListener('change', () => this.#updateForm());
});