mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-20 23:00:16 -05:00
parent
324a6e898d
commit
d1f32c59f1
2 changed files with 13 additions and 13 deletions
|
|
@ -25,15 +25,6 @@ class NodeController extends Controller
|
||||||
foreach ($this->storage()->listProcessNames() as $configName) {
|
foreach ($this->storage()->listProcessNames() as $configName) {
|
||||||
$config = $this->storage()->loadProcess($configName);
|
$config = $this->storage()->loadProcess($configName);
|
||||||
|
|
||||||
// TODO: Fix issues with children, they do not exist unless resolved :-/
|
|
||||||
// This is a workaround:
|
|
||||||
foreach ($config->getRootNodes() as $node) {
|
|
||||||
$node->getState();
|
|
||||||
}
|
|
||||||
foreach ($config->getRootNodes() as $node) {
|
|
||||||
$node->clearState();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $config->hasNode($name)) {
|
if (! $config->hasNode($name)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ abstract class Node
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $parents = array();
|
protected $parents;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Node identifier
|
* Node identifier
|
||||||
|
|
@ -286,7 +286,7 @@ abstract class Node
|
||||||
|
|
||||||
public function hasParents()
|
public function hasParents()
|
||||||
{
|
{
|
||||||
return count($this->parents) > 0;
|
return count($this->getParents()) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasParentName($name)
|
public function hasParentName($name)
|
||||||
|
|
@ -303,7 +303,7 @@ abstract class Node
|
||||||
public function removeParent($name)
|
public function removeParent($name)
|
||||||
{
|
{
|
||||||
$this->parents = array_filter(
|
$this->parents = array_filter(
|
||||||
$this->parents,
|
$this->getParents(),
|
||||||
function (BpNode $parent) use ($name) {
|
function (BpNode $parent) use ($name) {
|
||||||
return $parent->getName() !== $name;
|
return $parent->getName() !== $name;
|
||||||
}
|
}
|
||||||
|
|
@ -317,6 +317,15 @@ abstract class Node
|
||||||
*/
|
*/
|
||||||
public function getParents()
|
public function getParents()
|
||||||
{
|
{
|
||||||
|
if ($this->parents === null) {
|
||||||
|
$this->parents = [];
|
||||||
|
foreach ($this->bp->getBpNodes() as $name => $node) {
|
||||||
|
if ($node->hasChild($this->getName())) {
|
||||||
|
$this->parents[] = $node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->parents;
|
return $this->parents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -330,7 +339,7 @@ abstract class Node
|
||||||
}
|
}
|
||||||
|
|
||||||
$paths = array();
|
$paths = array();
|
||||||
foreach ($this->parents as $parent) {
|
foreach ($this->getParents() as $parent) {
|
||||||
foreach ($parent->getPaths() as $path) {
|
foreach ($parent->getPaths() as $path) {
|
||||||
$path[] = $this->getName();
|
$path[] = $this->getName();
|
||||||
$paths[] = $path;
|
$paths[] = $path;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue