[icinga-checkins] icinga.org: icingaweb2-module-director/master: objects/tree: enable autorefresh...

git at icinga.org git at icinga.org
Tue Aug 23 18:03:34 CEST 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Tue Aug 23 15:11:42 2016 +0000

objects/tree: enable autorefresh...

...and some coding style fixes

fixes #12451

---

 application/controllers/ServicesController.php        |    9 +++++++++
 library/Director/Web/Controller/ObjectsController.php |    9 ++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/application/controllers/ServicesController.php b/application/controllers/ServicesController.php
index 8afe209..47bd27a 100644
--- a/application/controllers/ServicesController.php
+++ b/application/controllers/ServicesController.php
@@ -6,4 +6,13 @@ use Icinga\Module\Director\Web\Controller\ObjectsController;
 
 class ServicesController extends ObjectsController
 {
+    public function indexAction()
+    {
+        $r = $this->getRequest();
+        if ($r->getActionName() !== 'templates' && ! $this->getRequest()->isApiRequest()) {
+            $this->redirectNow('director/services/templates');
+        }
+
+        return parent::indexAction();
+    }
 }
diff --git a/library/Director/Web/Controller/ObjectsController.php b/library/Director/Web/Controller/ObjectsController.php
index 2f29bef..432d52d 100644
--- a/library/Director/Web/Controller/ObjectsController.php
+++ b/library/Director/Web/Controller/ObjectsController.php
@@ -86,7 +86,7 @@ abstract class ObjectsController extends ActionController
             if ($dummy->isGroup()) {
                 $this->getTabs()->activate('objectgroups');
                 $table = 'icinga' . ucfirst($type);
-            } else if ($dummy->isTemplate()) {
+            } elseif ($dummy->isTemplate()) {
                 $this->getTabs()->activate('templates');
                 $table = 'icinga' . ucfirst($type);
             } else {
@@ -110,8 +110,7 @@ abstract class ObjectsController extends ActionController
             $addParams = array('type' => 'object');
             $title = $this->translate('Icinga ' . ucfirst($ltype) . 's');
             $addTitle = $this->translate('Add %s');
-            if (
-                $dummy->supportsImports()
+            if ($dummy->supportsImports()
                 && array_key_exists('object_type', $table->getColumns())
                 && ! in_array(ucfirst($type), $this->globalTypes)
             ) {
@@ -204,6 +203,7 @@ abstract class ObjectsController extends ActionController
 
     public function templatetreeAction()
     {
+        $this->setAutorefreshInterval(10);
         $this->getTabs()->activate('tree');
         $this->view->tree = $this->db()->fetchTemplateTree(strtolower($this->getType()));
         $this->view->objectTypeName = $this->getType();
@@ -216,8 +216,7 @@ abstract class ObjectsController extends ActionController
             $class = $this->getObjectClassname();
             $this->dummy = $class::create(array());
             if ($this->dummy->hasProperty('object_type')) {
-                if (
-                    strpos($this->getRequest()->getControllerName(), 'template') !== false
+                if (strpos($this->getRequest()->getControllerName(), 'template') !== false
                     || strpos($this->getRequest()->getActionName(), 'templates') !== false
                 ) {
                     $this->dummy->object_type = 'template';



More information about the icinga-checkins mailing list