Skip to content

Commit

Permalink
ui: Do not show okay states as handled if the object is unreachable
Browse files Browse the repository at this point in the history
fixes #993
  • Loading branch information
nilmerg committed Mar 22, 2024
1 parent 02fb857 commit e274d39
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
4 changes: 3 additions & 1 deletion library/Icingadb/Widget/ItemList/HostDetailHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 3 additions & 1 deletion library/Icingadb/Widget/ItemList/ServiceDetailHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion library/Icingadb/Widget/ItemList/StateListItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down
2 changes: 1 addition & 1 deletion library/Icingadb/Widget/ItemTable/StateRowItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down
10 changes: 10 additions & 0 deletions phpstan-baseline-standard.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7635,6 +7635,16 @@ parameters:
count: 1
path: library/Icingadb/Widget/ItemTable/StateRowItem.php

-
message: "#^Cannot access property \\$is_problem on mixed\\.$#"
count: 1
path: library/Icingadb/Widget/ItemTable/StateRowItem.php

-
message: "#^Cannot access property \\$is_reachable on mixed\\.$#"
count: 1
path: library/Icingadb/Widget/ItemTable/StateRowItem.php

-
message: "#^Cannot access property \\$last_state_change on mixed\\.$#"
count: 1
Expand Down

0 comments on commit e274d39

Please sign in to comment.