mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-20 23:00:16 -05:00
(Bp)Node: add get/hasMissingChildren method
This commit is contained in:
parent
1e145f127f
commit
93fff13209
2 changed files with 35 additions and 1 deletions
|
|
@ -19,6 +19,7 @@ class BpNode extends Node
|
|||
protected $alias;
|
||||
protected $counters;
|
||||
protected $missing = null;
|
||||
protected $missingChildren;
|
||||
|
||||
protected static $emptyStateSummary = array(
|
||||
'OK' => 0,
|
||||
|
|
@ -135,6 +136,25 @@ class BpNode extends Node
|
|||
return $this->missing;
|
||||
}
|
||||
|
||||
public function getMissingChildren()
|
||||
{
|
||||
if ($this->missingChildren === null) {
|
||||
foreach ($this->getChildren() as $child) {
|
||||
if ($child->isMissing()) {
|
||||
$missing[(string) $child] = $child;
|
||||
}
|
||||
|
||||
foreach ($child->getMissingChildren() as $m) {
|
||||
$missing[(string) $m] = $m;
|
||||
}
|
||||
}
|
||||
|
||||
$this->missingChildren = $missing;
|
||||
}
|
||||
|
||||
return $this->missingChildren;
|
||||
}
|
||||
|
||||
public function getOperator()
|
||||
{
|
||||
return $this->operator;
|
||||
|
|
|
|||
|
|
@ -127,6 +127,16 @@ abstract class Node
|
|||
return $this->missing;
|
||||
}
|
||||
|
||||
public function hasMissingChildren()
|
||||
{
|
||||
return count($this->getMissingChildren() > 0);
|
||||
}
|
||||
|
||||
public function getMissingChildren()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function hasInfoUrl()
|
||||
{
|
||||
return false;
|
||||
|
|
@ -334,7 +344,11 @@ abstract class Node
|
|||
if ($this->isMissing()) {
|
||||
return array('missing');
|
||||
} elseif ($state === 'ok') {
|
||||
if ($this->hasMissingChildren()) {
|
||||
return array('ok', 'missing-children');
|
||||
} else {
|
||||
return array('ok');
|
||||
}
|
||||
} else {
|
||||
return array('problem', $state);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue