From 0055e46940e97ae6daf7e213d2fbca8a0b5a971f Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Fri, 30 Sep 2016 14:29:20 +0200 Subject: [PATCH] New networkmaps in progress... (Added new "node details" section) --- .../include/functions_pandora_networkmap.php | 64 +++++++++-------- .../functions_pandora_networkmap.js | 69 ++++++------------- 2 files changed, 59 insertions(+), 74 deletions(-) diff --git a/pandora_console/include/functions_pandora_networkmap.php b/pandora_console/include/functions_pandora_networkmap.php index 47f4041bc7..ea2e8606a0 100644 --- a/pandora_console/include/functions_pandora_networkmap.php +++ b/pandora_console/include/functions_pandora_networkmap.php @@ -566,8 +566,6 @@ function networkmap_write_js_array($id, $nodes_and_relations = array()) { echo "\n"; echo "var url_background_grid = '" . ui_get_full_url( 'images/background_grid.png') . "'\n"; - echo "var url_popup_pandora = '" . ui_get_full_url( - 'operation/agentes/pandora_networkmap.popup.php') . "'\n"; echo "var networkmap_id = " . $id . ";\n"; echo "var networkmap_refresh_time = 1000 * " . $networkmap['source_period'] . ";\n"; @@ -1304,7 +1302,6 @@ function show_networkmap($id = 0, $user_readonly = false, $nodes_and_relations = refesh_period: networkmap_refresh_time, graph: networkmap, networkmap_center: networkmap_center, - url_popup: url_popup_pandora, networkmap_dimensions: networkmap_dimensions, enterprise_installed: enterprise_installed, holding_area_dimensions: networkmap_holding_area_dimensions, @@ -1338,6 +1335,23 @@ if (empty($list_networkmaps))
id = 'node_details'; + $table->width = "100%"; + + $table->data = array(); + $table->data[0][0] = __('Agent'); + $table->data[0][1] = ""; + $table->data[1][0] = __('Adresses'); + $table->data[1][1] = ""; + $table->data[2][0] = __('OS type'); + $table->data[2][1] = ""; + $table->data[3][0] = __('Group'); + $table->data[3][1] = ""; + + ui_toggle(html_print_table($table, true), __('Node Details'), + __('Node Details'), false); + $table = null; $table->id = 'node_options'; $table->width = "100%"; @@ -1376,40 +1390,36 @@ if (empty($list_networkmaps)) $table->head = array(); $table->head['node_source'] = __('Node source'); - if ($networkmap['options']['l2_network_interfaces']) { - $table->head['interface_source'] = __('Interface source'); - $table->head['interface_target'] = __('Interface Target'); - } + $table->head['interface_source'] = __('Interface source'); + $table->head['interface_target'] = __('Interface Target'); + $table->head['node_target'] = __('Node target'); $table->head['edit'] = '' . __('E.') . ''; $table->data = array(); $table->rowstyle['template_row'] = 'display: none;'; $table->data['template_row']['node_source'] = ''; - if ($networkmap['options']['l2_network_interfaces']) { - $table->data['template_row']['interface_source'] = - html_print_select(array(), 'interface_source', '', '', - __('None'), 0, true); - $table->data['template_row']['interface_target'] = - html_print_select(array(), 'interface_target', '', '', - __('None'), 0, true); - } + $table->data['template_row']['interface_source'] = + html_print_select(array(), 'interface_source', '', '', + __('None'), 0, true); + $table->data['template_row']['interface_target'] = + html_print_select(array(), 'interface_target', '', '', + __('None'), 0, true); + $table->data['template_row']['node_target'] = ''; $table->data['template_row']['edit'] = ""; $table->data['template_row']['edit'] = ''; - if ($networkmap['options']['l2_network_interfaces']) { - $table->data['template_row']['edit'] .= - '' . - '' . - '' . - '' . - html_print_image('images/config.png', true) . ''; - } + $table->data['template_row']['edit'] .= + '' . + '' . + '' . + '' . + html_print_image('images/config.png', true) . ''; $table->data['template_row']['edit'] .= '' . @@ -1426,7 +1436,7 @@ if (empty($list_networkmaps)) ui_toggle(html_print_table($table, true), __('Relations'), - __('Relations'), false); + __('Relations'), true); ?>
diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index 2596021756..2e2420caf2 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -245,7 +245,6 @@ function change_shape(id_db_node) { .on("mouseover", over_node) .on("mouseout", over_node) .on("click", selected_node) - .on("dblclick", show_details_agent) .on("contextmenu", function(d) { show_menu("node", d);}); } @@ -262,7 +261,6 @@ function change_shape(id_db_node) { .on("mouseover", over_node) .on("mouseout", over_node) .on("click", selected_node) - .on("dblclick", show_details_agent) .on("contextmenu", function(d) { show_menu("node", d);}); } @@ -281,7 +279,6 @@ function change_shape(id_db_node) { .on("mouseover", over_node) .on("mouseout", over_node) .on("click", selected_node) - .on("dblclick", show_details_agent) .on("contextmenu", function(d) { show_menu("node", d);}); } @@ -510,6 +507,27 @@ function edit_node(data) { $("#node_options-fictional_node_update_button-1 input") .attr("onclick", "update_fictional_node(" + data.id_db + ");"); + $("#node_details-0-1").html(data["text"]); + var params = []; + params.push("get_agent_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", + async: false, + success: function (data) { + var adressess = ""; + for (adress in data['adressess']) { + adressess += adress + "
"; + } + $("#node_details-1-1").html(adressess); + $("#node_details-2-1").html(data["os"]); + $("#node_details-3-1").html(data["group"]); + } + }); $("#dialog_node_edit" ) .dialog( "option", "title", @@ -809,31 +827,6 @@ function add_agent_node(agents) { } } -function show_details_agent(d) { - if (d.map_id != 0) { - url = "index.php?" + - "sec=network&" + - "sec2=operation/agentes/pandora_networkmap&" + - "tab=view&" + - "id_networkmap=" + d.map_id; - - window.location.href = url; - } - if (d.id_agent == -2) { - //Fictional node without link - } - else { - url = url_popup; - url = url + "?refresh_state=" + refresh_period; - url = url + "&id=" + d.id_db; - url = url + "&id_agent=" + d.id_agent; - - popup = window.open(url, 'Details' + d.text, 'width=800,height=600'); - } - - return false; -} - function toggle_minimap() { if (show_minimap) { @@ -1251,15 +1244,8 @@ function show_menu(item, data) { var items_list = {}; items_list["details"] = { - name: show_details_menu, - icon: "details", - "callback": function(key, options) { - show_details_agent(data); - } - }; - items_list["edit"] = { name: edit_menu, - icon: "edit", + icon: "details", disabled : function() { if (enterprise_installed) { return false; @@ -1877,7 +1863,6 @@ function init_graph(parameter_object) { window.selection_rectangle = [0, 0, 0, 0]; window.flag_drag_running = false; window.in_a_node = false; - window.url_popup = ""; window.enterprise_installed = false; window.flag_setting_relationship_running = false; @@ -1911,11 +1896,6 @@ function init_graph(parameter_object) { translation[0] = translation[0] * scale; translation[1] = translation[1] * scale; - window.url_popup = ''; - if (typeof(parameter_object.url_popup) != "undefined") { - window.url_popup = parameter_object.url_popup; - } - window.enterprise_installed = ''; if (typeof(parameter_object.enterprise_installed) != "undefined") { window.enterprise_installed = parameter_object.enterprise_installed; @@ -2405,7 +2385,6 @@ function draw_elements_graph() { .on("mouseover", over_node) .on("mouseout", over_node) .on("click", selected_node) - .on("dblclick", show_details_agent) .on("contextmenu", function(d) { show_menu("node", d);}); //Shape square @@ -2424,7 +2403,6 @@ function draw_elements_graph() { .on("mouseover", over_node) .on("mouseout", over_node) .on("click", selected_node) - .on("dblclick", show_details_agent) .on("contextmenu", function(d) { show_menu("node", d);}); //Shape rhombus @@ -2445,7 +2423,6 @@ function draw_elements_graph() { .on("mouseover", over_node) .on("mouseout", over_node) .on("click", selected_node) - .on("dblclick", show_details_agent) .on("contextmenu", function(d) { show_menu("node", d);}); node_temp.append("title") @@ -2473,7 +2450,6 @@ function draw_elements_graph() { .on("mouseover", over_node) .on("mouseout", over_node) .on("click", selected_node) - .on("dblclick", show_details_agent) .on("contextmenu", function(d) { show_menu("node", d);}); node_temp.append("text") @@ -2494,7 +2470,6 @@ function draw_elements_graph() { .on("mouseover", over_node) .on("mouseout", over_node) .on("click", selected_node) - .on("dblclick", show_details_agent) .on("contextmenu", function(d) { show_menu("node", d);}); node.exit().remove();