Skip to content

Commit

Permalink
tactical: Properly process base filter on state badges
Browse files Browse the repository at this point in the history
fixes #795
  • Loading branch information
nilmerg committed Jul 5, 2023
1 parent 70c73c0 commit 717b5c6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
13 changes: 10 additions & 3 deletions library/Icingadb/Widget/HostSummaryDonut.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use ipl\Html\TemplateString;
use ipl\Html\Text;
use ipl\Stdlib\BaseFilter;
use ipl\Stdlib\Filter;
use ipl\Web\Common\Card;
use ipl\Web\Filter\QueryString;

Expand All @@ -33,6 +34,14 @@ public function __construct(HoststateSummary $summary)

protected function assembleBody(BaseHtmlElement $body)
{
$labelBigUrlFilter = Filter::all(
Filter::equal('host.state.soft_state', 1),
Filter::equal('host.state.is_handled', 'n')
);
if ($this->hasBaseFilter()) {
$labelBigUrlFilter->add($this->getBaseFilter());
}

$donut = (new Donut())
->addSlice($this->summary->hosts_up, ['class' => 'slice-state-ok'])
->addSlice($this->summary->hosts_down_handled, ['class' => 'slice-state-critical-handled'])
Expand All @@ -41,9 +50,7 @@ protected function assembleBody(BaseHtmlElement $body)
->addSlice($this->summary->hosts_unreachable_unhandled, ['class' => 'slice-state-unreachable'])
->addSlice($this->summary->hosts_pending, ['class' => 'slice-state-pending'])
->setLabelBig($this->summary->hosts_down_unhandled)
->setLabelBigUrl(Links::hosts()->setQueryString(QueryString::render($this->getBaseFilter()))->addParams([
'host.state.soft_state' => 1,
'host.state.is_handled' => 'n',
->setLabelBigUrl(Links::hosts()->setQueryString(QueryString::render($labelBigUrlFilter))->addParams([
'sort' => 'host.state.last_state_change'
]))
->setLabelBigEyeCatching($this->summary->hosts_down_unhandled > 0)
Expand Down
13 changes: 10 additions & 3 deletions library/Icingadb/Widget/ServiceSummaryDonut.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use ipl\Html\TemplateString;
use ipl\Html\Text;
use ipl\Stdlib\BaseFilter;
use ipl\Stdlib\Filter;
use ipl\Web\Common\Card;
use ipl\Web\Filter\QueryString;

Expand All @@ -33,6 +34,14 @@ public function __construct(ServicestateSummary $summary)

protected function assembleBody(BaseHtmlElement $body)
{
$labelBigUrlFilter = Filter::all(
Filter::equal('service.state.soft_state', 2),
Filter::equal('service.state.is_handled', 'n')
);
if ($this->hasBaseFilter()) {
$labelBigUrlFilter->add($this->getBaseFilter());
}

$donut = (new Donut())
->addSlice($this->summary->services_ok, ['class' => 'slice-state-ok'])
->addSlice($this->summary->services_warning_handled, ['class' => 'slice-state-warning-handled'])
Expand All @@ -43,9 +52,7 @@ protected function assembleBody(BaseHtmlElement $body)
->addSlice($this->summary->services_unknown_unhandled, ['class' => 'slice-state-unknown'])
->addSlice($this->summary->services_pending, ['class' => 'slice-state-pending'])
->setLabelBig($this->summary->services_critical_unhandled)
->setLabelBigUrl(Links::services()->setQueryString(QueryString::render($this->getBaseFilter()))->addParams([
'service.state.soft_state' => 2,
'service.state.is_handled' => 'n',
->setLabelBigUrl(Links::services()->setQueryString(QueryString::render($labelBigUrlFilter))->addParams([
'sort' => 'service.state.last_state_change'
]))
->setLabelBigEyeCatching($this->summary->services_critical_unhandled > 0)
Expand Down

0 comments on commit 717b5c6

Please sign in to comment.