From 7f0ffb16911be59e1d09a011167ec845261c3e21 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 7 Nov 2018 11:07:17 +0100 Subject: [PATCH] IcingaCloneObjectForm: allow to clone a service... ...from one Service set into another one fixes #886 --- application/forms/IcingaCloneObjectForm.php | 21 +++++++++++++++++++++ doc/82-Changelog.md | 2 ++ 2 files changed, 23 insertions(+) diff --git a/application/forms/IcingaCloneObjectForm.php b/application/forms/IcingaCloneObjectForm.php index 0de41cfd..f8de01ac 100644 --- a/application/forms/IcingaCloneObjectForm.php +++ b/application/forms/IcingaCloneObjectForm.php @@ -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; diff --git a/doc/82-Changelog.md b/doc/82-Changelog.md index 1309d812..d27ecba0 100644 --- a/doc/82-Changelog.md +++ b/doc/82-Changelog.md @@ -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)