mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
DirectorObjectForm: add a bunch of helper methods
This commit is contained in:
parent
d93e498688
commit
d30d5c51c2
@ -365,9 +365,98 @@ abstract class DirectorObjectForm extends QuickForm
|
|||||||
$this->getElement('command_id')
|
$this->getElement('command_id')
|
||||||
->setMultiOptions($this->optionalEnum($db->enumCommands()));
|
->setMultiOptions($this->optionalEnum($db->enumCommands()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function addZoneElement()
|
||||||
|
{
|
||||||
|
$this->addElement('select', 'zone_id', array(
|
||||||
|
'label' => $this->translate('Cluster Zone'),
|
||||||
|
'description' => $this->translate('Icinga cluster zone'),
|
||||||
|
'multiOptions' => $this->optionalEnum($this->db->enumZones())
|
||||||
|
));
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function addCheckCommandElement()
|
||||||
|
{
|
||||||
|
$this->addElement('select', 'check_command_id', array(
|
||||||
|
'label' => $this->translate('Check command'),
|
||||||
|
'description' => $this->translate('Check command definition'),
|
||||||
|
'multiOptions' => $this->optionalEnum($this->db->enumCheckCommands())
|
||||||
|
));
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function addImportsElement()
|
||||||
|
{
|
||||||
|
$this->addElement('multiselect', 'imports', array(
|
||||||
|
'label' => $this->translate('Imports'),
|
||||||
|
'description' => $this->translate('Importable templates'),
|
||||||
|
'multiOptions' => $this->enumAllowedTemplates(),
|
||||||
|
'class' => 'autosubmit'
|
||||||
|
));
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function addCheckFlagElements()
|
||||||
|
{
|
||||||
|
$this->optionalBoolean(
|
||||||
|
'enable_active_checks',
|
||||||
|
$this->translate('Execute active checks'),
|
||||||
|
$this->translate('Whether to actively check this object')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->optionalBoolean(
|
||||||
|
'enable_passive_checks',
|
||||||
|
$this->translate('Accept passive checks'),
|
||||||
|
$this->translate('Whether to accept passive check results for this object')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->optionalBoolean(
|
||||||
|
'enable_notifications',
|
||||||
|
$this->translate('Send notifications'),
|
||||||
|
$this->translate('Whether to send notifications for this object')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->optionalBoolean(
|
||||||
|
'enable_event_handler',
|
||||||
|
$this->translate('Enable event handler'),
|
||||||
|
$this->translate('Whether to enable event handlers this object')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->optionalBoolean(
|
||||||
|
'enable_perfdata',
|
||||||
|
$this->translate('Process performance data'),
|
||||||
|
$this->translate('Whether to process performance data provided by this object')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->optionalBoolean(
|
||||||
|
'volatile',
|
||||||
|
$this->translate('Volatile'),
|
||||||
|
$this->translate('Whether this check is volatile.')
|
||||||
|
);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function enumAllowedTemplates()
|
||||||
|
{
|
||||||
|
$object = $this->object();
|
||||||
|
$tpl = $this->db->enumIcingaTemplates($object->getShortTableName());
|
||||||
|
$tpl = array_combine($tpl, $tpl);
|
||||||
|
$id = $object->object_name;
|
||||||
|
|
||||||
|
if (array_key_exists($id, $tpl)) {
|
||||||
|
unset($tpl[$id]);
|
||||||
|
}
|
||||||
|
return $tpl;
|
||||||
|
}
|
||||||
|
|
||||||
private function dummyForTranslation()
|
private function dummyForTranslation()
|
||||||
{
|
{
|
||||||
$this->translate('Host');
|
$this->translate('Host');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user