Source
this.#showErrorDialog(<?= json_encode(_('Cannot convert POST data:')) ?> + '<br><br>' + error, e.target);
<?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.webscenario_step_edit_popup = new class {
/** @type {Overlay} */
#overlay;
/** @type {HTMLDivElement} */
#dialogue;
/** @type {HTMLFormElement} */
#form;
/** @type {HTMLTableElement} */
#query_fields;
/** @type {HTMLTableElement} */
#post_fields;
/** @type {HTMLTableElement} */
#headers;
init({query_fields, post_fields, variables, headers}) {
this.#overlay = overlays_stack.getById('webscenario-step-edit');
this.#dialogue = this.#overlay.$dialogue[0];
this.#form = this.#overlay.$dialogue.$body[0].querySelector('form');
this.#query_fields = document.getElementById('step-query-fields');
this.#post_fields = document.getElementById('step-post-fields');
this.#headers = document.getElementById('step-headers');
this.#initQueryFields(query_fields);
this.#initPostFields(post_fields);
this.#initVariables(variables);
this.#initHeaders(headers);
document.getElementById('post_type').addEventListener('change', (e) => this.#togglePostType(e));
document.getElementById('retrieve_mode').addEventListener('change', () => this.#updateForm());
this.#form.querySelector('.js-parse-url').addEventListener('click', () => this.#parseUrl());
this.#updateForm();
}
submit() {
const fields = getFormFields(this.#form);
for (const field of ['name', 'url', 'posts', 'timeout', 'required', 'status_codes']) {
if (field in fields) {