dependencies: cleanup

This commit is contained in:
Thomas Gelf 2018-06-08 08:45:54 +02:00
parent d2cfa20385
commit a95618f283
2 changed files with 50 additions and 13 deletions

View File

@ -10,10 +10,10 @@ class DependencyController extends ObjectController
{
protected $apply;
protected function beforeTabs()
{
}
/**
* @throws \Icinga\Exception\ConfigurationError
* @throws \Icinga\Exception\NotFoundError
*/
public function init()
{
parent::init();
@ -26,6 +26,12 @@ class DependencyController extends ObjectController
}
}
/**
* @return \Icinga\Module\Director\Objects\IcingaObject
* @throws \Icinga\Exception\ConfigurationError
* @throws \Icinga\Exception\InvalidPropertyException
* @throws \Icinga\Exception\NotFoundError
*/
protected function loadObject()
{
if ($this->object === null) {
@ -42,12 +48,11 @@ class DependencyController extends ObjectController
return $this->object;
}
public function loadForm($name)
{
$form = parent::loadForm($name);
return $form;
}
/**
* Hint: this is never being called. Why?
*
* @param $form
*/
protected function beforeHandlingAddRequest($form)
{
/** @var IcingaDependencyForm $form */

View File

@ -3,17 +3,21 @@
namespace Icinga\Module\Director\Forms;
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
use Icinga\Module\Director\Objects\IcingaHost;
use Icinga\Module\Director\Objects\IcingaService;
use Icinga\Module\Director\Objects\IcingaDependency;
class IcingaDependencyForm extends DirectorObjectForm
{
/**
* @throws \Zend_Form_Exception
*/
public function setup()
{
$this->setupDependencyElements();
}
/***
* @throws \Zend_Form_Exception
*/
protected function setupDependencyElements()
{
$this->addObjectTypeElement();
@ -35,6 +39,10 @@ class IcingaDependencyForm extends DirectorObjectForm
->setButtons();
}
/**
* @return $this
* @throws \Zend_Form_Exception
*/
protected function addZoneSection()
{
$this->addZoneElement(true);
@ -55,6 +63,10 @@ class IcingaDependencyForm extends DirectorObjectForm
return $this;
}
/**
* @return $this
* @throws \Zend_Form_Exception
*/
protected function addNameElement()
{
$this->addElement('text', 'object_name', [
@ -66,7 +78,10 @@ class IcingaDependencyForm extends DirectorObjectForm
return $this;
}
/**
* @return $this
* @throws \Zend_Form_Exception
*/
protected function addAssignmentElements()
{
if (!$this->object || !$this->object->isApplyRule()) {
@ -105,6 +120,10 @@ class IcingaDependencyForm extends DirectorObjectForm
return $this;
}
/**
* @return $this
* @throws \Zend_Form_Exception
*/
protected function addPeriodElement()
{
$periods = $this->db->enumTimeperiods();
@ -128,6 +147,9 @@ class IcingaDependencyForm extends DirectorObjectForm
return $this;
}
/**
* @return $this
*/
protected function addBooleanElements()
{
$this->addBoolean('disable_checks', [
@ -157,6 +179,10 @@ class IcingaDependencyForm extends DirectorObjectForm
return $this;
}
/**
* @return $this
* @throws \Zend_Form_Exception
*/
protected function addObjectsElement()
{
$this->addElement(
@ -246,6 +272,12 @@ class IcingaDependencyForm extends DirectorObjectForm
return $this;
}
/**
* Hint: this is unused. Why?
*
* @param IcingaDependency $dependency
* @return $this
*/
public function createApplyRuleFor(IcingaDependency $dependency)
{
$object = $this->object();