From b69bbe50206da47afed3d68566e5665483233cb7 Mon Sep 17 00:00:00 2001 From: Johannes Rauh Date: Tue, 5 Aug 2025 10:48:09 +0200 Subject: [PATCH 1/3] Add header link for host donut chart Add an action link on the total hosts number that opens the list that the host donut chart in the tactical overview represents considering the active filters. --- library/Icingadb/Widget/HostSummaryDonut.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/library/Icingadb/Widget/HostSummaryDonut.php b/library/Icingadb/Widget/HostSummaryDonut.php index 5efcf74d..db217795 100644 --- a/library/Icingadb/Widget/HostSummaryDonut.php +++ b/library/Icingadb/Widget/HostSummaryDonut.php @@ -16,7 +16,7 @@ use ipl\Html\Text; use ipl\Stdlib\BaseFilter; use ipl\Stdlib\Filter; use ipl\Web\Common\Card; -use ipl\Web\Filter\QueryString; +use ipl\Web\Widget\ActionLink; class HostSummaryDonut extends Card { @@ -66,12 +66,21 @@ class HostSummaryDonut extends Card protected function assembleHeader(BaseHtmlElement $header) { + $filter = Filter::all(); + + if ($this->hasBaseFilter()) { + $filter->add($this->getBaseFilter()); + } + $header->addHtml( new HtmlElement('h2', null, Text::create(t('Hosts'))), new HtmlElement('span', Attributes::create(['class' => 'meta']), TemplateString::create( - t('{{#total}}Total{{/total}} %d'), - ['total' => new HtmlElement('span')], - (int) $this->summary->hosts_total + t('{{#total}}Total{{/total}} {{#link}}%d{{/link}}'), + [ + 'total' => new HtmlElement('span'), + 'link' => new ActionLink(null, Links::hosts()->setFilter($filter)) + ], + $this->summary->hosts_total )) ); } From 0d5abdf63ce7d1389e4d0b30c037acb1ef887520 Mon Sep 17 00:00:00 2001 From: Johannes Rauh Date: Tue, 5 Aug 2025 10:50:10 +0200 Subject: [PATCH 2/3] Add header link for service donut chart Add an action link on the total services number that opens the list that the service donut chart in the tactical overview represents considering the active filters. --- library/Icingadb/Widget/ServiceSummaryDonut.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/library/Icingadb/Widget/ServiceSummaryDonut.php b/library/Icingadb/Widget/ServiceSummaryDonut.php index e6b38a10..d6f6d211 100644 --- a/library/Icingadb/Widget/ServiceSummaryDonut.php +++ b/library/Icingadb/Widget/ServiceSummaryDonut.php @@ -16,6 +16,7 @@ use ipl\Html\Text; use ipl\Stdlib\BaseFilter; use ipl\Stdlib\Filter; use ipl\Web\Common\Card; +use ipl\Web\Widget\ActionLink; class ServiceSummaryDonut extends Card { @@ -69,12 +70,21 @@ class ServiceSummaryDonut extends Card protected function assembleHeader(BaseHtmlElement $header) { + $filter = Filter::all(); + + if ($this->hasBaseFilter()) { + $filter->add($this->getBaseFilter()); + } + $header->addHtml( new HtmlElement('h2', null, Text::create(t('Services'))), new HtmlElement('span', Attributes::create(['class' => 'meta']), TemplateString::create( - t('{{#total}}Total{{/total}} %d'), - ['total' => new HtmlElement('span')], - (int) $this->summary->services_total + t('{{#total}}Total{{/total}} {{#link}}%d{{/link}}'), + [ + 'total' => new HtmlElement('span'), + 'link' => new ActionLink(null, Links::services()->setFilter($filter)) + ], + $this->summary->services_total )) ); } From 6b6e15e76148bce9316cab4d294e417d4f9456a6 Mon Sep 17 00:00:00 2001 From: Johannes Rauh Date: Wed, 6 Aug 2025 11:52:06 +0200 Subject: [PATCH 3/3] Add styling for the links --- public/css/widget/donut-container.less | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/public/css/widget/donut-container.less b/public/css/widget/donut-container.less index 6fc44665..f1424ec7 100644 --- a/public/css/widget/donut-container.less +++ b/public/css/widget/donut-container.less @@ -1,6 +1,17 @@ .donut-container { .card(); + .card-header > .meta { + > span { + color: @text-color-light; + } + + > .action-link { + font-weight: bold; + font-size: 1.1em; + } + } + h2 { margin: 0; }