IcingaCloneObjectForm: allow to clone a service...

...from one Service set into another one

fixes #886
This commit is contained in:
Thomas Gelf 2018-11-07 11:07:17 +01:00
parent cf161f480c
commit 7f0ffb1691
2 changed files with 23 additions and 0 deletions

View File

@ -55,6 +55,17 @@ class IcingaCloneObjectForm extends DirectorForm
], 'y');
}
if ($this->object instanceof IcingaService && $this->object->get('service_set_id') !== null) {
$this->addElement('select', 'target_service_set', [
'label' => $this->translate('Target Service Set'),
'description' => $this->translate(
'Clone this service to the very same or to another Service Set'
),
'multiOptions' => $this->enumServiceSets(),
'value' => $this->object->get('service_set_id')
]);
}
if ($this->object->isTemplate() && $this->object->supportsFields()) {
$this->addBoolean('clone_fields', [
'label' => $this->translate('Clone Template Fields'),
@ -172,6 +183,16 @@ class IcingaCloneObjectForm extends DirectorForm
}
}
protected function enumServiceSets()
{
$db = $this->object->getConnection()->getDbAdapter();
return $db->fetchPairs(
$db->select()
->from('icinga_service_set', ['id', 'object_name'])
->order('object_name')
);
}
public function setObject(IcingaObject $object)
{
$this->object = $object;

View File

@ -19,6 +19,8 @@ master (will be 1.6.0)
* FEATURE: allow to show SQL used for template tables
* FEATURE: allow to defined Service Groups for Set members and for Services
assigned to Host Templates (#619)
* FEATURE: it's now possible to choose another target Service Set when cloning
a member service (#886)
### Import and Sync
* FEATURE: new Property Modifier allows to extract specific Array values (#473)