Source
if (!window.confirm(<?= json_encode(_('Any changes made in the current form will be lost.')) ?>)) {
<?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.host_edit_popup = {
overlay: null,
dialogue: null,
form: null,
init({popup_url, form_name, host_interfaces, proxy_groupid, host_is_discovered, warnings}) {
this.overlay = overlays_stack.getById('host_edit');
this.dialogue = this.overlay.$dialogue[0];
this.form = this.overlay.$dialogue.$body[0].querySelector('form');
history.replaceState({}, '', popup_url);
host_edit.init({form_name, host_interfaces, proxy_groupid, host_is_discovered});
if (warnings.length) {
const message_box = warnings.length == 1
? makeMessageBox('warning', warnings, null, true, false)[0]
: makeMessageBox('warning', warnings,
<?= json_encode(_('Cloned host parameter values have been modified.')) ?>, true, false
)[0];
this.form.parentNode.insertBefore(message_box, this.form);
}
this.initial_form_fields = getFormFields(this.form);
this.initEvents();
},
initEvents() {
this.form.addEventListener('click', (e) => {
const target = e.target;
if (target.classList.contains('js-edit-linked-template')) {
this.editTemplate({templateid: e.target.dataset.templateid});
}
else if (target.classList.contains('js-edit-proxy')) {
this.editProxy(e.target.dataset.proxyid);
}
else if (target.classList.contains('js-update-item')) {
this.editItem(target, target.dataset);
}
});