diff --git a/pandora_console/images/reset.png b/pandora_console/images/reset.png new file mode 100644 index 0000000000..a3304f8263 Binary files /dev/null and b/pandora_console/images/reset.png differ diff --git a/pandora_console/include/functions_pandora_networkmap.php b/pandora_console/include/functions_pandora_networkmap.php index 0e0b9787b1..72f0805adf 100644 --- a/pandora_console/include/functions_pandora_networkmap.php +++ b/pandora_console/include/functions_pandora_networkmap.php @@ -477,6 +477,7 @@ function networkmap_db_node_to_js_node($node, &$count, &$count_item_holding_area $item['py'] = (int)$node['y']; $item['z'] = (int)$node['z']; $item['state'] = $node['state']; + $item['deleted'] = $node['deleted']; if ($item['state'] == 'holding_area') { //40 = DEFAULT NODE RADIUS //30 = for to align @@ -662,6 +663,7 @@ function networkmap_links_to_js_links($relations, $nodes_graph) { $item['id_agent_end'] = (int)$id_target_agent; $item['target'] = -1; $item['source'] = -1; + $item['deleted'] = $relation['deleted']; if (enterprise_installed()) { $target_and_source = array(); @@ -859,7 +861,9 @@ function networkmap_write_js_array($id, $nodes_and_relations = array(), $map_das $item = networkmap_db_node_to_js_node( $node, $count, $count_item_holding_area); - + if ($item['deleted']) { + continue; + } echo "networkmap.nodes.push(" . json_encode($item) . ");\n"; $nodes_graph[$item['id']] = $item; } @@ -875,6 +879,9 @@ function networkmap_write_js_array($id, $nodes_and_relations = array(), $map_das $links_js = networkmap_links_to_js_links($relations, $nodes_graph); foreach ($links_js as $link_js) { + if ($link_js['deleted']) { + continue; + } if ($link_js['target'] == -1) continue; if ($link_js['source'] == -1) @@ -932,6 +939,12 @@ function networkmap_write_js_array($id, $nodes_and_relations = array(), $map_das echo "var set_center_menu = '" . __('Set center') . "';\n"; echo "var refresh_menu = '" . __('Refresh') . "';\n"; echo "var refresh_holding_area_menu = '" . __('Refresh Holding area') . "';\n"; + echo "var ok_button = '" . __('Proceed') . "';\n"; + echo "var message_to_confirm = '" . __('Resetting the map will delete all customizations you have done, including manual relationships between elements, new items, etc.') . "';\n"; + echo "var warning_message = '" . __('WARNING') . "';\n"; + echo "var ok_button = '" . __('Proceed') . "';\n"; + echo "var cancel_button = '" . __('Cancel') . "';\n"; + echo "var restart_map_menu = '" . __('Restart map') . "';\n"; echo "var abort_relationship_interface = '" . __('Abort the interface relationship') . "';\n"; echo "var abort_relationship_menu = '" . __('Abort the action of set relationship') . "';\n"; diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index 6b4cd0d415..05ebe8e9d9 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -1900,6 +1900,21 @@ function show_menu(item, data) { refresh_holding_area(); } }; + items_list["restart_map"] = { + name: restart_map_menu, + icon: "restart_map", + disabled: function () { + if (enterprise_installed) { + return false; + } + else { + return true; + } + }, + "callback": function (key, options) { + restart_map(networkmap_id); + } + }; if (flag_setting_relationship_running) { items_list["cancel_set_parent"] = { @@ -2140,6 +2155,7 @@ function refresh_holding_area() { temp_node['image_url'] = node['image_url']; temp_node['image_width'] = node['image_width']; temp_node['image_height'] = node['image_width']; + temp_node['deleted'] = false; graph.nodes.push(temp_node); }); @@ -2210,6 +2226,123 @@ function refresh_holding_area() { } } +function restart_map (map_id) { + $("
").dialog ({ + resizable: true, + draggable: true, + modal: true, + overlay: { + opacity: 0.5, + background: 'black' + }, + width: 600, + height: 250, + buttons: [ + { + text: ok_button, + click: function () { + $(this).dialog("close"); + proceed_to_restart_map(map_id); + } + }, + { + text:cancel_button, + click: function () { + $(this).dialog("close"); + } + } + ] + }); + + var dialog_confirm_text = "" + message_to_confirm + "