[icinga-checkins] icinga.org: icingaweb2-module-director/feature/icinga1-config-12919: IndexController(Legacy): Grey out unsupported object tiles

git at icinga.org git at icinga.org
Wed Oct 19 12:59:47 CEST 2016


Module: icingaweb2-module-director
Branch: feature/icinga1-config-12919
Commit: b51eed4d6a6b78497e48a136d00cd23676910659
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=b51eed4d6a6b78497e48a136d00cd23676910659

Author: Markus Frosch <markus.frosch at icinga.com>
Date:   Wed Oct 19 12:59:37 2016 +0200

IndexController(Legacy): Grey out unsupported object tiles

refs #12919

---

 application/controllers/IndexController.php   |    2 ++
 application/views/scripts/index/actions.phtml |    2 +-
 application/views/scripts/index/index.phtml   |   16 ++++++++++++----
 public/css/module.less                        |    4 ++++
 4 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php
index 319296e..dd27fa4 100644
--- a/application/controllers/IndexController.php
+++ b/application/controllers/IndexController.php
@@ -50,6 +50,8 @@ class IndexController extends ActionController
             } catch (Exception $e) {
             }
         }
+
+        $this->view->legacyConfig = $this->IcingaConfig()->isLegacy();
     }
 
     protected function fetchSyncState()
diff --git a/application/views/scripts/index/actions.phtml b/application/views/scripts/index/actions.phtml
index a59992a..a5e4977 100644
--- a/application/views/scripts/index/actions.phtml
+++ b/application/views/scripts/index/actions.phtml
@@ -3,7 +3,7 @@
 <?php foreach ($actions as $a): ?>
 <li>
   <a<?php
-if (array_key_exists(4, $a)) {
+if (array_key_exists(4, $a) && $a[4]) {
   echo ' class="state-' . $a[4] . '"';
 }
 ?> href="<?= $this->url($a[2]) ?>">
diff --git a/application/views/scripts/index/index.phtml b/application/views/scripts/index/index.phtml
index 4b290d6..9f0ac05 100644
--- a/application/views/scripts/index/index.phtml
+++ b/application/views/scripts/index/index.phtml
@@ -89,6 +89,11 @@ if ($this->migrationsForm) {
     echo $this->migrationsForm;
 }
 
+$legacyClass = null;
+if ($this->legacyConfig === true) {
+    $legacyClass = 'legacy';
+}
+
 $all = array(
     $this->translate('Define whatever you want to be monitored') => array(
         array(
@@ -113,13 +118,15 @@ $all = array(
             'users',
             $this->translate('Users / Contacts'),
             'director/users',
-            statSummary($this, 'user')
+            statSummary($this, 'user'),
+            $legacyClass
         ),
         array(
             'megaphone',
             $this->translate('Notifications'),
             'director/notifications',
-            $this->translate('Schedule your notifications.') . ' ' . statSummary($this, 'notification')
+            $this->translate('Schedule your notifications.') . ' ' . statSummary($this, 'notification'),
+            $legacyClass
         ),
         array(
             'calendar',
@@ -147,7 +154,8 @@ $all = array(
             'lock-open-alt',
             $this->translate('Api users'),
             'director/apiusers',
-            statSummary($this, 'apiuser')
+            statSummary($this, 'apiuser'),
+            $legacyClass
         ),
         array(
             'cloud',
@@ -158,7 +166,7 @@ $all = array(
                 $this->hasDeploymentEndpoint ? '' : '. ' .
                 $this->translate('None could be used for deployments right now')
             ),
-            $this->hasDeploymentEndpoint ? '' : 'critical'
+            $this->hasDeploymentEndpoint ? $legacyClass : 'critical'
         ),
         array(
             'globe',
diff --git a/public/css/module.less b/public/css/module.less
index f4f3110..fd7e77e 100644
--- a/public/css/module.less
+++ b/public/css/module.less
@@ -436,6 +436,10 @@ a {
     &.state-pending {
         color: @color-pending;
     }
+
+    &.state-legacy {
+      color: #ccc !important;
+    }
 }
 
 a:hover::before {



More information about the icinga-checkins mailing list