mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
Merge branch '1537-new-option-in-networkmaps-to-reset-the-map-dev' into 'develop'
Added new option to networkmap, reset See merge request artica/pandorafms!1035
This commit is contained in:
commit
8e71f632e8
BIN
pandora_console/images/reset.png
Normal file
BIN
pandora_console/images/reset.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 545 B |
@ -477,6 +477,7 @@ function networkmap_db_node_to_js_node($node, &$count, &$count_item_holding_area
|
|||||||
$item['py'] = (int)$node['y'];
|
$item['py'] = (int)$node['y'];
|
||||||
$item['z'] = (int)$node['z'];
|
$item['z'] = (int)$node['z'];
|
||||||
$item['state'] = $node['state'];
|
$item['state'] = $node['state'];
|
||||||
|
$item['deleted'] = $node['deleted'];
|
||||||
if ($item['state'] == 'holding_area') {
|
if ($item['state'] == 'holding_area') {
|
||||||
//40 = DEFAULT NODE RADIUS
|
//40 = DEFAULT NODE RADIUS
|
||||||
//30 = for to align
|
//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['id_agent_end'] = (int)$id_target_agent;
|
||||||
$item['target'] = -1;
|
$item['target'] = -1;
|
||||||
$item['source'] = -1;
|
$item['source'] = -1;
|
||||||
|
$item['deleted'] = $relation['deleted'];
|
||||||
|
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
$target_and_source = array();
|
$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(
|
$item = networkmap_db_node_to_js_node(
|
||||||
$node, $count, $count_item_holding_area);
|
$node, $count, $count_item_holding_area);
|
||||||
|
if ($item['deleted']) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
echo "networkmap.nodes.push(" . json_encode($item) . ");\n";
|
echo "networkmap.nodes.push(" . json_encode($item) . ");\n";
|
||||||
$nodes_graph[$item['id']] = $item;
|
$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);
|
$links_js = networkmap_links_to_js_links($relations, $nodes_graph);
|
||||||
|
|
||||||
foreach ($links_js as $link_js) {
|
foreach ($links_js as $link_js) {
|
||||||
|
if ($link_js['deleted']) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if ($link_js['target'] == -1)
|
if ($link_js['target'] == -1)
|
||||||
continue;
|
continue;
|
||||||
if ($link_js['source'] == -1)
|
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 set_center_menu = '" . __('Set center') . "';\n";
|
||||||
echo "var refresh_menu = '" . __('Refresh') . "';\n";
|
echo "var refresh_menu = '" . __('Refresh') . "';\n";
|
||||||
echo "var refresh_holding_area_menu = '" . __('Refresh Holding area') . "';\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_interface = '" . __('Abort the interface relationship') . "';\n";
|
||||||
echo "var abort_relationship_menu = '" . __('Abort the action of set relationship') . "';\n";
|
echo "var abort_relationship_menu = '" . __('Abort the action of set relationship') . "';\n";
|
||||||
|
|
||||||
|
@ -1900,6 +1900,21 @@ function show_menu(item, data) {
|
|||||||
refresh_holding_area();
|
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) {
|
if (flag_setting_relationship_running) {
|
||||||
items_list["cancel_set_parent"] = {
|
items_list["cancel_set_parent"] = {
|
||||||
@ -2140,6 +2155,7 @@ function refresh_holding_area() {
|
|||||||
temp_node['image_url'] = node['image_url'];
|
temp_node['image_url'] = node['image_url'];
|
||||||
temp_node['image_width'] = node['image_width'];
|
temp_node['image_width'] = node['image_width'];
|
||||||
temp_node['image_height'] = node['image_width'];
|
temp_node['image_height'] = node['image_width'];
|
||||||
|
temp_node['deleted'] = false;
|
||||||
|
|
||||||
graph.nodes.push(temp_node);
|
graph.nodes.push(temp_node);
|
||||||
});
|
});
|
||||||
@ -2210,6 +2226,123 @@ function refresh_holding_area() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function restart_map (map_id) {
|
||||||
|
$("<div id='restart_map_confirm' class='dialog ui-dialog-content' title='" + restart_map_menu + "'></div>").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 = "<div>";
|
||||||
|
dialog_confirm_text = dialog_confirm_text + "<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='images/icono_info_mr.png'></div>";
|
||||||
|
dialog_confirm_text = dialog_confirm_text + "<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>" + warning_message + "</strong></h3>";
|
||||||
|
dialog_confirm_text = dialog_confirm_text + "<p style='font-family:Verdana; font-size:12pt;'>" + message_to_confirm + "</p></div>";
|
||||||
|
dialog_confirm_text = dialog_confirm_text + "</div>";
|
||||||
|
|
||||||
|
$('#restart_map_confirm').html(dialog_confirm_text);
|
||||||
|
$('#restart_map_confirm').dialog('open');
|
||||||
|
}
|
||||||
|
|
||||||
|
function proceed_to_restart_map (map_id) {
|
||||||
|
$("<div id='restart_map_form' class='dialog ui-dialog-content' title='" + restart_map_menu + "'></div>").dialog ({
|
||||||
|
resizable: true,
|
||||||
|
draggable: true,
|
||||||
|
modal: true,
|
||||||
|
overlay: {
|
||||||
|
opacity: 0.5,
|
||||||
|
background: 'black'
|
||||||
|
},
|
||||||
|
width: 600,
|
||||||
|
height: 450,
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: ok_button,
|
||||||
|
click: function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
var new_elements = [];
|
||||||
|
new_elements[0] = $("#text-name").val();
|
||||||
|
new_elements[1] = $("#id_group").val();
|
||||||
|
new_elements[2] = $("#text-node_radius").val();
|
||||||
|
new_elements[3] = $("#textarea_description").val();
|
||||||
|
new_elements[4] = $("input[name=source]:checked").val();
|
||||||
|
if (new_elements[4] == 'group') {
|
||||||
|
new_elements[5] = $("#checkbox-dont_show_subgroups").is(':checked');
|
||||||
|
}
|
||||||
|
else if (new_elements[4] == 'recon_task') {
|
||||||
|
new_elements[5] = $("#recon_task_id").val();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
new_elements[5] = $("#text-ip_mask").val();
|
||||||
|
}
|
||||||
|
new_elements[6] = $("#method").val();
|
||||||
|
reset_map_from_form(map_id, new_elements);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text:cancel_button,
|
||||||
|
click: function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
var params = [];
|
||||||
|
params.push("get_reset_map_form=1");
|
||||||
|
params.push("map_id=" + map_id);
|
||||||
|
params.push("page=enterprise/operation/agentes/pandora_networkmap.view");
|
||||||
|
jQuery.ajax({
|
||||||
|
data: params.join("&"),
|
||||||
|
dataType: 'html',
|
||||||
|
type: 'POST',
|
||||||
|
url: action = "ajax.php",
|
||||||
|
success: function (data) {
|
||||||
|
$('#restart_map_form').html(data);
|
||||||
|
$('#restart_map_form').dialog('open');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset_map_from_form (map_id, new_elements) {
|
||||||
|
var params = [];
|
||||||
|
params.push("reset_map=1");
|
||||||
|
params.push("map_id=" + map_id);
|
||||||
|
params.push("elems[]=" + new_elements)
|
||||||
|
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['error']) {
|
||||||
|
location.reload(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function set_parent(parent_data) {
|
function set_parent(parent_data) {
|
||||||
if (enterprise_installed) {
|
if (enterprise_installed) {
|
||||||
var selection = d3.selectAll('.node_children');
|
var selection = d3.selectAll('.node_children');
|
||||||
@ -3017,9 +3150,18 @@ function myMouseoutRhombusFunction(node_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function draw_elements_graph() {
|
function draw_elements_graph() {
|
||||||
link = link.data(force.links(), function (d) {
|
link = link.data(force.links().filter(function(d, i) {
|
||||||
return d.source.id + networkmap_id + "-" + d.target.id + networkmap_id + Math.random();
|
if (d['deleted']) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
function (d) {
|
||||||
|
return d.source.id + networkmap_id + "-" + d.target.id + networkmap_id + Math.random();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
link_temp = link.enter()
|
link_temp = link.enter()
|
||||||
.append("g")
|
.append("g")
|
||||||
@ -3201,7 +3343,14 @@ function draw_elements_graph() {
|
|||||||
return (Array(25).join(" ")) + text_link;
|
return (Array(25).join(" ")) + text_link;
|
||||||
});
|
});
|
||||||
|
|
||||||
node = node.data(force.nodes(), function (d) { return d.id; });
|
node = node.data(force.nodes().filter(function(d, i) {
|
||||||
|
if (d['deleted']) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}), function (d) { return d.id; });
|
||||||
|
|
||||||
node_temp = node.enter()
|
node_temp = node.enter()
|
||||||
.append("g")
|
.append("g")
|
||||||
|
@ -117,6 +117,7 @@
|
|||||||
.context-menu-item.icon-set_parent { background-image: url(../../images/father.png); }
|
.context-menu-item.icon-set_parent { background-image: url(../../images/father.png); }
|
||||||
.context-menu-item.icon-add_node { background-image: url(../../images/add.png); }
|
.context-menu-item.icon-add_node { background-image: url(../../images/add.png); }
|
||||||
.context-menu-item.icon-refresh_holding_area { background-image: url(../../images/refresh_holding_area.png); }
|
.context-menu-item.icon-refresh_holding_area { background-image: url(../../images/refresh_holding_area.png); }
|
||||||
|
.context-menu-item.icon-restart_map { background-image: url(../../images/reset.png); }
|
||||||
.context-menu-item.icon-interface_link_children { background-image: url(../../images/icono_link_hijo.png); }
|
.context-menu-item.icon-interface_link_children { background-image: url(../../images/icono_link_hijo.png); }
|
||||||
.context-menu-item.icon-interface_link_parent { background-image: url(../../images/icono_link_padre.png); }
|
.context-menu-item.icon-interface_link_parent { background-image: url(../../images/icono_link_padre.png); }
|
||||||
.context-menu-item.icon-interface_link_cancel { background-image: url(../../images/link_abortar.png); }
|
.context-menu-item.icon-interface_link_cancel { background-image: url(../../images/link_abortar.png); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user