Skip to content

Commit

Permalink
Fix that handled nodes are not handled
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Apr 22, 2024
1 parent 4df9f52 commit 3a0b40a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 7 additions & 4 deletions library/Businessprocess/BpNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,16 @@ public function getStateSummary()
return $this->counters;
}

public function hasProblems()
public function hasProblems(bool $ignoreHandledStates = false)
{
if ($this->isProblem()) {
if ($this->isProblem() && ($ignoreHandledStates || ! $this->isHandled())) {
return true;
}

$okStates = array('OK', 'UP', 'PENDING', 'MISSING');
$okStates = ['OK', 'UP', 'PENDING', 'MISSING'];
if (! $ignoreHandledStates) {
array_push($okStates, 'CRITICAL-HANDLED', 'WARNING-HANDLED', 'UNKNOWN-HANDLED');
}

foreach ($this->getStateSummary() as $state => $cnt) {
if ($cnt !== 0 && ! in_array($state, $okStates)) {
Expand Down Expand Up @@ -149,7 +152,7 @@ public function getProblematicChildren()
if (isset($this->stateOverrides[$child->getName()])) {
$problem = $this->getChildState($child) > 0;
} else {
$problem = $child->isProblem() || ($child instanceof BpNode && $child->hasProblems());
$problem = $child->isProblem() || ($child instanceof BpNode && $child->hasProblems(true));
}

if ($problem) {
Expand Down
3 changes: 3 additions & 0 deletions library/Businessprocess/Web/Component/BpDashboardTile.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public function __construct(BpConfig $bp, $title, $description, $icon, $url, $ur

foreach ($bp->getChildren() as $node) {
$state = strtolower($node->getStateName());
if ($node->isHandled()) {
$state .= ' handled';
}

$tiles->add(Html::tag(
'a',
Expand Down

0 comments on commit 3a0b40a

Please sign in to comment.