mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-24 00:29:47 -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 $alias;
|
||||||
protected $counters;
|
protected $counters;
|
||||||
protected $missing = null;
|
protected $missing = null;
|
||||||
|
protected $missingChildren;
|
||||||
|
|
||||||
protected static $emptyStateSummary = array(
|
protected static $emptyStateSummary = array(
|
||||||
'OK' => 0,
|
'OK' => 0,
|
||||||
|
|
@ -135,6 +136,25 @@ class BpNode extends Node
|
||||||
return $this->missing;
|
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()
|
public function getOperator()
|
||||||
{
|
{
|
||||||
return $this->operator;
|
return $this->operator;
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,16 @@ abstract class Node
|
||||||
return $this->missing;
|
return $this->missing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasMissingChildren()
|
||||||
|
{
|
||||||
|
return count($this->getMissingChildren() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMissingChildren()
|
||||||
|
{
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
public function hasInfoUrl()
|
public function hasInfoUrl()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -334,7 +344,11 @@ abstract class Node
|
||||||
if ($this->isMissing()) {
|
if ($this->isMissing()) {
|
||||||
return array('missing');
|
return array('missing');
|
||||||
} elseif ($state === 'ok') {
|
} elseif ($state === 'ok') {
|
||||||
|
if ($this->hasMissingChildren()) {
|
||||||
|
return array('ok', 'missing-children');
|
||||||
|
} else {
|
||||||
return array('ok');
|
return array('ok');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return array('problem', $state);
|
return array('problem', $state);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue