[icinga-checkins] icinga.org: icingaweb2-module-director/feature/nested-apply-rules-12033: IcingaEndpointForm: Render imports input only when set

git at icinga.org git at icinga.org
Fri Oct 21 10:08:04 CEST 2016


Module: icingaweb2-module-director
Branch: feature/nested-apply-rules-12033
Commit: 255a02cf3638667cb2c54aef789b46736edea110
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=255a02cf3638667cb2c54aef789b46736edea110

Author: Markus Frosch <markus.frosch at icinga.com>
Date:   Thu Oct 13 16:39:55 2016 +0200

IcingaEndpointForm: Render imports input only when set

We don't need Endpoint templates in GUI.

refs #12920

---

 application/forms/IcingaEndpointForm.php |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/application/forms/IcingaEndpointForm.php b/application/forms/IcingaEndpointForm.php
index a20b4a9..1c08cb4 100644
--- a/application/forms/IcingaEndpointForm.php
+++ b/application/forms/IcingaEndpointForm.php
@@ -47,8 +47,14 @@ class IcingaEndpointForm extends DirectorObjectForm
             'multiOptions' => $this->optionalEnum($this->db->enumApiUsers())
         ));
 
-        $this->addZoneElement()
-            ->addImportsElement();
+        $this->addZoneElement();
+
+        if ($this->object->hasBeenLoadedFromDb()) {
+            $imports = $this->object->get('imports');
+            if ($imports !== null && count($imports) > 0) {
+                $this->addImportsElement(false);
+            }
+        }
 
         $this->setButtons();
     }



More information about the icinga-checkins mailing list