icingaweb2-module-director/application/forms/IcingaEndpointForm.php
Eric Lippmann b6af283732 License source files as GPL-3.0-or-later
Add SPDX license headers and mark source files as GPL-3.0-or-later to
preserve the option to relicense under later GPL versions.
2026-03-24 11:30:06 +01:00

64 lines
2.1 KiB
PHP

<?php
// SPDX-FileCopyrightText: 2018 Icinga GmbH <https://icinga.com>
// SPDX-License-Identifier: GPL-3.0-or-later
namespace Icinga\Module\Director\Forms;
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
class IcingaEndpointForm extends DirectorObjectForm
{
public function setup()
{
$this->addObjectTypeElement();
if (! $this->hasObjectType()) {
return;
}
if ($this->isTemplate()) {
$this->addElement('text', 'object_name', array(
'label' => $this->translate('Endpoint template name'),
'required' => true,
'description' => $this->translate('Name for the Icinga endpoint template you are going to create')
));
} else {
$this->addElement('text', 'object_name', array(
'label' => $this->translate('Endpoint'),
'required' => true,
'description' => $this->translate('Name for the Icinga endpoint you are going to create')
));
}
$this->addElement('text', 'host', array(
'label' => $this->translate('Endpoint address'),
'description' => $this->translate('IP address / hostname of remote node')
));
$this->addElement('text', 'port', array(
'label' => $this->translate('Port'),
'description' => $this->translate('The port of the endpoint.'),
));
$this->addElement('text', 'log_duration', array(
'label' => $this->translate('Log Duration'),
'description' => $this->translate('The log duration time.')
));
$this->addElement('select', 'apiuser_id', array(
'label' => $this->translate('API user'),
'multiOptions' => $this->optionalEnum($this->db->enumApiUsers())
));
$this->addZoneElement();
if ($this->object->hasBeenLoadedFromDb()) {
$imports = $this->object->get('imports');
if ($imports !== null && count($imports) > 0) {
$this->addImportsElement(false);
}
}
$this->setButtons();
}
}