From 54ec954a03add01627647bc973b22e2808419483 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 21 Mar 2024 17:19:57 +0100 Subject: [PATCH] ui: Do not show okay states as handled if the object is unreachable fixes #993 --- library/Icingadb/Widget/ItemList/HostDetailHeader.php | 4 +++- library/Icingadb/Widget/ItemList/ServiceDetailHeader.php | 4 +++- library/Icingadb/Widget/ItemList/StateListItem.php | 2 +- library/Icingadb/Widget/ItemTable/StateRowItem.php | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/library/Icingadb/Widget/ItemList/HostDetailHeader.php b/library/Icingadb/Widget/ItemList/HostDetailHeader.php index 97176dac9..b7afb2327 100644 --- a/library/Icingadb/Widget/ItemList/HostDetailHeader.php +++ b/library/Icingadb/Widget/ItemList/HostDetailHeader.php @@ -50,7 +50,9 @@ protected function assembleVisual(BaseHtmlElement $visual): void } $stateChange->setIcon($this->state->getIcon()); - $stateChange->setHandled($this->state->is_handled || ! $this->state->is_reachable); + $stateChange->setHandled( + $this->state->is_problem && ($this->state->is_handled || ! $this->state->is_reachable) + ); $visual->addHtml($stateChange); } diff --git a/library/Icingadb/Widget/ItemList/ServiceDetailHeader.php b/library/Icingadb/Widget/ItemList/ServiceDetailHeader.php index 2f0dbbd8c..8c5094d73 100644 --- a/library/Icingadb/Widget/ItemList/ServiceDetailHeader.php +++ b/library/Icingadb/Widget/ItemList/ServiceDetailHeader.php @@ -50,7 +50,9 @@ protected function assembleVisual(BaseHtmlElement $visual): void } $stateChange->setIcon($this->state->getIcon()); - $stateChange->setHandled($this->state->is_handled || ! $this->state->is_reachable); + $stateChange->setHandled( + $this->state->is_problem && ($this->state->is_handled || ! $this->state->is_reachable) + ); $visual->addHtml($stateChange); } diff --git a/library/Icingadb/Widget/ItemList/StateListItem.php b/library/Icingadb/Widget/ItemList/StateListItem.php index d0b336341..cd8ff163e 100644 --- a/library/Icingadb/Widget/ItemList/StateListItem.php +++ b/library/Icingadb/Widget/ItemList/StateListItem.php @@ -99,7 +99,7 @@ protected function assembleVisual(BaseHtmlElement $visual): void { $stateBall = new StateBall($this->state->getStateText(), $this->getStateBallSize()); $stateBall->add($this->state->getIcon()); - if ($this->state->is_handled || ! $this->state->is_reachable) { + if ($this->state->is_problem && ($this->state->is_handled || ! $this->state->is_reachable)) { $stateBall->getAttributes()->add('class', 'handled'); } diff --git a/library/Icingadb/Widget/ItemTable/StateRowItem.php b/library/Icingadb/Widget/ItemTable/StateRowItem.php index f62286b74..7ca93921c 100644 --- a/library/Icingadb/Widget/ItemTable/StateRowItem.php +++ b/library/Icingadb/Widget/ItemTable/StateRowItem.php @@ -33,7 +33,7 @@ protected function assembleVisual(BaseHtmlElement $visual) $stateBall = new StateBall($this->item->state->getStateText(), StateBall::SIZE_LARGE); $stateBall->add($this->item->state->getIcon()); - if ($this->item->state->is_handled) { + if ($this->item->state->is_problem && ($this->item->state->is_handled || ! $this->item->state->is_reachable)) { $stateBall->getAttributes()->add('class', 'handled'); }