Merge branch 'ent-11818-16015-mapas-de-red-se-descolocan-tras-aparecer-un-nuevo-dispositivo' into 'develop'

Ent 11818 16015 mapas de red se descolocan tras aparecer un nuevo dispositivo

See merge request artica/pandorafms!6535
This commit is contained in:
Matias Didier 2023-10-17 13:08:52 +00:00
commit a840550759
3 changed files with 7 additions and 75 deletions

View File

@ -1590,6 +1590,8 @@ class NetworkMap
{ {
global $config; global $config;
include_once 'include/functions_os.php';
$return = []; $return = [];
$count_item_holding_area = 0; $count_item_holding_area = 0;
foreach ($nodes as $node) { foreach ($nodes as $node) {

View File

@ -4466,7 +4466,7 @@ function networkmap_get_new_nodes_and_links($networkmap, $x, $y)
'id_child' => $child_node, 'id_child' => $child_node,
'id_parent_source_data' => $parent, 'id_parent_source_data' => $parent,
'id_child_source_data' => $node['source_data'], 'id_child_source_data' => $node['source_data'],
'parent_type' => 0, 'parent_type' => 2,
'child_type' => 0, 'child_type' => 0,
] ]
); );

View File

@ -2520,80 +2520,10 @@ function refresh_holding_area() {
function refresh() { function refresh() {
$("#spinner_networkmap").css("display", "flex"); $("#spinner_networkmap").css("display", "flex");
var holding_pos_x = d3_nm.select("#holding_area_" + networkmap_id).attr("x"); refresh_holding_area();
var holding_pos_y = d3_nm.select("#holding_area_" + networkmap_id).attr("y"); update_networkmap();
$("#spinner_networkmap").css("display", "none");
var pos_x = parseInt(holding_pos_x) + parseInt(node_radius); window.location = location;
var pos_y = parseInt(holding_pos_y) + parseInt(node_radius);
var params = [];
params.push("refresh_holding_area=1");
params.push("id=" + networkmap_id);
params.push("x=" + pos_x);
params.push("y=" + pos_y);
params.push("page=operation/agentes/pandora_networkmap.view");
$.ajax({
data: {
page: "operation/agentes/pandora_networkmap.view",
refresh_holding_area: 1,
id: networkmap_id,
x: pos_x,
y: pos_y
},
dataType: "json",
type: "POST",
url: window.base_url_homedir + "/ajax.php",
success: function(data) {
if (data["correct"]) {
const array_nodes = data["holding_area"]["nodes"];
let array_links = data["holding_area"]["links"];
jQuery.each(graph.links, function(j, g_link) {
for (var i = 0; i < array_links.length; i++) {
if (g_link["id_db"] == array_links[i]["id_db"]) {
array_links.splice(i, 1);
}
}
});
let location = "";
if ($("#main").height()) {
location = `index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&id_networkmap=${networkmap_id}`;
} else {
location = `index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&pure=1&id_networkmap=${networkmap_id}`;
}
if (array_nodes.length === 0 && array_links.length === 0) {
update_networkmap();
$("#spinner_networkmap").css("display", "none");
window.location = location;
} else {
if (array_nodes.length > 0) {
$.ajax({
data: {
page: "operation/agentes/pandora_networkmap.view",
refresh_map: 1,
id: networkmap_id
},
dataType: "json",
type: "POST",
url: window.base_url_homedir + "/ajax.php",
success: function(data) {
$("#spinner_networkmap").css("display", "none");
window.location = location;
}
});
} else if (array_links.length > 0) {
$("#spinner_networkmap").css("display", "none");
window.location = location;
}
}
}
},
error: function(e) {
$("#spinner_networkmap").css("display", "none");
window.location = location;
}
});
} }
function startCountDown(duration) { function startCountDown(duration) {