mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-06-04 22:32:51 -04:00
ProblemsBadge: Render a StateBall in badge links
This commit is contained in:
parent
2b3f369729
commit
dfccb2f125
1 changed files with 8 additions and 5 deletions
|
|
@ -7,6 +7,7 @@ namespace Icinga\Module\Icingadb\Web\Navigation\Renderer;
|
|||
use Exception;
|
||||
use Icinga\Application\Logger;
|
||||
use Icinga\Module\Icingadb\Common\Database;
|
||||
use Icinga\Module\Icingadb\Widget\StateBadge;
|
||||
use Icinga\Web\Navigation\NavigationItem;
|
||||
use Icinga\Web\Navigation\Renderer\NavigationItemRenderer;
|
||||
use ipl\Html\HtmlDocument;
|
||||
|
|
@ -111,7 +112,7 @@ abstract class ProblemsBadge extends NavigationItemRenderer
|
|||
$item = $this->getItem();
|
||||
}
|
||||
|
||||
$item->setCssClass('badge-nav-item');
|
||||
$item->setCssClass('badge-nav-item icinga-module module-icingadb');
|
||||
|
||||
return (new HtmlDocument())
|
||||
->add(new HtmlString(parent::render($item)))
|
||||
|
|
@ -124,10 +125,12 @@ abstract class ProblemsBadge extends NavigationItemRenderer
|
|||
$count = $this->getProblemsCount();
|
||||
|
||||
if ($count) {
|
||||
return new Link($count, $this->getUrl(), [
|
||||
'class' => sprintf('badge state-%s', $this->getState()),
|
||||
'title' => $this->getTitle()
|
||||
]);
|
||||
return new Link(
|
||||
(new StateBadge($count, $this->getState()))
|
||||
->addAttributes(['class' => 'badge']),
|
||||
$this->getUrl(),
|
||||
['title' => $this->getTitle()]
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Reference in a new issue