[icinga-checkins] icinga.org: icingaweb2-module-director/master: ServiceController: fix issue with hidden feature

git at icinga.org git at icinga.org
Mon Jan 2 11:10:08 CET 2017


Module: icingaweb2-module-director
Branch: master
Commit: 4501935040d18199cd61c1c720ebfb3ed2edccc8
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=4501935040d18199cd61c1c720ebfb3ed2edccc8

Author: Thomas Gelf <thomas at gelf.net>
Date:   Mon Jan  2 11:09:15 2017 +0100

ServiceController: fix issue with hidden feature

Services imported with use_var_overrides used to throw an error since we
introduced the new template resolver

---

 application/controllers/ServiceController.php |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php
index 14217ae..d61c232 100644
--- a/application/controllers/ServiceController.php
+++ b/application/controllers/ServiceController.php
@@ -118,7 +118,8 @@ class ServiceController extends ObjectController
 
             $parent = IcingaService::create(array(
                 'object_type' => 'template',
-                'object_name' => 'myself',
+                // TODO: => 'myself', -> There is no such import: "myself"
+                'object_name' => $object->object_name,
                 'vars'        => $object->vars,
             ), $this->db());
 
@@ -126,8 +127,16 @@ class ServiceController extends ObjectController
             $object->imports()->add($parent);
         }
 
-        parent::editAction();
+        $this->getTabs()->activate('modify');
 
+        $this->view->form = $form = $this->loadForm('icingaService')
+            ->setDb($this->db())
+            ->setObject($object);
+
+        $this->view->form->handleRequest();
+        $this->view->actionLinks = $this->createCloneLink();
+
+        $this->view->title = $object->object_name;
         if ($this->host) {
             $this->view->subtitle = sprintf(
                 $this->translate('(on %s)'),
@@ -150,6 +159,8 @@ class ServiceController extends ObjectController
         } catch (Exception $e) {
             // ignore the error, show no apply link
         }
+
+        $this->setViewScript('object/form');
     }
 
     public function assignAction()



More information about the icinga-checkins mailing list