Merge pull request #3835 from Icinga/fix/problem-badges-not-visible-if-sidebar-is-collapsed-3568

ui: Show problem badges in collapsed sidebar
This commit is contained in:
Johannes Meyer 2019-07-11 08:00:12 +02:00 committed by GitHub
commit 801a6719b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 2 deletions

View File

@ -113,6 +113,12 @@ abstract class BadgeNavigationItemRenderer extends NavigationItemRenderer
protected function renderBadge()
{
if ($count = $this->getCount()) {
if ($count > 1000000) {
$count = round($count, -6) / 1000000 . 'M';
} elseif ($count > 1000) {
$count = round($count, -3) / 1000 . 'k';
}
$view = $this->view();
return sprintf(
'<span title="%s" class="badge state-%s">%s</span>',

View File

@ -294,8 +294,24 @@ html.no-js .controls > .tabs {
}
#menu {
.badge {
display: none;
.nav-level-1 {
> .badge-nav-item > a {
position: relative;
> .badge {
position: absolute;
right: .5em;
bottom: .25em;
font-size: 75%;
overflow: hidden;
text-overflow: ellipsis;
max-width: 4em;
}
}
> .nav-item.active > a > .badge {
display: unset;
}
}
img.icon {