";
// Set some containers to legend, graph, timestamp tooltip, etc.
- $return .= "
";
if (!empty($threshold_data)) {
$yellow_up = $threshold_data['yellow_up'];
@@ -265,7 +265,9 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
}
$return .= html_print_input_hidden('line_width_graph', $config['custom_graph_width'], true);
$return .= "
";
if ($menu) {
$height = 100;
}
@@ -598,7 +600,7 @@ function flot_custom_pie_chart ($flash_charts, $graph_values,
$graph_id = uniqid('graph_');
- $return = "
";
diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js
index c0742e65d4..86ab6bd914 100644
--- a/pandora_console/include/javascript/functions_pandora_networkmap.js
+++ b/pandora_console/include/javascript/functions_pandora_networkmap.js
@@ -172,7 +172,6 @@ function delete_link(source_id, source_module_id, target_id, target_module_id, i
init_drag_and_drop();
set_positions_graph();
}
-
$("#dialog_node_edit").dialog("close");
}
});
@@ -219,6 +218,43 @@ function update_fictional_node(id_db_node) {
}
}
+function update_node_name (id_db_node) {
+ if (enterprise_installed) {
+ var name = $("input[name='edit_name_node']").val();
+
+ var params = [];
+ params.push("update_node_name=1");
+ params.push("networkmap_id=" + networkmap_id);
+ params.push("node_id=" + id_db_node);
+ params.push("name=" + name);
+ params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
+
+ jQuery.ajax ({
+ data: params.join ("&"),
+ dataType: 'json',
+ type: 'POST',
+ url: action="ajax.php",
+ success: function (data) {
+ if (data['correct']) {
+ $("#dialog_node_edit").dialog("close");
+
+ jQuery.each(graph.nodes, function(i, element) {
+ if (element.id_db == id_db_node) {
+ graph.nodes[i].text = name;
+
+ $("#id_node_" + i + networkmap_id + " title").html(name);
+ $("#id_node_" + i + networkmap_id + " tspan").html(name);
+ }
+ });
+
+ draw_elements_graph();
+ set_positions_graph();
+ }
+ }
+ });
+ }
+}
+
function change_shape(id_db_node) {
if (enterprise_installed) {
var shape = $("select[name='shape']").val();
@@ -532,6 +568,9 @@ function update_link(row_index, id_link) {
temp_link["status_start"] = "0";
temp_link["status_end"] = "0";
+ temp_link["text_start"] = data["text_start"];
+ temp_link["text_end"] = data["text_end"];
+
$.each(graph.nodes, function(k, node) {
if (node['id_agent'] == data['id_db_target']) {
temp_link["target"] = graph.nodes[k];
@@ -579,7 +618,7 @@ function add_new_link (new_link) {
graph.links.push(new_link);
}
-function edit_node(data, dblClick) {
+function edit_node(data_node, dblClick) {
if (enterprise_installed) {
var flag_edit_node = true;
var edit_node = null
@@ -594,7 +633,7 @@ function edit_node(data, dblClick) {
edit_node = selection[0].pop();
}
else if (dblClick){
- edit_node = d3.select("#id_node_" + data['id'] + networkmap_id);
+ edit_node = d3.select("#id_node_" + data_node['id'] + networkmap_id);
edit_node = edit_node[0][0];
}
else {
@@ -615,18 +654,22 @@ function edit_node(data, dblClick) {
selected_links = get_relations(node_selected);
- $("select[name='shape'] option[value='" + data.shape + "']")
+ $("select[name='shape'] option[value='" + node_selected.shape + "']")
.prop("selected", true);
$("select[name='shape']").attr("onchange",
- "javascript: change_shape(" + data.id_db + ");");
+ "javascript: change_shape(" + node_selected.id_db + ");");
$("#node_options-fictional_node_update_button-1 input")
- .attr("onclick", "update_fictional_node(" + data.id_db + ");");
+ .attr("onclick", "update_fictional_node(" + node_selected.id_db + ");");
+
+ $("#node_options-node_name-2 input")
+ .attr("onclick", "update_node_name(" + node_selected.id_db + ");");
- $("#node_details-0-1").html('
');
var params = [];
params.push("get_agent_info=1");
- params.push("id_agent=" + data["id_agent"]);
+ params.push("id_agent=" + node_selected["id_agent"]);
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
+
jQuery.ajax ({
data: params.join ("&"),
dataType: 'json',
@@ -640,75 +683,47 @@ function edit_node(data, dblClick) {
$("#node_details-1-1").html(adressess);
$("#node_details-2-1").html(data["os"]);
$("#node_details-3-1").html(data["group"]);
- }
- });
-
- $("#interface_information").find("tr:gt(0)").remove();
-
- var params = [];
- params.push("get_interface_info=1");
- params.push("id_agent=" + data["id_agent"]);
- params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
- jQuery.ajax ({
- data: params.join ("&"),
- dataType: 'json',
- type: 'POST',
- url: action="ajax.php",
- success: function (data) {
- if (data.length == 0) {
- $("#interface_information").find('tbody')
- .append($('
')
- .append($('')
- .html(interface['name'])
- )
- .append($(' | ')
- .html(interface['status'])
- )
- .append($(' | ')
- .html(interface['graph'])
- )
- .append($(' | ')
- .html(interface['ip'])
- )
- .append($(' | ')
- .html(interface['mac'])
- )
- );
- });
- }
+
+ $('[aria-describedby=dialog_node_edit]').css({'top':'200px'});
+ $('#foot').css({'top':parseInt($("[aria-describedby=dialog_node_edit]").css('height')+$("[aria-describedby=dialog_node_edit]").css('top')),'position':'relative'});
+
+ get_interface_data_to_table(node_selected, selected_links);
}
});
$("#dialog_node_edit" )
.dialog( "option", "title",
- dialog_node_edit_title.replace("%s", data.text));
+ dialog_node_edit_title.replace("%s", node_selected.text));
$("#dialog_node_edit").dialog("open");
- if (data.id_agent == -2) {
+ if (node_selected.id_agent == undefined || node_selected.id_agent == -2) {
//Fictional node
$("#node_options-fictional_node_name")
.css("display", "");
$("input[name='edit_name_fictional_node']")
- .val(data.text);
+ .val(node_selected.text);
$("#node_options-fictional_node_networkmap_link")
.css("display", "");
$("#edit_networkmap_to_link")
- .val(data.networkmap_id);
+ .val(node_selected.networkmap_id);
$("#node_options-fictional_node_update_button")
.css("display", "");
+ $("#node_options-node_name")
+ .css("display", "none");
+ $("#node_options-node_update_button")
+ .css("display", "none");
}
else {
+ $("input[name='edit_name_node']")
+ .val(node_selected.text);
$("#node_options-fictional_node_name")
.css("display", "none");
$("#node_options-fictional_node_networkmap_link")
.css("display", "none");
$("#node_options-fictional_node_update_button")
.css("display", "none");
+ $("#node_options-node_name")
+ .css("display", "");
}
//Clean
@@ -716,124 +731,160 @@ function edit_node(data, dblClick) {
//Show the no relations
$("#relations_table-loading").css('display', 'none');
$("#relations_table-no_relations").css('display', '');
-
-
- jQuery.each(selected_links, function(i, link_each) {
-
- $("#relations_table-no_relations").css('display', 'none');
- $("#relations_table-loading").css('display', '');
-
- var template_relation_row = $("#relations_table-template_row")
- .clone();
-
- $(template_relation_row).css('display', '');
- $(template_relation_row).attr('class', 'relation_link_row');
-
- $("select[name='interface_source']", template_relation_row)
- .attr('name', "interface_source_" + i)
- .attr('id', "interface_source_" + i + networkmap_id);
- $("select[name='interface_target']", template_relation_row)
- .attr('name', "interface_target_" + i)
- .attr('id', "interface_target_" + i + networkmap_id);
- $(".edit_icon_progress", template_relation_row)
- .attr('class', "edit_icon_progress_" + i);
- $(".edit_icon", template_relation_row)
- .attr('class', "edit_icon_" + i);
- $(".edit_icon_correct", template_relation_row)
- .attr('class', "edit_icon_correct_" + i);
- $(".edit_icon_fail", template_relation_row)
- .attr('class', "edit_icon_fail_" + i);
- $(".edit_icon_link", template_relation_row)
- .attr('class', "edit_icon_link_" + i)
- .click(function() {
- update_link(i, link_each.id_db);
- }
- );
-
- var params = [];
- params.push("get_intefaces=1");
- params.push("id_agent=" + link_each.source.id_agent);
- params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
-
- jQuery.ajax ({
- data: params.join ("&"),
- dataType: 'json',
- type: 'POST',
- url: action="ajax.php",
- success: function (data) {
- if (data['correct']) {
- $("select[name='interface_source_" + i + "']", template_relation_row).empty();
- $("select[name='interface_source_" + i + "']", template_relation_row).append('');
- jQuery.each(data['interfaces'], function(j, interface) {
-
- $("select[name='interface_source_" + i + "']", template_relation_row)
- .append($("');
- jQuery.each(data['interfaces'], function(j, interface) {
- $("select[name='interface_target_" + i + "']", template_relation_row)
- .append($(" |