Merge branch '1083-linea-de-color-cuando-uno-de-los-modulos-de-la-relacion-no-esta-bien-dev' into 'develop'

Added link color

See merge request artica/pandorafms!1049
This commit is contained in:
vgilc 2017-11-29 13:28:17 +01:00
commit 6ff9eb054c
2 changed files with 30 additions and 1 deletions

View File

@ -661,6 +661,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;
$item['deleted'] = $relation['deleted'];
@ -716,14 +717,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'];
}
@ -1490,7 +1519,6 @@ function show_networkmap($id = 0, $user_readonly = false, $nodes_and_relations =
}
.link {
stroke: #999;
stroke-opacity: .6;
}

View File

@ -3211,6 +3211,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) {