From 39ea3910b05b4a61d5522bb1fded7453fd819e9c Mon Sep 17 00:00:00 2001 From: m-lopez-f Date: Fri, 11 Sep 2015 10:57:36 +0200 Subject: [PATCH] Fixed network maps when have more data. Tiquet: #2674 --- .../include/ajax/networkmap.ajax.php | 8 ++--- .../include/functions_networkmap.php | 33 +++++++++++++++---- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/pandora_console/include/ajax/networkmap.ajax.php b/pandora_console/include/ajax/networkmap.ajax.php index 5131de9664..3e4849981f 100644 --- a/pandora_console/include/ajax/networkmap.ajax.php +++ b/pandora_console/include/ajax/networkmap.ajax.php @@ -45,28 +45,28 @@ switch($action) { $summary = '
'; if (isset($stats['policies'])) { - $summary .= count($stats['policies']) . " x " . + $summary .= $stats['policies'] . " x " . html_print_image($hack_metaconsole . 'images/policies.png',true) . ' '. __('Policies') . "
"; } if (isset($stats['groups'])) { // TODO: GET STATUS OF THE GROUPS AND ADD IT TO SUMMARY - $summary .= count($stats['groups']) . " x " . + $summary .= $stats['groups'] . " x " . html_print_image($hack_metaconsole . 'images/group.png',true) . ' ' . __('Groups') . "
"; } if (isset($stats['agents'])) { // TODO: GET STATUS OF THE AGENTS AND ADD IT TO SUMMARY - $summary .= count($stats['agents']) . + $summary .= $stats['agents'] . " x " . html_print_image($hack_metaconsole . 'images/bricks.png',true) . ' ' . __('Agents') . "
"; } if (isset($stats['modules'])) { // TODO: GET STATUS OF THE MODULES AND ADD IT TO SUMMARY - $summary .= count($stats['modules']) . + $summary .= $stats['modules'] . " x " . html_print_image($hack_metaconsole . 'images/brick.png',true) . ' ' . __('Modules') . "
"; } diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index fd87de93fb..29547ecb47 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -1332,7 +1332,24 @@ function networkmap_create_pandora_node ($name, $font_size = 10, $simple = 0, $s global $hack_networkmap_mobile; global $config; - $stats_json = base64_encode(json_encode($stats)); + //$stats_json = base64_encode(json_encode($stats)); + $summary = array(); + if (isset($stats['policies'])) { + $summary['policies'] = count($stats['policies']); + } + if (isset($stats['groups'])) { + // TODO: GET STATUS OF THE GROUPS AND ADD IT TO SUMMARY + $summary['groups'] = count($stats['groups']); + } + if (isset($stats['agents'])) { + // TODO: GET STATUS OF THE AGENTS AND ADD IT TO SUMMARY + $summary['agents'] = count($stats['agents']); + } + if (isset($stats['modules'])) { + // TODO: GET STATUS OF THE MODULES AND ADD IT TO SUMMARY + $summary['modules'] = count($stats['modules']) ; + } + $stats_json = base64_encode(json_encode($summary)); $img_src = "images/networkmap/pandora_node.png"; if (defined('METACONSOLE')) { @@ -1343,12 +1360,12 @@ function networkmap_create_pandora_node ($name, $font_size = 10, $simple = 0, $s 'stats='.$stats_json . '&' . 'metaconsole=1'; $url = ''; - $color = "#052938"; + $color = '#052938'; } else { $url_tooltip = 'ajax.php?page=include/ajax/networkmap.ajax&action=get_networkmap_summary&stats='.$stats_json.'", URL="index.php?sec=estado&sec2=operation/agentes/group_view'; $url = 'index.php?sec=estado&sec2=operation/agentes/group_view'; - $color = "#373737"; + $color = '#373737'; } if ($hack_networkmap_mobile) { @@ -1357,10 +1374,12 @@ function networkmap_create_pandora_node ($name, $font_size = 10, $simple = 0, $s ''; } else { - $img = '' . html_print_image("images/networkmap/pandora_node.png", true, false, false, true) . ''; + $image = html_print_image("images/networkmap/pandora_node.png", true, false, false, true); + $image = str_replace('"',"'",$image); + $img = '' . $image . ''; } - $name = '' . $name . ''; - $label = '' . $img.$name . '
'; + $name = "" . $name . ''; + $label = "" . $img.$name . '
'; if ($simple == 1) { $label = ''; } @@ -1385,7 +1404,7 @@ function networkmap_open_group ($id) { $name = groups_get_name ($id); $group = 'subgraph cluster_' . $id . - ' { style=filled; color=darkolivegreen3; label=< + ' { style=filled; color=darkolivegreen3; label=<
' . html_print_image($img, true) . ''.$name.'
>; tooltip="'.$name.'"; URL="index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id='