mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-30 17:24:16 +02:00
BadgeNavigationItemRenderer: Round counts to the neareset base
refs #3568
This commit is contained in:
parent
e992eb6b26
commit
f0b5d8fd8e
@ -113,6 +113,12 @@ abstract class BadgeNavigationItemRenderer extends NavigationItemRenderer
|
|||||||
protected function renderBadge()
|
protected function renderBadge()
|
||||||
{
|
{
|
||||||
if ($count = $this->getCount()) {
|
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();
|
$view = $this->view();
|
||||||
return sprintf(
|
return sprintf(
|
||||||
'<span title="%s" class="badge state-%s">%s</span>',
|
'<span title="%s" class="badge state-%s">%s</span>',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user