From fa50ac5cdf84b78af5d64fefca173a8421b9ed34 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Fri, 10 Nov 2017 11:05:53 +0100 Subject: [PATCH] Added link color --- .../include/functions_pandora_networkmap.php | 30 ++++++++++++++++++- .../functions_pandora_networkmap.js | 1 + 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_pandora_networkmap.php b/pandora_console/include/functions_pandora_networkmap.php index e09a20f3bc..53cd5125ec 100644 --- a/pandora_console/include/functions_pandora_networkmap.php +++ b/pandora_console/include/functions_pandora_networkmap.php @@ -518,6 +518,7 @@ function networkmap_links_to_js_links($relations, $nodes_graph) { $item['id_agent_start'] = (int)$id_source_agent; $item['id_module_end'] = 0; $item['id_agent_end'] = (int)$id_target_agent; + $item['link_color'] = "#999"; $item['target'] = -1; $item['source'] = -1; @@ -572,14 +573,42 @@ function networkmap_links_to_js_links($relations, $nodes_graph) { $agent2 = 0; if (($relation['parent_type'] == 1) && ($relation['child_type'] == 1)) { + $mod1_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_parent_source_data'])); + $mod2_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_child_source_data'])); + + if (($mod1_status == AGENT_MODULE_STATUS_CRITICAL_BAD) || ($mod2_status == AGENT_MODULE_STATUS_CRITICAL_BAD)) { + $item['link_color'] = "#FC4444"; + } + else if (($mod1_status == AGENT_MODULE_STATUS_WARNING) || ($mod2_status == AGENT_MODULE_STATUS_WARNING)) { + $item['link_color'] = "#FAD403"; + } + $agent = agents_get_agent_id_by_module_id($relation['id_parent_source_data']); $agent2 = agents_get_agent_id_by_module_id($relation['id_child_source_data']); } else if ($relation['child_type'] == 1) { + $mod1_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_child_source_data'])); + + if ($mod1_status == AGENT_MODULE_STATUS_CRITICAL_BAD) { + $item['link_color'] = "#FC4444"; + } + else if ($mod1_status == AGENT_MODULE_STATUS_WARNING) { + $item['link_color'] = "#FAD403"; + } + $agent = $relation['id_parent_source_data']; $agent2 = agents_get_agent_id_by_module_id($relation['id_child_source_data']); } else if ($relation['parent_type'] == 1) { + $mod1_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_parent_source_data'])); + + if ($mod1_status == AGENT_MODULE_STATUS_CRITICAL_BAD) { + $item['link_color'] = "#FC4444"; + } + else if ($mod1_status == AGENT_MODULE_STATUS_WARNING) { + $item['link_color'] = "#FAD403"; + } + $agent = agents_get_agent_id_by_module_id($relation['id_parent_source_data']); $agent2 = $relation['id_child_source_data']; } @@ -1335,7 +1364,6 @@ function show_networkmap($id = 0, $user_readonly = false, $nodes_and_relations = } .link { - stroke: #999; stroke-opacity: .6; } diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index 6b4cd0d415..41f5dbcc1d 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -3063,6 +3063,7 @@ function draw_elements_graph() { "id_module_start_" + d.id_module_start + " " + "id_module_end_" + d.id_module_end; }) + .attr("stroke", function (d) { return d.link_color; }) .attr("stroke-width", 3) .attr("d", null) .attr('marker-start', function (d) {