Source
xxxxxxxxxx
jQuery('input:radio[name="uniqueness_criteria"][value='+jQuery.escapeSelector(drule.uniqueness_criteria)+']')
<?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/>.
**/
/**
* @var CView $this
*/
?>
window.drule_edit_popup = new class {
init({druleid, dchecks, drule}) {
this.overlay = overlays_stack.getById('discoveryForm');
this.dialogue = this.overlay.$dialogue[0];
this.form = this.overlay.$dialogue.$body[0].querySelector('form');
this.druleid = druleid;
this.dchecks = dchecks;
this.drule = drule;
this.dcheckid = getUniqueId();
this.available_device_types = [<?= SVC_AGENT ?>, <?= SVC_SNMPv1 ?>, <?= SVC_SNMPv2c ?>, <?= SVC_SNMPv3 ?>];
document.getElementById('discovery_by').addEventListener('change', () => this.#updateForm());
// Append existing discovery checks to check table.
if (typeof dchecks === 'object') {
dchecks = Object.values(dchecks);
}
for (const dcheck of dchecks) {
this.#addCheck(dcheck);
}
this.#addRadioButtonValues(drule);
this.#initActionButtons();
this.#updateForm();
this.form.style.display = '';
this.overlay.recoverFocus();
}
#initActionButtons() {
this.dialogue.addEventListener('click', (e) => {
if (e.target.classList.contains('js-check-add')) {
this.#editCheck();
}
else if (e.target.classList.contains('js-remove')) {
this.#removeDCheckRow(e.target.closest('tr').id);
e.target.closest('tr').remove();
}
else if (e.target.classList.contains('js-edit')) {
this.#editCheck(e.target.closest('tr'));
}