mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
IcingaHostForm: simplify form
This commit is contained in:
parent
90651bffa3
commit
cdbcd77952
@ -38,7 +38,19 @@ class IcingaHostForm extends DirectorObjectForm
|
|||||||
->addAddressElements()
|
->addAddressElements()
|
||||||
->addDisabledElement()
|
->addDisabledElement()
|
||||||
->groupMainProperties()
|
->groupMainProperties()
|
||||||
->addZoneElement();
|
->addClusteringElements()
|
||||||
|
->addCheckCommandElements()
|
||||||
|
->addCheckExecutionElements()
|
||||||
|
->setButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function addClusteringElements()
|
||||||
|
{
|
||||||
|
if (!$this->isTemplate() && !$this->hasClusterProperties()) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->addZoneElement();
|
||||||
|
|
||||||
$this->addBoolean('has_agent', array(
|
$this->addBoolean('has_agent', array(
|
||||||
'label' => $this->translate('Icinga2 Agent'),
|
'label' => $this->translate('Icinga2 Agent'),
|
||||||
@ -79,9 +91,16 @@ class IcingaHostForm extends DirectorObjectForm
|
|||||||
'legend' => $this->translate('Icinga Agent and zone settings')
|
'legend' => $this->translate('Icinga Agent and zone settings')
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->addCheckCommandElements()
|
return $this;
|
||||||
->addCheckExecutionElements()
|
}
|
||||||
->setButtons();
|
|
||||||
|
protected function hasClusterProperties()
|
||||||
|
{
|
||||||
|
if (!$object = $this->object) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $object->zone_id || $object->has_agent;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function beforeSuccessfulRedirect()
|
protected function beforeSuccessfulRedirect()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user