mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 00:34:05 +02:00
Forms: centralize groups property loading
This commit is contained in:
parent
a25bb80004
commit
b15e814151
@ -97,11 +97,4 @@ class IcingaHostForm extends DirectorObjectForm
|
||||
|
||||
$this->addElement('submit', $this->translate('Store'));
|
||||
}
|
||||
|
||||
public function loadObject($id)
|
||||
{
|
||||
parent::loadObject($id);
|
||||
$this->getElement('groups')->setValue(implode(', ', $this->object->groups()->listGroupNames()));
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@ -80,6 +80,11 @@ class IcingaServiceForm extends DirectorObjectForm
|
||||
'description' => $this->translate('Check this host in this specific Icinga cluster zone')
|
||||
));
|
||||
|
||||
$this->addElement('text', 'groups', array(
|
||||
'label' => $this->translate('Servicegroups'),
|
||||
'description' => $this->translate('One or more comma separated servicegroup names')
|
||||
));
|
||||
|
||||
$this->addElement('submit', $this->translate('Store'));
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,11 @@ class IcingaUserForm extends DirectorObjectForm
|
||||
'description' => $this->translate('Check this user in this specific Icinga cluster zone')
|
||||
));
|
||||
|
||||
$this->addElement('text', 'groups', array(
|
||||
'label' => $this->translate('Usergroups'),
|
||||
'description' => $this->translate('One or more comma separated usergroup names')
|
||||
));
|
||||
|
||||
$this->addElement('submit', $this->translate('Store'));
|
||||
}
|
||||
}
|
||||
|
@ -116,6 +116,11 @@ abstract class DirectorObjectForm extends QuickForm
|
||||
$this->addHidden('id');
|
||||
}
|
||||
$this->setDefaults($this->object->getProperties());
|
||||
if ($this->object->supportsGroups()) {
|
||||
$this->getElement('groups')->setValue(
|
||||
implode(', ', $this->object->groups()->listGroupNames())
|
||||
);
|
||||
]
|
||||
|
||||
if ($this->object->supportsCustomVars()) {
|
||||
foreach ($this->object->vars() as $key => $value) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user