icingaweb2-module-director/application/forms/IcingaEndpointForm.php

58 lines
2.0 KiB
PHP
Raw Normal View History

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()
{
2015-07-30 11:33:08 +02:00
$isTemplate = $this->getSentValue('object_type') === 'template';
2015-06-01 17:26:09 +02:00
$this->addElement('select', 'object_type', array(
'label' => $this->translate('Object type'),
'description' => $this->translate('Whether this should be a template'),
'multiOptions' => array(
null => '- please choose -',
'object' => 'Endpoint object',
'template' => 'Endpoint template',
)
));
if ($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')
));
}
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-07-30 10:10:34 +02:00
$this->addZoneElement()
->addImportsElement();
$this->setButtons();
2015-06-01 17:26:09 +02:00
}
}