From a83a9cef03214693339302ba5bc6cd34f9aa4100 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 20 Nov 2017 13:55:12 +0100 Subject: [PATCH] Introduce dashboard for navigation items --- .../controllers/NavigationController.php | 22 ++++++++ .../views/scripts/navigation/dashboard.phtml | 16 ++++++ public/css/icinga/widgets.less | 50 +++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 application/views/scripts/navigation/dashboard.phtml diff --git a/application/controllers/NavigationController.php b/application/controllers/NavigationController.php index 1d2d39f68..67c249a33 100644 --- a/application/controllers/NavigationController.php +++ b/application/controllers/NavigationController.php @@ -5,6 +5,7 @@ namespace Icinga\Controllers; use Exception; use Icinga\Application\Config; +use Icinga\Application\Icinga; use Icinga\Exception\NotFoundError; use Icinga\Data\DataArray\ArrayDatasource; use Icinga\Data\Filter\FilterMatchCaseInsensitive; @@ -407,4 +408,25 @@ class NavigationController extends Controller $this->httpNotFound(sprintf($this->translate('Navigation item "%s" not found'), $form->getValue('name'))); } } + + public function dashboardAction() + { + $name = $this->params->getRequired('name'); + + $this->getTabs()->add('dashboard', array( + 'active' => true, + 'label' => ucwords($name), + 'url' => Url::fromRequest() + )); + + $menu = Icinga::app()->getMenu(); + + $navigation = $menu->findItem($name); + + if ($navigation === null) { + $this->httpNotFound($this->translate('Navigation not found')); + } + + $this->view->navigation = $navigation; + } } diff --git a/application/views/scripts/navigation/dashboard.phtml b/application/views/scripts/navigation/dashboard.phtml new file mode 100644 index 000000000..4f1d5c290 --- /dev/null +++ b/application/views/scripts/navigation/dashboard.phtml @@ -0,0 +1,16 @@ +
+ +
+
+ + + + + + +
diff --git a/public/css/icinga/widgets.less b/public/css/icinga/widgets.less index 13f83ac03..610c976ce 100644 --- a/public/css/icinga/widgets.less +++ b/public/css/icinga/widgets.less @@ -44,6 +44,56 @@ } } +.dashboard-link { + .clearfix(); + display: block; + max-width: 100%; + vertical-align: middle; + padding: 1em; + width: 36em; + + &:hover { + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; + + -webkit-box-shadow: 0 0 0.5em 0 rgba(0, 0, 0, 0.2); + -moz-box-shadow: 0 0 0.5em 0 rgba(0, 0, 0, 0.2); + box-shadow: 0 0 0.5em 0 rgba(0, 0, 0, 0.2); + + background-color: @tr-hover-color; + text-decoration: none; + } +} + +.link-meta { + display: table-cell; + vertical-align: middle; +} + +.link-label { + font-weight: @font-weight-bold; +} + +.link-description { + color: @text-color-light; +} + +.link-icon { + display: table-cell; + padding-right: .5em; + vertical-align: middle; + + > i { + font-size: 3em; + opacity: 0.7; + } +} + table.historycolorgrid { font-size: 1.5em; }