Merge branch 'ent-9463-Mejorar-linkado-mapas-de-red' into 'develop'

Ent 9463 mejorar linkado mapas de red

See merge request artica/pandorafms!5339
This commit is contained in:
Rafael Ameijeiras 2022-12-21 10:53:29 +00:00
commit b79d3d9a08
2 changed files with 21 additions and 7 deletions

View File

@ -3399,7 +3399,10 @@ function get_status_color_networkmap_fictional_point($id_networkmap, $parent='')
if ($agent['source_data'] == -2) {
if (empty($parent) === true) {
$option = json_decode($agent, true);
if (is_array($agent) === false) {
$option = json_decode($agent, true);
}
if ($option['networkmap'] == 0) {
$status = 0;
} else {

View File

@ -1699,7 +1699,6 @@ function selected_node(d, selected_param, hold_other_selections) {
);
d3.event.stopPropagation();
d3.event.preventDefault();
}
function clear_selection() {
@ -4020,8 +4019,10 @@ function draw_elements_graph() {
font_size +
"px !important; text-align:center; text-anchor:middle; fill:#000000"
)
.text(function(d) {
return ellipsize(get_node_name_ov(d), 30);
.html(function(d) {
d.text = ellipsize(d.text, 30);
return get_node_name_ov(d, true, font_size);
})
.classed("dragable_node fill_fff", true) //own dragable
.on("click", selected_node)
@ -4030,7 +4031,7 @@ function draw_elements_graph() {
});
node_temp.append("title").text(function(d) {
return get_node_name_ov(d);
return get_node_name_ov(d, false);
});
node.exit().remove();
@ -4040,9 +4041,19 @@ function is_central_node(data) {
return data.type == 0 && data.id_agent == 0;
}
function get_node_name_ov(data) {
function get_node_name_ov(data, generate_link, font_size) {
font_size = font_size || 20;
generate_link = generate_link || false;
var data_text = data.text;
if (generate_link === true && data.networkmap_id > 0) {
data_text = `<a href="index.php?sec=network&amp;sec2=operation/agentes/pandora_networkmap&amp;tab=view&amp;id_networkmap=
${data.networkmap_id}" style="font-size: ${font_size}px;">${data.text}</a>`;
}
// Node central name should be the product name
return is_central_node(data) ? $("#hidden-product_name").val() : data.text;
return is_central_node(data) ? $("#hidden-product_name").val() : data_text;
}
function choose_group_for_show_agents() {