From c0e5706d851da194e939b25224c399dfaf9bd22c Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 29 Nov 2022 15:41:10 +0100 Subject: [PATCH] #9880 Fixed network usage map --- pandora_console/include/class/NetworkMap.class.php | 11 ++++++++++- pandora_console/include/functions_agents.php | 2 +- pandora_console/include/functions_network.php | 11 ++++++----- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index db1b12fec9..ccfbf102c1 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -2215,7 +2215,9 @@ class NetworkMap // Store relationships. $this->relations = array_merge($edges, $orphans); } else { - $this->relations = $edges; + if (empty($this->relations) === true && empty($this->$edges) === false) { + $this->relations = $edges; + } } // Close dot file. @@ -2409,6 +2411,13 @@ class NetworkMap ); } + if (isset($this->mapOptions['map_filter']['node_separation']) === true) { + foreach ($graph['nodes'] as $key => $value) { + $graph['nodes'][$key]['x'] *= $this->mapOptions['map_filter']['node_separation']; + $graph['nodes'][$key]['y'] *= $this->mapOptions['map_filter']['node_separation']; + } + } + unlink($filename_plain); /* diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 170f17b4e5..d253365176 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -4367,7 +4367,6 @@ function agents_get_starmap(int $id_agent, float $width=0, float $height=0) $status = modules_get_agentmodule_status($key); switch ($status) { case 0: - case 4: case 300: $status = 'normal'; break; @@ -4386,6 +4385,7 @@ function agents_get_starmap(int $id_agent, float $width=0, float $height=0) $status = 'unknown'; break; + case 4: case 5: $status = 'notinit'; break; diff --git a/pandora_console/include/functions_network.php b/pandora_console/include/functions_network.php index 9df4f8dbc4..c503945c87 100644 --- a/pandora_console/include/functions_network.php +++ b/pandora_console/include/functions_network.php @@ -124,8 +124,9 @@ function network_general_map_configuration($nodes, $relations) 'map_options' => [ 'generation_method' => LAYOUT_SPRING1, 'map_filter' => [ - 'node_radius' => 40, - 'node_sep' => 7, + 'node_radius' => 40, + 'node_sep' => 7, + 'node_separation' => 5, ], ], ]; @@ -171,8 +172,8 @@ function network_init_node_map($name) return [ 'name' => $name, 'type' => NODE_GENERIC, - 'width' => 20, - 'height' => 20, - 'status' => '#82B92E', + 'width' => 40, + 'height' => 40, + 'status' => 0, ]; }