Source
this.show_formula = document.querySelector('#evaltype').value == <?= CONDITION_EVAL_TYPE_EXPRESSION ?>;
<?php declare(strict_types = 0);
/*
** 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/>.
**/
?>
window.action_edit_popup = new class {
init({condition_operators, condition_types, conditions, actionid, eventsource}) {
this.overlay = overlays_stack.getById('action-edit');
this.dialogue = this.overlay.$dialogue[0];
this.form = this.overlay.$dialogue.$body[0].querySelector('form');
this.condition_operators = condition_operators;
this.condition_types = condition_types;
this.actionid = actionid;
this.eventsource = eventsource;
this._initActionButtons();
this._processTypeOfCalculation();
// Add existing conditions in action edit popup.
if (typeof(conditions) === 'object') {
conditions = Object.values(conditions);
}
for (const condition of conditions) {
this._createConditionsRow(condition);
}
// Reload operation table when esc_period is changed.
const esc_period = document.querySelector('#esc_period');
if (esc_period) {
esc_period.addEventListener('change', () => {
this.recovery = <?= ACTION_OPERATION ?>;
this._loadOperationTable();
});
}
this.form.style.display = '';
this.overlay.recoverFocus();
}
_loadOperationTable(new_operation = {}) {
if (this.recovery == <?= ACTION_RECOVERY_OPERATION ?>) {
this.$operation_table = $('#recovery-operations-container');
}
else if (this.recovery == <?= ACTION_UPDATE_OPERATION ?>) {
this.$operation_table = $('#update-operations-container');
}
else {
this.$operation_table = $('#operations-container');
}