[icinga-checkins] icinga.org: icingaweb2-module-director/master: IcingaServiceSet: improve work with imports

git at icinga.org git at icinga.org
Thu Oct 27 18:37:05 CEST 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Thu Oct 20 07:22:08 2016 +0000

IcingaServiceSet: improve work with imports

---

 application/controllers/ServicesetController.php        |   10 ++++++++++
 application/tables/IcingaServiceSetTable.php            |    2 +-
 library/Director/Objects/IcingaObjectMultiRelations.php |    5 +++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/application/controllers/ServicesetController.php b/application/controllers/ServicesetController.php
index 2f230f1..dbafac3 100644
--- a/application/controllers/ServicesetController.php
+++ b/application/controllers/ServicesetController.php
@@ -19,6 +19,16 @@ class ServicesetController extends ObjectController
         parent::init();
     }
 
+    public function loadForm($name)
+    {
+        $form = parent::loadForm($name);
+        if ($name === 'icingaServiceSet' && $this->host) {
+            $form->setHost($this->host);
+        }
+
+        return $form;
+    }
+
     protected function loadObject()
     {
         if ($this->object === null) {
diff --git a/application/tables/IcingaServiceSetTable.php b/application/tables/IcingaServiceSetTable.php
index bd612d5..5a33b7b 100644
--- a/application/tables/IcingaServiceSetTable.php
+++ b/application/tables/IcingaServiceSetTable.php
@@ -50,7 +50,7 @@ class IcingaServiceSetTable extends IcingaObjectTable
             array('h' => 'icinga_host'),
             'h.id = sset.host_id',
             array()
-        )->order('sset.object_name');
+        )->where('sset.object_type = ?', 'template')->order('sset.object_name');
 
         return $query;
     }
diff --git a/library/Director/Objects/IcingaObjectMultiRelations.php b/library/Director/Objects/IcingaObjectMultiRelations.php
index 5a5593a..5413d75 100644
--- a/library/Director/Objects/IcingaObjectMultiRelations.php
+++ b/library/Director/Objects/IcingaObjectMultiRelations.php
@@ -40,6 +40,11 @@ class IcingaObjectMultiRelations implements Iterator, Countable, IcingaConfigRen
         $this->relatedObjectClass = $relatedObjectClass;
     }
 
+    public function getObjects()
+    {
+        return $this->relations;
+    }
+
     public function count()
     {
         return count($this->relations);



More information about the icinga-checkins mailing list