2015-06-01 17:26:09 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\Forms;
|
|
|
|
|
|
|
|
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
|
|
|
|
|
|
|
class IcingaEndpointForm extends DirectorObjectForm
|
|
|
|
{
|
|
|
|
public function setup()
|
|
|
|
{
|
2016-02-17 21:58:28 +01:00
|
|
|
$this->addObjectTypeElement();
|
2016-03-07 14:20:58 +01:00
|
|
|
if (! $this->hasObjectType()) {
|
|
|
|
return;
|
|
|
|
}
|
2016-02-17 21:58:28 +01:00
|
|
|
|
|
|
|
if ($this->isTemplate()) {
|
2015-06-01 17:26:09 +02:00
|
|
|
$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')
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
2015-12-08 08:29:04 +01:00
|
|
|
$this->addElement('text', 'host', array(
|
2015-06-01 17:26:09 +02:00
|
|
|
'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.')
|
|
|
|
));
|
|
|
|
|
2015-12-17 14:39:28 +01:00
|
|
|
$this->addElement('select', 'apiuser_id', array(
|
|
|
|
'label' => $this->translate('API user'),
|
|
|
|
'multiOptions' => $this->optionalEnum($this->db->enumApiUsers())
|
|
|
|
));
|
|
|
|
|
2015-07-30 10:10:34 +02:00
|
|
|
$this->addZoneElement()
|
|
|
|
->addImportsElement();
|
2015-11-14 14:53:31 +01:00
|
|
|
|
|
|
|
$this->setButtons();
|
2015-06-01 17:26:09 +02:00
|
|
|
}
|
|
|
|
}
|