Fixed links in networkmaps
This commit is contained in:
parent
49bf10f0f8
commit
b2fe6780ac
|
@ -683,10 +683,10 @@ function update_link(row_index, id_link) {
|
||||||
temp_link["text_end"] = data["text_end"];
|
temp_link["text_end"] = data["text_end"];
|
||||||
|
|
||||||
$.each(graph.nodes, function(k, node) {
|
$.each(graph.nodes, function(k, node) {
|
||||||
if (node["id_agent"] == data["id_db_target"]) {
|
if (node["id_db"] == data["id_db_target"]) {
|
||||||
temp_link["target"] = graph.nodes[k];
|
temp_link["target"] = graph.nodes[k];
|
||||||
}
|
}
|
||||||
if (node["id_agent"] == data["id_db_source"]) {
|
if (node["id_db"] == data["id_db_source"]) {
|
||||||
temp_link["source"] = graph.nodes[k];
|
temp_link["source"] = graph.nodes[k];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -703,9 +703,21 @@ function update_link(row_index, id_link) {
|
||||||
.append("g")
|
.append("g")
|
||||||
.attr("id", "layer_graph_nodes_" + networkmap_id);
|
.attr("id", "layer_graph_nodes_" + networkmap_id);
|
||||||
|
|
||||||
|
var graph_links_aux = graph.links.filter(function(d, i) {
|
||||||
|
if (typeof d["source"] === "undefined") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof d["target"] === "undefined") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return d;
|
||||||
|
});
|
||||||
|
|
||||||
force
|
force
|
||||||
.nodes(graph.nodes)
|
.nodes(graph.nodes)
|
||||||
.links(graph.links)
|
.links(graph_links_aux)
|
||||||
.start();
|
.start();
|
||||||
|
|
||||||
window.node = layer_graph_nodes.selectAll(".node");
|
window.node = layer_graph_nodes.selectAll(".node");
|
||||||
|
@ -2353,9 +2365,21 @@ function refresh_holding_area() {
|
||||||
.append("g")
|
.append("g")
|
||||||
.attr("id", "layer_graph_nodes_" + networkmap_id);
|
.attr("id", "layer_graph_nodes_" + networkmap_id);
|
||||||
|
|
||||||
|
var graph_links_aux = graph.links.filter(function(d, i) {
|
||||||
|
if (typeof d["source"] === "undefined") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof d["target"] === "undefined") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return d;
|
||||||
|
});
|
||||||
|
|
||||||
force
|
force
|
||||||
.nodes(graph.nodes)
|
.nodes(graph.nodes)
|
||||||
.links(graph.links)
|
.links(graph_links_aux)
|
||||||
.start();
|
.start();
|
||||||
|
|
||||||
window.node = layer_graph_nodes.selectAll(".node");
|
window.node = layer_graph_nodes.selectAll(".node");
|
||||||
|
|
|
@ -1026,12 +1026,12 @@ if (is_ajax() === true) {
|
||||||
// Source_value is id_agente.
|
// Source_value is id_agente.
|
||||||
$source_text = '';
|
$source_text = '';
|
||||||
$source_agent = $interface_source;
|
$source_agent = $interface_source;
|
||||||
$source_type = NODE_AGENT;
|
$source_type = ($interface_source == 0) ? NODE_PANDORA : NODE_AGENT;
|
||||||
$source_link_value = $source_agent;
|
$source_link_value = $source_agent;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search node id in map.
|
// Search node id in map.
|
||||||
$child_id = db_get_value_filter(
|
$parent_id = db_get_value_filter(
|
||||||
'id',
|
'id',
|
||||||
'titem',
|
'titem',
|
||||||
[
|
[
|
||||||
|
@ -1073,7 +1073,7 @@ if (is_ajax() === true) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search node id in map.
|
// Search node id in map.
|
||||||
$parent_id = db_get_value_filter(
|
$child_id = db_get_value_filter(
|
||||||
'id',
|
'id',
|
||||||
'titem',
|
'titem',
|
||||||
[
|
[
|
||||||
|
@ -1089,10 +1089,10 @@ if (is_ajax() === true) {
|
||||||
$link['id_item'] = 0;
|
$link['id_item'] = 0;
|
||||||
$link['deleted'] = 0;
|
$link['deleted'] = 0;
|
||||||
$link['id_map'] = $networkmap_id;
|
$link['id_map'] = $networkmap_id;
|
||||||
$link['parent_type'] = $target_type;
|
$link['parent_type'] = $source_type;
|
||||||
$link['id_parent_source_data'] = $target_link_value;
|
$link['id_parent_source_data'] = $source_link_value;
|
||||||
$link['child_type'] = $source_type;
|
$link['child_type'] = $target_type;
|
||||||
$link['id_child_source_data'] = $source_link_value;
|
$link['id_child_source_data'] = $target_link_value;
|
||||||
|
|
||||||
$insert_result = db_process_sql_insert('trel_item', $link);
|
$insert_result = db_process_sql_insert('trel_item', $link);
|
||||||
|
|
||||||
|
@ -1123,8 +1123,8 @@ if (is_ajax() === true) {
|
||||||
$return['text_start'] = $source_text;
|
$return['text_start'] = $source_text;
|
||||||
$return['text_end'] = $target_text;
|
$return['text_end'] = $target_text;
|
||||||
$return['id_db_link'] = $insert_result;
|
$return['id_db_link'] = $insert_result;
|
||||||
$return['id_db_source'] = $source_agent;
|
$return['id_db_source'] = $parent_id;
|
||||||
$return['id_db_target'] = $target_agent;
|
$return['id_db_target'] = $child_id;
|
||||||
$return['type_source'] = $source_type;
|
$return['type_source'] = $source_type;
|
||||||
$return['type_target'] = $target_type;
|
$return['type_target'] = $target_type;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue