IcingaHostForm: simplify form

This commit is contained in:
Thomas Gelf 2016-03-23 00:40:40 +01:00
parent 90651bffa3
commit cdbcd77952
1 changed files with 23 additions and 4 deletions

View File

@ -38,7 +38,19 @@ class IcingaHostForm extends DirectorObjectForm
->addAddressElements()
->addDisabledElement()
->groupMainProperties()
->addZoneElement();
->addClusteringElements()
->addCheckCommandElements()
->addCheckExecutionElements()
->setButtons();
}
protected function addClusteringElements()
{
if (!$this->isTemplate() && !$this->hasClusterProperties()) {
return $this;
}
$this->addZoneElement();
$this->addBoolean('has_agent', array(
'label' => $this->translate('Icinga2 Agent'),
@ -79,9 +91,16 @@ class IcingaHostForm extends DirectorObjectForm
'legend' => $this->translate('Icinga Agent and zone settings')
));
$this->addCheckCommandElements()
->addCheckExecutionElements()
->setButtons();
return $this;
}
protected function hasClusterProperties()
{
if (!$object = $this->object) {
return false;
}
return $object->zone_id || $object->has_agent;
}
protected function beforeSuccessfulRedirect()