Merge branch 'ent-5112-error-nodos-ficticios-widget-mapa-red' into 'develop'

Ent 5112 error nodos ficticios widget mapa red

See merge request artica/pandorafms!3030
This commit is contained in:
Daniel Rodriguez 2020-02-06 14:32:43 +01:00
commit 45033625e5
2 changed files with 73 additions and 19 deletions

View File

@ -226,6 +226,13 @@ class NetworkMap
*/
public $tooltipParams;
/**
* Defines if map is widget or not for JS
*
* @var boolean;
*/
public $widget;
/**
* Shows the map using 100% of height and width if is a widget.
*
@ -406,8 +413,10 @@ class NetworkMap
// Initialize as widget?
if (isset($options['widget'])) {
$this->fullSize = (bool) $options['widget'];
$this->widget = true;
} else {
$this->fullSize = true;
$this->widget = false;
}
// Use a custom parser.
@ -2689,6 +2698,7 @@ class NetworkMap
$this->cleanGraphRelations();
// Print some params to handle it in js.
html_print_input_hidden('widget', $this->widget);
html_print_input_hidden('product_name', get_product_name());
html_print_input_hidden('center_logo', ui_get_full_url(ui_get_logo_to_center_networkmap()));

View File

@ -738,27 +738,36 @@ function add_new_link(new_link) {
}
function move_to_networkmap(node) {
var params = [];
params.push("get_networkmap_from_fictional=1");
params.push("id=" + node.id_db);
params.push("id_map=" + node.map_id);
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
// Checks if is widget or not
var widget = false;
widget = $("#hidden-widget").val();
jQuery.ajax({
data: params.join("&"),
dataType: "json",
type: "POST",
url: "ajax.php",
success: function(data) {
if (data["correct"]) {
window.location =
"index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&id_networkmap=" +
data["id_networkmap"];
} else {
edit_node(node, true);
if (widget == true) {
var id_cell = $(".widget_content").data("id_cell");
move_to_networkmap_widget(node.networkmap_id, id_cell);
} else {
var params = [];
params.push("get_networkmap_from_fictional=1");
params.push("id=" + node.id_db);
params.push("id_map=" + node.map_id);
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
jQuery.ajax({
data: params.join("&"),
dataType: "json",
type: "POST",
url: "ajax.php",
success: function(data) {
if (data["correct"]) {
window.location =
"index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&id_networkmap=" +
data["id_networkmap"];
} else {
edit_node(node, true);
}
}
}
});
});
}
}
function edit_node(data_node, dblClick) {
@ -4516,3 +4525,38 @@ function update_fictional_node_popup(id) {
color
);
}
function move_to_networkmap_widget(networkmap_id, id_cell) {
var params = [];
$(".widget_content").each(function(i) {
$("#body_cell").empty();
});
var pathname = window.location.pathname;
var path;
if (
pathname == "/pandora_console/enterprise/dashboard/public_dashboard.php"
) {
path = "../../ajax.php";
} else {
path = "ajax.php";
}
params.push("networkmap=true");
params.push("networkmap_id=" + networkmap_id);
params.push("page=enterprise/include/ajax/map_enterprise.ajax");
jQuery.ajax({
data: params.join("&"),
dataType: "html",
type: "POST",
url: path,
success: function(data) {
$(".widget_content").each(function(i) {
$("#body_cell").append(data);
});
}
});
}