mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-02-01 07:59:26 -05:00
BusinessProcess: handle root node detection
This commit is contained in:
parent
4876a5d200
commit
94a22c23c3
1 changed files with 27 additions and 1 deletions
|
|
@ -300,6 +300,20 @@ class BusinessProcess
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function removeRootNode($name)
|
||||
{
|
||||
if ($this->isRootNode($name)) {
|
||||
unset($this->root_nodes[$name]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isRootNode($name)
|
||||
{
|
||||
return array_key_exists($name, $this->root_nodes);
|
||||
}
|
||||
|
||||
public function retrieveStatesFromBackend()
|
||||
{
|
||||
try {
|
||||
|
|
@ -483,6 +497,18 @@ class BusinessProcess
|
|||
}
|
||||
|
||||
$this->nodes[$name] = $node;
|
||||
|
||||
if ($node->getDisplay() > 0) {
|
||||
if (! $this->isRootNode($name)) {
|
||||
$this->addRootNode($name);
|
||||
}
|
||||
} else {
|
||||
if ($this->isRootNode($name)) {
|
||||
$this->removeRootNode($name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
@ -499,7 +525,7 @@ class BusinessProcess
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($node->getDisplay() === '0') {
|
||||
if ($node->getDisplay() === 0) {
|
||||
$nodes[(string) $node] = $node;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue