New menu, still unfinished

This commit is contained in:
Thomas Gelf 2014-02-03 16:03:05 +00:00
parent 3d636423c8
commit 654953d9d6
8 changed files with 195 additions and 92 deletions

View File

@ -2,7 +2,7 @@
<div class="row"> <div class="row">
<!-- Only required for left/right tabs --> <!-- Only required for left/right tabs -->
<div class="col-sm-12 col-xs-12 col-md-2 col-lg-2"> <div class="col-sm-12 col-xs-12 col-md-2 col-lg-2" id="menu">
<?php echo $this->render('parts/navigation.phtml') ?> <?php echo $this->render('parts/navigation.phtml') ?>
</div> </div>

View File

@ -1,38 +1,28 @@
<?= $this->sub ? '<ul>' : '<ul class="nav nav-stacked" role="navigation" id="icinganavigation">' ?> <ul>
<?php foreach ($this->items as $item): ?> <?php
<?php
$itemClass = ''; foreach ($this->items as $item) {
if ($this->sub) {
$itemClass .= 'submenu '; printf(
} ' <li%s><a href="%s">%s%s</a>',
if ($this->href($this->url) === $this->href($item->getUrl())) { $this->href($this->url) === $this->href($item->getUrl()) ? ' class="active"' : '',
$itemClass .= 'active '; $item->getUrl() ? $this->href($item->getUrl()) : '#',
} $item->getIcon() ? $this->img(
?> $item->getIcon(),
<li <?php if (!empty($itemClass)): ?>class="<?= $itemClass ?>"<?php endif ?>> array('height' => '16px', 'width' => '16px')
<?php if($item->getUrl()): ?> ) . ' ' : '',
<a href="<?= $this->href($item->getUrl()); ?>"> $item->getTitle()
<?php endif; ?> );
<?php
if ($icon = $item->getIcon()) { if ($item->hasChildren()) {
echo $this->img($icon, array('height' => '16px', 'width' => '16px'));
}
?>
<?php if ($iconClass = $item->getIconClass()): ?>
<i class="<?= $iconClass ?>"></i>
<?php endif ?>
<?= $item->getTitle();?>
<?php if($item->getUrl()): ?>
</a>
<?php endif; ?>
<?php
if($item->hasChildren()) {
echo $this->partial( echo $this->partial(
'parts/menu.phtml', 'parts/menu.phtml',
array('items' => $item->getChildren(), 'sub' => true, 'url' => $this->url) array('items' => $item->getChildren(), 'url' => $this->url)
); );
} }
?>
</li> echo "</li>\n";
<?php endforeach ?> }
?>
</ul> </ul>

View File

@ -3,15 +3,13 @@
$url = Icinga\Web\Url::fromRequest()->getRelativeUrl(); $url = Icinga\Web\Url::fromRequest()->getRelativeUrl();
$menu = Icinga\Web\Menu::fromConfig(); $menu = Icinga\Web\Menu::fromConfig();
if ($this->auth()->isAuthenticated()): if ($this->auth()->isAuthenticated()) {
echo $this->partial( echo $this->partial(
'parts/menu.phtml', 'parts/menu.phtml',
array( array(
'items' => $menu->getChildren(), 'items' => $menu->getChildren(),
'sub' => false,
'url' => $url 'url' => $url
) )
); );
endif; }
?>

View File

@ -1,7 +1,7 @@
<?php <?php
use Icinga\Web\Topbar; use Icinga\Web\Topbar;
?> ?>
<nav class="navbar navbar-default navbar-fixed-top" id="icingatopbar" role="navigation"> <nav class="navbar-fixed-top" id="icingatopbar" role="navigation">
<div class="navbar-header"> <div class="navbar-header">
<a href="<?= $this->baseUrl('/') ?>" class="navbar-brand icinga-logo">Icinga</a> <a href="<?= $this->baseUrl('/') ?>" class="navbar-brand icinga-logo">Icinga</a>
</div> </div>

View File

@ -1,17 +1,15 @@
[Home]
title = "Home"
url = "/index/welcome"
icon = "/img/icons/down_petrol.png"
priority = 1
[Configuration]
title = "Configuration"
url = "/config/index"
icon_class = "icinga-icon-configuration-petrol"
priority = 2
[Dashboard] [Dashboard]
title = "Dashboard" title = "Dashboard"
url = "/dashboard/index" url = "dashboard"
icon = "/img/icons/dashboard_petrol.png" icon = "img/icons/dashboard.png"
priority = 3 priority = 10
[System]
icon = img/icons/configuration.png
priority = 200
[System.Configuration]
title = "Configuration"
url = "config/index"

View File

@ -1,43 +1,76 @@
[Hosts]
[Problems]
priority = 20
icon = "img/icons/error.png"
[Problems.Unhandled Hosts]
icon = "img/icons/host.png"
priority = 50
url = "monitoring/list/hosts?host_problem=1&host_handled=0"
[Problems.Unhandled Services]
icon = "img/icons/service.png"
priority = 50
url = "monitoring/list/services?service_problem=1&service_handled=0"
[Problems.Current Downtimes]
url = "monitoring/list/downtimes?downtime_is_in_effect=1"
icon = "img/icons/down.png"
[Overview]
priority = 30
icon = "img/icons/hostgroup.png"
[Overview.Hosts]
title = "Hosts" title = "Hosts"
url = "/monitoring/list/hosts" url = "monitoring/list/hosts"
icon_class = "icinga-icon-host-petrol" icon = "img/icons/host.png"
priority = 50
[Services] [Overview.Services]
title = "Services" title = "Services"
url = "/monitoring/list/services" url = "monitoring/list/services"
icon_class = "icinga-icon-service-petrol" icon = "img/icons/service.png"
priority = 50
[Downtimes] [Overview.Servicegroups]
title = "Downtimes"
url = "/monitoring/list/downtimes"
icon_class = "icinga-icon-down-petrol"
[Notifications]
title = "Notifications"
url = "/monitoring/list/notifications"
icon_class = "icinga-icon-notification-petrol"
[Comments]
title = "Comments"
url = "/monitoring/list/comments"
icon_class = "icinga-icon-comment-petrol"
[Servicegroups]
title = "Servicegroups" title = "Servicegroups"
url = "/monitoring/list/servicegroups" url = "monitoring/list/servicegroups"
icon_class = "icinga-icon-servicegroup-petrol" icon = "img/icons/servicegroup.png"
priority = 60
[Hostgroups] [Overview.Hostgroups]
title = "Hostgroups" title = "Hostgroups"
url = "/monitoring/list/hostgroups" url = "monitoring/list/hostgroups"
icon_class = "icinga-icon-hostgroup-petrol" icon = "img/icons/hostgroup.png"
priority = 60
[Overview.Downtimes]
title = "Downtimes"
url = "monitoring/list/downtimes"
icon = "img/icons/down.png"
priority = 70
[Overview.Comments]
title = "Comments"
url = "monitoring/list/comments"
icon = "img/icons/comment.png"
priority = 70
[History] [History]
title = "History" icon = "img/icons/history.png"
url = "/monitoring/list/eventhistory"
icon_class = "icinga-icon-history-petrol"
[Performance] [History.Notifications]
title = "Notifications"
url = "monitoring/list/notifications"
icon = "img/icons/notification.png"
[History.Events]
title = "All Events"
url = "monitoring/list/eventhistory"
icon = "img/icons/history.png"
[System.Performance]
title = "Performance" title = "Performance"
url = "/monitoring/process/performance" url = "monitoring/process/performance"

View File

@ -0,0 +1,76 @@
#menu {
background: #999;
}
#menu a {
color: #121212;
}
#menu .separator {
background-color: #888;
}
#menu li {
margin-left: 0.5em;
margin-right: 0.5em;
}
#menu > ul > li {
border-bottom: 2em solid #888;
}
#menu > ul > li.active {
background-color: white;
padding-left: 0.5em;
margin-left: 0;
margin-right: 0;
}
#menu > ul > li.active > a {
color: #121212;
}
#menu > ul > li {
border-bottom: 0.12em solid #888;
}
#menu > ul > li li {
font-size: 0.8em;
padding-left: 1.875em;
}
/* Collapsed menu item color */
#menu > ul > li > a {
color: #f5f5f5;
}
/* Sub item color */
#menu .active ul li a {
color: #a6a6a6;
}
#menu ul {
list-style-type: none;
padding: 0;
}
#menu ul li a {
display: block;
line-height: 2.5em;
padding-left: 0.7em;
text-decoration: none;
}
#menu > ul > li img {
width: 1em;
height: 1em;
border: none;
margin-bottom: -0.125em;
margin-right: 0.5em;
}
#menu ul ul li a {
line-height: 1em;
margin-bottom: 1em;
}

View File

@ -0,0 +1,8 @@
#icingatopbar {
background-color: #555;
color: #d0d0d0;
}
#icingatopbar .nav a {
color: #d0d0d0;
}