Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix that handled nodes are not handled #438

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading