mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-01-27 14:19:17 -05:00
Remove badge container, when there is no conent
This commit is contained in:
parent
b9102b21e9
commit
fffdffbe63
1 changed files with 24 additions and 17 deletions
|
|
@ -126,9 +126,7 @@ abstract class Renderer extends Html
|
|||
*/
|
||||
public function renderStateBadges($summary)
|
||||
{
|
||||
$container = Container::create(
|
||||
array('class' => 'badges')
|
||||
)/* ->renderIfEmpty(false) */;
|
||||
$elements = [];
|
||||
|
||||
foreach ($summary as $state => $cnt) {
|
||||
if ($cnt === 0
|
||||
|
|
@ -138,22 +136,31 @@ abstract class Renderer extends Html
|
|||
continue;
|
||||
}
|
||||
|
||||
$container->addContent(
|
||||
Element::create(
|
||||
'span',
|
||||
array(
|
||||
'class' => array(
|
||||
'badge',
|
||||
'badge-' . strtolower($state)
|
||||
),
|
||||
// TODO: We should translate this in this module
|
||||
'title' => mt('monitoring', $state)
|
||||
)
|
||||
)->setContent($cnt)
|
||||
);
|
||||
$elements[] = Element::create(
|
||||
'span',
|
||||
array(
|
||||
'class' => array(
|
||||
'badge',
|
||||
'badge-' . strtolower($state)
|
||||
),
|
||||
// TODO: We should translate this in this module
|
||||
'title' => mt('monitoring', $state)
|
||||
)
|
||||
)->setContent($cnt);
|
||||
}
|
||||
|
||||
return $container;
|
||||
if (!empty($elements)) {
|
||||
$container = Container::create(
|
||||
array('class' => 'badges')
|
||||
)/* ->renderIfEmpty(false) */;
|
||||
|
||||
foreach ($elements as $element) {
|
||||
$container->addContent($element);
|
||||
}
|
||||
|
||||
return $container;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getNodeClasses(Node $node)
|
||||
|
|
|
|||
Loading…
Reference in a new issue