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 ab3ca59
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 6 additions & 3 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()) {
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 ab3ca59

Please sign in to comment.