2015-04-24 14:26:44 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\Forms;
|
|
|
|
|
2015-07-28 17:37:05 +02:00
|
|
|
use Icinga\Module\Director\Objects\DirectorDatafield;
|
2015-04-24 14:26:44 +02:00
|
|
|
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
|
|
|
|
|
|
|
class IcingaHostForm extends DirectorObjectForm
|
|
|
|
{
|
|
|
|
public function setup()
|
|
|
|
{
|
2015-07-30 11:33:08 +02:00
|
|
|
$this->addElement('text', 'object_name', array(
|
|
|
|
'label' => $this->translate('Hostname'),
|
|
|
|
'required' => true,
|
|
|
|
'description' => $this->translate('Icinga object name for this host')
|
2015-04-24 14:26:44 +02:00
|
|
|
));
|
2015-08-29 00:05:39 +02:00
|
|
|
|
|
|
|
$this->addElement('text', 'display_name', array(
|
|
|
|
'label' => $this->translate('Display name'),
|
|
|
|
'description' => $this->translate('Alternative name for this host')
|
|
|
|
));
|
2015-04-24 14:26:44 +02:00
|
|
|
|
|
|
|
$this->addElement('text', 'address', array(
|
|
|
|
'label' => $this->translate('Host address'),
|
|
|
|
'description' => $this->translate('Host address. Usually an IPv4 address, but may be any kind of address your check plugin is able to deal with')
|
|
|
|
));
|
|
|
|
|
|
|
|
$this->addElement('text', 'address6', array(
|
|
|
|
'label' => $this->translate('IPv6 address'),
|
|
|
|
'description' => $this->translate('Usually your hosts main IPv6 address')
|
|
|
|
));
|
|
|
|
|
2015-07-30 11:33:08 +02:00
|
|
|
$this->addImportsElement();
|
2015-04-24 14:26:44 +02:00
|
|
|
|
2015-07-31 17:36:00 +02:00
|
|
|
/*
|
2015-06-16 17:58:47 +02:00
|
|
|
$this->addElement('text', 'groups', array(
|
|
|
|
'label' => $this->translate('Hostgroups'),
|
|
|
|
'description' => $this->translate('One or more comma separated hostgroup names')
|
|
|
|
));
|
2015-07-31 17:36:00 +02:00
|
|
|
*/
|
2015-06-16 17:58:47 +02:00
|
|
|
|
2015-10-15 20:08:40 +02:00
|
|
|
$elements = array(
|
|
|
|
'object_name',
|
|
|
|
'display_name',
|
|
|
|
'address',
|
|
|
|
'address6',
|
|
|
|
'imports',
|
|
|
|
);
|
|
|
|
$this->addDisplayGroup($elements, 'object_definition', array(
|
|
|
|
'decorators' => array(
|
|
|
|
'FormElements',
|
|
|
|
'Fieldset',
|
|
|
|
),
|
|
|
|
'order' => 20,
|
|
|
|
'legend' => $this->translate('Host properties')
|
|
|
|
));
|
2015-07-28 17:37:05 +02:00
|
|
|
|
2015-10-15 20:08:40 +02:00
|
|
|
if ($this->isTemplate()) {
|
2015-12-02 03:07:28 +01:00
|
|
|
$this->addCheckCommandElements();
|
2015-07-31 16:59:56 +02:00
|
|
|
$this->addCheckExecutionElements();
|
2015-07-30 11:33:08 +02:00
|
|
|
} else {
|
|
|
|
$this->getElement('imports')->setRequired();
|
2015-07-28 17:37:05 +02:00
|
|
|
}
|
2015-10-15 23:53:59 +02:00
|
|
|
$this->setButtons();
|
2015-07-30 11:33:08 +02:00
|
|
|
|
2015-09-14 16:20:13 +02:00
|
|
|
// $this->addZoneElement();
|
2015-07-28 17:37:05 +02:00
|
|
|
}
|
2015-04-24 14:26:44 +02:00
|
|
|
}
|