From f188bf6b9cbe279bb4b822683df2ead0e8636c97 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Wed, 1 Oct 2014 09:24:52 +0200 Subject: [PATCH] Make "hosts" and "services" views responsive --- .../controllers/HostsController.php | 7 +++ .../controllers/ServicesController.php | 7 +++ .../views/scripts/hosts/show.phtml | 41 ++++++------ .../views/scripts/services/show.phtml | 62 +++++++++---------- public/css/icinga/layout-structure.less | 18 ++++++ 5 files changed, 78 insertions(+), 57 deletions(-) diff --git a/modules/monitoring/application/controllers/HostsController.php b/modules/monitoring/application/controllers/HostsController.php index 8298f456b..48b068705 100644 --- a/modules/monitoring/application/controllers/HostsController.php +++ b/modules/monitoring/application/controllers/HostsController.php @@ -43,6 +43,13 @@ class Monitoring_HostsController extends Controller public function showAction() { + $this->getTabs()->add( + 'show', + array( + 'title' => t('Hosts'), + 'url' => Url::fromRequest() + ) + )->activate('show'); $this->setAutorefreshInterval(15); $checkNowForm = new CheckNowCommandForm(); $checkNowForm diff --git a/modules/monitoring/application/controllers/ServicesController.php b/modules/monitoring/application/controllers/ServicesController.php index 633ff521b..c421ed881 100644 --- a/modules/monitoring/application/controllers/ServicesController.php +++ b/modules/monitoring/application/controllers/ServicesController.php @@ -43,6 +43,13 @@ class Monitoring_ServicesController extends Controller public function showAction() { + $this->getTabs()->add( + 'show', + array( + 'title' => t('Services'), + 'url' => Url::fromRequest() + ) + )->activate('show'); $this->setAutorefreshInterval(15); $checkNowForm = new CheckNowCommandForm(); $checkNowForm diff --git a/modules/monitoring/application/views/scripts/hosts/show.phtml b/modules/monitoring/application/views/scripts/hosts/show.phtml index 14d160c1e..e43198780 100644 --- a/modules/monitoring/application/views/scripts/hosts/show.phtml +++ b/modules/monitoring/application/views/scripts/hosts/show.phtml @@ -5,26 +5,23 @@ translate('No hosts matching the filter') ?> -

translate('Summary For %u Hosts'), count($objects)) ?>

- - - - - - - - -
translate('%u Hosts'), array_sum(array_values($hostStates))) ?>
- hostStatesPieChart ?> - - + translate('Hosts (%u)'), array_sum(array_values($hostStates))) ?> + +
+ hostStatesPieChart ?> +
+
+ $count) { + echo sprintf('%s: %u
', strtoupper($text), $count); + } ?> +
- foreach (array_filter($hostStates) as $text => $count) { - echo sprintf('%s: %u
', strtoupper($text), $count); - } - - ?> -
+

+ translate('%u Hosts'), + count($objects)) + ?> +

@@ -32,8 +29,6 @@
-
-
@@ -53,7 +48,7 @@ -

+

translatePlural( '%u Unhandled Host Problem', @@ -62,7 +57,7 @@ ), count($unhandledObjects) ) ?> -

+
diff --git a/modules/monitoring/application/views/scripts/services/show.phtml b/modules/monitoring/application/views/scripts/services/show.phtml index 4d5d46e05..802aa8ef6 100644 --- a/modules/monitoring/application/views/scripts/services/show.phtml +++ b/modules/monitoring/application/views/scripts/services/show.phtml @@ -5,39 +5,34 @@ translate('No services matching the filter') ?> -

translate('Summary For %u Services'), count($objects)) ?>

- - - - - - - - - - - -
translate('%u Services'), array_sum(array_values($serviceStates))) ?>translate('%u Hosts'), array_sum(array_values($hostStates))) ?>
- serviceStatesPieChart ?> - - $count) { - echo sprintf('%s: %u
', strtoupper($text), $count); - } +
+
+ translate('Services (%u)'), array_sum(array_values($serviceStates))) ?> +
+
+ serviceStatesPieChart ?> +
+
+ $count) { + echo sprintf(' %s: %u
', strtoupper($text), $count); + } ?> +
+
- ?> -
- hostStatesPieChart ?> - - $count) { - echo sprintf('%s: %u
', strtoupper($text), $count); - } - - ?> -
+
+
+ translate('Hosts (%u)'), array_sum(array_values($hostStates))) ?> +
+
+ hostStatesPieChart ?> +
+
+ $count) { + echo sprintf('%s: %u
', strtoupper($text), $count); + } ?> +
+
@@ -45,7 +40,6 @@
-
@@ -66,7 +60,7 @@
-

+

translatePlural( '%u Unhandled Service Problem', @@ -75,7 +69,7 @@ ), count($unhandledObjects) ) ?> -

+
diff --git a/public/css/icinga/layout-structure.less b/public/css/icinga/layout-structure.less index 6319e65d1..be8a8703f 100644 --- a/public/css/icinga/layout-structure.less +++ b/public/css/icinga/layout-structure.less @@ -331,3 +331,21 @@ html { font-weight: bold; color: white; } + +.hbox { + display: inline-block; +} + +.hbox-item { + display: inline-block; + vertical-align: top; + margin-bottom: 0.25em; + margin-left: 1em; + margin-right: 1em; +} + +.hbox-spacer { + display: inline-block; + vertical-align: top; + width: 2em; +}