Skip to content

Commit 91827cb

Browse files
committed
ui: Do not show okay states as handled if the object is unreachable
fixes #993
1 parent fbc3778 commit 91827cb

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

library/Icingadb/Widget/ItemList/HostDetailHeader.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ protected function assembleVisual(BaseHtmlElement $visual): void
5050
}
5151

5252
$stateChange->setIcon($this->state->getIcon());
53-
$stateChange->setHandled($this->state->is_handled || ! $this->state->is_reachable);
53+
$stateChange->setHandled(
54+
$this->state->is_problem && ($this->state->is_handled || ! $this->state->is_reachable)
55+
);
5456

5557
$visual->addHtml($stateChange);
5658
}

library/Icingadb/Widget/ItemList/ServiceDetailHeader.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ protected function assembleVisual(BaseHtmlElement $visual): void
5050
}
5151

5252
$stateChange->setIcon($this->state->getIcon());
53-
$stateChange->setHandled($this->state->is_handled || ! $this->state->is_reachable);
53+
$stateChange->setHandled(
54+
$this->state->is_problem && ($this->state->is_handled || ! $this->state->is_reachable)
55+
);
5456

5557
$visual->addHtml($stateChange);
5658
}

library/Icingadb/Widget/ItemList/StateListItem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ protected function assembleVisual(BaseHtmlElement $visual): void
9999
{
100100
$stateBall = new StateBall($this->state->getStateText(), $this->getStateBallSize());
101101
$stateBall->add($this->state->getIcon());
102-
if ($this->state->is_handled || ! $this->state->is_reachable) {
102+
if ($this->state->is_problem && ($this->state->is_handled || ! $this->state->is_reachable)) {
103103
$stateBall->getAttributes()->add('class', 'handled');
104104
}
105105

library/Icingadb/Widget/ItemTable/StateRowItem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected function assembleVisual(BaseHtmlElement $visual)
3333
$stateBall = new StateBall($this->item->state->getStateText(), StateBall::SIZE_LARGE);
3434
$stateBall->add($this->item->state->getIcon());
3535

36-
if ($this->item->state->is_handled) {
36+
if ($this->item->state->is_problem && ($this->item->state->is_handled || ! $this->item->state->is_reachable)) {
3737
$stateBall->getAttributes()->add('class', 'handled');
3838
}
3939

phpstan-baseline-standard.neon

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7635,6 +7635,16 @@ parameters:
76357635
count: 1
76367636
path: library/Icingadb/Widget/ItemTable/StateRowItem.php
76377637

7638+
-
7639+
message: "#^Cannot access property \\$is_problem on mixed\\.$#"
7640+
count: 1
7641+
path: library/Icingadb/Widget/ItemTable/StateRowItem.php
7642+
7643+
-
7644+
message: "#^Cannot access property \\$is_reachable on mixed\\.$#"
7645+
count: 1
7646+
path: library/Icingadb/Widget/ItemTable/StateRowItem.php
7647+
76387648
-
76397649
message: "#^Cannot access property \\$last_state_change on mixed\\.$#"
76407650
count: 1

0 commit comments

Comments
 (0)