mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-09-25 02:47:39 +02:00
IcingaServiceForm: distinct objects/templates
This commit is contained in:
parent
3b71f2219f
commit
77dc7e24d3
@ -8,39 +8,21 @@ class IcingaServiceForm extends DirectorObjectForm
|
|||||||
{
|
{
|
||||||
public function setup()
|
public function setup()
|
||||||
{
|
{
|
||||||
$isTemplate = isset($_POST['object_type']) && $_POST['object_type'] === 'template';
|
$this->addElement('text', 'object_name', array(
|
||||||
$this->addElement('select', 'object_type', array(
|
'label' => $this->translate('Name'),
|
||||||
'label' => $this->translate('Object type'),
|
'required' => true,
|
||||||
'description' => $this->translate('Whether this should be a template'),
|
'description' => $this->translate('Name for the Icinga object you are going to create')
|
||||||
'multiOptions' => array(
|
|
||||||
null => '- please choose -',
|
|
||||||
'object' => 'Service object',
|
|
||||||
'template' => 'Service template',
|
|
||||||
),
|
|
||||||
'class' => 'autosubmit'
|
|
||||||
));
|
));
|
||||||
|
|
||||||
if ($isTemplate) {
|
|
||||||
$this->addElement('text', 'object_name', array(
|
|
||||||
'label' => $this->translate('Service template name'),
|
|
||||||
'required' => true,
|
|
||||||
'description' => $this->translate('Name for the Icinga service template you are going to create')
|
|
||||||
));
|
|
||||||
} else {
|
|
||||||
$this->addElement('text', 'object_name', array(
|
|
||||||
'label' => $this->translate('Servicename'),
|
|
||||||
'required' => true,
|
|
||||||
'description' => $this->translate('Servicename for the Icinga service you are going to create')
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->addElement('text', 'groups', array(
|
$this->addElement('text', 'groups', array(
|
||||||
'label' => $this->translate('Servicegroups'),
|
'label' => $this->translate('Servicegroups'),
|
||||||
'description' => $this->translate('One or more comma separated servicegroup names')
|
'description' => $this->translate('One or more comma separated servicegroup names')
|
||||||
));
|
));
|
||||||
|
$this->addImportsElement();
|
||||||
|
|
||||||
$this->addCheckCommandElement()
|
if ($this->isTemplate()) {
|
||||||
->addCheckFlagElements()
|
$this->addCheckCommandElement()
|
||||||
->addImportsElement();
|
->addCheckFlagElements();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user