Skip to content

Commit 69d4bac

Browse files
committed
Add header link for host donut chart
Add link on the header that opens the list that the host donut chart in the tactical overview represents considering the active filters.
1 parent fa23e86 commit 69d4bac

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

library/Icingadb/Widget/HostSummaryDonut.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,24 @@ protected function assembleFooter(BaseHtmlElement $footer)
6666

6767
protected function assembleHeader(BaseHtmlElement $header)
6868
{
69+
$filter = Filter::all();
70+
71+
if ($this->hasBaseFilter()) {
72+
$filter->add($this->getBaseFilter());
73+
}
74+
75+
$attributes = Attributes::create(['href' => Links::hosts()->setFilter($filter)]);
76+
6977
$header->addHtml(
70-
new HtmlElement('h2', null, Text::create(t('Hosts'))),
71-
new HtmlElement('span', Attributes::create(['class' => 'meta']), TemplateString::create(
72-
t('{{#total}}Total{{/total}} %d'),
73-
['total' => new HtmlElement('span')],
74-
(int) $this->summary->hosts_total
78+
new HtmlElement('a', $attributes, new HtmlElement('h2', null, Text::create(t('Hosts')))),
79+
new HtmlElement('a', $attributes, new HtmlElement(
80+
'span',
81+
Attributes::create(['class' => 'meta']),
82+
TemplateString::create(
83+
t('{{#total}}Total{{/total}} %d'),
84+
['total' => new HtmlElement('span')],
85+
(int) $this->summary->hosts_total
86+
)
7587
))
7688
);
7789
}

0 commit comments

Comments
 (0)