DirectorObjectForm: replace state filter helpers
This commit is contained in:
parent
3e0fbf5dac
commit
e8a28a12da
|
@ -76,51 +76,6 @@ class IcingaUserForm extends DirectorObjectForm
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function addEventFilterElements()
|
|
||||||
{
|
|
||||||
$this->addElement('extensibleSet', 'states', array(
|
|
||||||
'label' => $this->translate('States'),
|
|
||||||
'multiOptions' => $this->optionallyAddFromEnum($this->enumStates()),
|
|
||||||
'description' => $this->translate(
|
|
||||||
'The host/service states you want to get notifications for'
|
|
||||||
),
|
|
||||||
));
|
|
||||||
|
|
||||||
$this->addElement('extensibleSet', 'types', array(
|
|
||||||
'label' => $this->translate('Transition types'),
|
|
||||||
'multiOptions' => $this->optionallyAddFromEnum($this->enumTypes()),
|
|
||||||
'description' => $this->translate(
|
|
||||||
'The state transition types you want to get notifications for'
|
|
||||||
),
|
|
||||||
));
|
|
||||||
|
|
||||||
$elements = array(
|
|
||||||
'states',
|
|
||||||
'types',
|
|
||||||
);
|
|
||||||
$this->addDisplayGroup($elements, 'event_filters', array(
|
|
||||||
'decorators' => array(
|
|
||||||
'FormElements',
|
|
||||||
array('HtmlTag', array('tag' => 'dl')),
|
|
||||||
'Fieldset',
|
|
||||||
),
|
|
||||||
'order' =>70,
|
|
||||||
'legend' => $this->translate('State and transition type filters')
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function enumStates()
|
|
||||||
{
|
|
||||||
$set = new \Icinga\Module\Director\IcingaConfig\StateFilterSet();
|
|
||||||
return $set->enumAllowedValues();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function enumTypes()
|
|
||||||
{
|
|
||||||
$set = new \Icinga\Module\Director\IcingaConfig\TypeFilterSet();
|
|
||||||
return $set->enumAllowedValues();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function groupObjectDefinition()
|
protected function groupObjectDefinition()
|
||||||
{
|
{
|
||||||
$elements = array(
|
$elements = array(
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
namespace Icinga\Module\Director\Web\Form;
|
namespace Icinga\Module\Director\Web\Form;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Icinga\Module\Director\IcingaConfig\StateFilterSet;
|
||||||
|
use Icinga\Module\Director\IcingaConfig\TypeFilterSet;
|
||||||
use Icinga\Module\Director\Objects\IcingaObject;
|
use Icinga\Module\Director\Objects\IcingaObject;
|
||||||
use Icinga\Module\Director\Objects\DirectorDatafield;
|
use Icinga\Module\Director\Objects\DirectorDatafield;
|
||||||
use Zend_Form_Element_Select as Zf_Select;
|
use Zend_Form_Element_Select as Zf_Select;
|
||||||
|
@ -1097,42 +1099,49 @@ print_r($object);
|
||||||
return $tpl;
|
return $tpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: deprecate
|
protected function addEventFilterElements()
|
||||||
protected function enumStateFilters()
|
|
||||||
{
|
{
|
||||||
return array(
|
$this->addElement('extensibleSet', 'states', array(
|
||||||
$this->translate('Hosts') => array(
|
'label' => $this->translate('States'),
|
||||||
'Up' => $this->translate('Up'),
|
'multiOptions' => $this->optionallyAddFromEnum($this->enumStates()),
|
||||||
'Down' => $this->translate('Down')
|
'description' => $this->translate(
|
||||||
|
'The host/service states you want to get notifications for'
|
||||||
),
|
),
|
||||||
$this->translate('Services') => array(
|
));
|
||||||
'OK' => $this->translate('OK'),
|
|
||||||
'Warning' => $this->translate('Warning'),
|
$this->addElement('extensibleSet', 'types', array(
|
||||||
'Critical' => $this->translate('Critical'),
|
'label' => $this->translate('Transition types'),
|
||||||
'Unknown' => $this->translate('Unknown'),
|
'multiOptions' => $this->optionallyAddFromEnum($this->enumTypes()),
|
||||||
|
'description' => $this->translate(
|
||||||
|
'The state transition types you want to get notifications for'
|
||||||
),
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
$elements = array(
|
||||||
|
'states',
|
||||||
|
'types',
|
||||||
);
|
);
|
||||||
|
$this->addDisplayGroup($elements, 'event_filters', array(
|
||||||
|
'decorators' => array(
|
||||||
|
'FormElements',
|
||||||
|
array('HtmlTag', array('tag' => 'dl')),
|
||||||
|
'Fieldset',
|
||||||
|
),
|
||||||
|
'order' =>70,
|
||||||
|
'legend' => $this->translate('State and transition type filters')
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function enumTypeFilters()
|
protected function enumStates()
|
||||||
{
|
{
|
||||||
return array(
|
$set = new StateFilterSet();
|
||||||
$this->translate('State changes') => array(
|
return $set->enumAllowedValues();
|
||||||
'Problem' => $this->translate('Problem'),
|
}
|
||||||
'Recovery' => $this->translate('Recovery'),
|
|
||||||
'Custom' => $this->translate('Custom notification'),
|
protected function enumTypes()
|
||||||
),
|
{
|
||||||
$this->translate('Problem handling') => array(
|
$set = new TypeFilterSet();
|
||||||
'Acknowledgement' => $this->translate('Acknowledgement'),
|
return $set->enumAllowedValues();
|
||||||
'DowntimeStart' => $this->translate('Downtime starts'),
|
|
||||||
'DowntimeEnd' => $this->translate('Downtime ends'),
|
|
||||||
'DowntimeRemoved' => $this->translate('Downtime removed'),
|
|
||||||
),
|
|
||||||
$this->translate('Flapping') => array(
|
|
||||||
'FlappingStart' => $this->translate('Flapping ends'),
|
|
||||||
'FlappingEnd' => $this->translate('Flapping starts')
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function dummyForTranslation()
|
private function dummyForTranslation()
|
||||||
|
|
Loading…
Reference in New Issue