Source
$('[name="aggregate_interval"]', this._$widget_form).attr('disabled', !data_item_value || no_aggregate_function);
<?php declare(strict_types = 0);
/*
** Zabbix
** 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 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.
**/
?>
window.tophosts_column_edit_form = new class {
init({form_name, thresholds, thresholds_colors}) {
this._$widget_form = $(`form[name="${form_name}"]`);
this._$thresholds_table = this._$widget_form.find('#thresholds_table');
$('[name="data"], [name="aggregate_function"], [name="display"]', this._$widget_form).on('change', () => {
this._update();
});
colorPalette.setThemeColors(thresholds_colors);
this._$thresholds_table.dynamicRows({
rows: thresholds,
template: '#thresholds-row-tmpl',
dataCallback: (row_data) => {
if (!('color' in row_data)) {
const colors = this._$widget_form[0].querySelectorAll('.<?= ZBX_STYLE_COLOR_PICKER ?> input');
const used_colors = [];
for (const color of colors) {
if (color.value !== '') {
used_colors.push(color.value);
}
}
row_data.color = colorPalette.getNextColor(used_colors);
}
}
});
$('tr.form_row input[name$="[color]"]', this._$thresholds_table).each((i, colorpicker) => {
$(colorpicker).colorpicker({appendTo: $(colorpicker).closest('.input-color-picker')});
});
this._$thresholds_table
.on('afteradd.dynamicRows', e => {
const $colorpicker = $('tr.form_row:last input[name$="[color]"]', e.target);
$colorpicker.colorpicker({appendTo: $colorpicker.closest('.input-color-picker')});