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; 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. * Shows the map using 100% of height and width if is a widget.
* *
@ -406,8 +413,10 @@ class NetworkMap
// Initialize as widget? // Initialize as widget?
if (isset($options['widget'])) { if (isset($options['widget'])) {
$this->fullSize = (bool) $options['widget']; $this->fullSize = (bool) $options['widget'];
$this->widget = true;
} else { } else {
$this->fullSize = true; $this->fullSize = true;
$this->widget = false;
} }
// Use a custom parser. // Use a custom parser.
@ -2689,6 +2698,7 @@ class NetworkMap
$this->cleanGraphRelations(); $this->cleanGraphRelations();
// Print some params to handle it in js. // 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('product_name', get_product_name());
html_print_input_hidden('center_logo', ui_get_full_url(ui_get_logo_to_center_networkmap())); 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) { function move_to_networkmap(node) {
var params = []; // Checks if is widget or not
params.push("get_networkmap_from_fictional=1"); var widget = false;
params.push("id=" + node.id_db); widget = $("#hidden-widget").val();
params.push("id_map=" + node.map_id);
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
jQuery.ajax({ if (widget == true) {
data: params.join("&"), var id_cell = $(".widget_content").data("id_cell");
dataType: "json", move_to_networkmap_widget(node.networkmap_id, id_cell);
type: "POST", } else {
url: "ajax.php", var params = [];
success: function(data) { params.push("get_networkmap_from_fictional=1");
if (data["correct"]) { params.push("id=" + node.id_db);
window.location = params.push("id_map=" + node.map_id);
"index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&id_networkmap=" + params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
data["id_networkmap"];
} else { jQuery.ajax({
edit_node(node, true); 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) { function edit_node(data_node, dblClick) {
@ -4516,3 +4525,38 @@ function update_fictional_node_popup(id) {
color 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);
});
}
});
}