diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index 22624ecd89..3a4ec1ea1d 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -644,6 +644,15 @@ class NetworkMap 'order' => 'ASC', ] ); + + // Remap ids. + $nodes = array_reduce( + $nodes, + function ($carry, $item) { + $carry[$item['id_agente']] = $item; + return $carry; + } + ); } return $nodes; @@ -741,7 +750,7 @@ class NetworkMap $parent_node = $this->nodes[$parent_id]['id_node']; // Store relationship. - if ($parent_node) { + if ($parent_node && $node['id_parent'] > 0) { $rel = []; // Node reference (parent). @@ -1202,7 +1211,9 @@ class NetworkMap } if ($valid === 1) { - $cleaned[] = $rel; + if ($rel['id_parent'] != $rel['id_child']) { + $cleaned[] = $rel; + } } } @@ -2263,6 +2274,9 @@ class NetworkMap } } + // Prioritize relations between same nodes. + $this->cleanGraphRelations(); + // Save data. if ($this->idMap > 0 && (isset($this->map['__simulated']) === false)) { if (enterprise_installed()) {