8898 Refresh time
This commit is contained in:
parent
b58b0d6c51
commit
182bb2d2c4
|
@ -941,6 +941,7 @@ class HostDevices extends Wizard
|
|||
'return' => true,
|
||||
'class' => 'discovery_list_input',
|
||||
'simple_multiple_options' => true,
|
||||
'required' => true,
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -1001,6 +1002,7 @@ class HostDevices extends Wizard
|
|||
$("#text-interval_text").val(10);
|
||||
$("#hidden-interval").val('.$interval.');
|
||||
$("#interval_units").val('.$unit.');
|
||||
$("#interval_units").trigger("change");
|
||||
}
|
||||
}).change();
|
||||
|
||||
|
|
|
@ -594,6 +594,7 @@ class CustomNetScan extends Wizard
|
|||
$("#text-interval_text").val(10);
|
||||
$("#hidden-interval").val('.$interval.');
|
||||
$("#interval_units").val('.$unit.');
|
||||
$("#interval_units").trigger("change");
|
||||
}
|
||||
}).change();
|
||||
';
|
||||
|
|
|
@ -2799,7 +2799,6 @@ class NetworkMap
|
|||
$output .= "var add_node_menu = '".__('Add node')."';\n";
|
||||
$output .= "var set_center_menu = '".__('Set center')."';\n";
|
||||
$output .= "var refresh_menu = '".__('Refresh')."';\n";
|
||||
$output .= "var refresh_holding_area_menu = '".__('Refresh Holding area')."';\n";
|
||||
$output .= "var ok_button = '".__('Proceed')."';\n";
|
||||
$output .= "var message_to_confirm = '".__('Resetting the map will delete all customizations you have done, including manual relationships between elements, new items, etc.')."';\n";
|
||||
$output .= "var warning_message = '".__('WARNING')."';\n";
|
||||
|
@ -3504,6 +3503,10 @@ class NetworkMap
|
|||
$output .= ' style="width: '.$this->mapOptions['width'].'px; height: '.$this->mapOptions['height'].'px;position: relative; overflow: hidden; background: #FAFAFA">';
|
||||
}
|
||||
|
||||
$output .= '<div id="spinner_networkmap" style="position: absolute; width: 100%;height: 100%; z-index:1; justify-content: center; align-items: center; display:none; background-color:rgba(0, 0, 0, 0.2);">';
|
||||
$output .= html_print_image('/images/spinner.gif', true, ['style' => 'width: 22px; height: 22px']);
|
||||
$output .= '</div>';
|
||||
|
||||
$output .= '<div style="display: '.$minimap_display.';">';
|
||||
$output .= '<canvas id="minimap_'.$networkmap['id'].'"';
|
||||
$output .= ' class="minimap">';
|
||||
|
|
|
@ -3525,6 +3525,7 @@ function update_node($node, $holding_area_x, $holding_area_y)
|
|||
$values = [];
|
||||
$values['x'] = $node['x'];
|
||||
$values['y'] = $node['y'];
|
||||
$values['refresh'] = 0;
|
||||
|
||||
if ($node['state'] === 'holding_area') {
|
||||
$networkmap_node = db_get_row_filter(
|
||||
|
@ -3547,14 +3548,9 @@ function update_node($node, $holding_area_x, $holding_area_y)
|
|||
) {
|
||||
// Inside holding area.
|
||||
$return['state'] = 'holding_area';
|
||||
$values['refresh'] = 1;
|
||||
} else {
|
||||
// The user move the node out the holding area.
|
||||
db_process_sql_update(
|
||||
'titem',
|
||||
['refresh' => 0],
|
||||
['id' => $node['id_db']]
|
||||
);
|
||||
|
||||
$return['state'] = '';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2098,15 +2098,9 @@ function show_menu(item, data) {
|
|||
icon: "refresh",
|
||||
disabled: false,
|
||||
callback: function(key, options) {
|
||||
update_networkmap();
|
||||
}
|
||||
};
|
||||
items_list["refresh_holding_area"] = {
|
||||
name: refresh_holding_area_menu,
|
||||
icon: "refresh_holding_area",
|
||||
disabled: false,
|
||||
callback: function(key, options) {
|
||||
refresh_holding_area();
|
||||
refresh();
|
||||
// refresh_holding_area();
|
||||
// update_networkmap();
|
||||
}
|
||||
};
|
||||
items_list["restart_map"] = {
|
||||
|
@ -2466,6 +2460,58 @@ function refresh_holding_area() {
|
|||
});
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
$("#spinner_networkmap").css("display", "flex");
|
||||
var holding_pos_x = d3.select("#holding_area_" + networkmap_id).attr("x");
|
||||
var holding_pos_y = d3.select("#holding_area_" + networkmap_id).attr("y");
|
||||
|
||||
var pos_x = parseInt(holding_pos_x) + parseInt(node_radius);
|
||||
var pos_y = parseInt(holding_pos_y) + parseInt(node_radius);
|
||||
|
||||
var params = [];
|
||||
params.push("refresh_holding_area=1");
|
||||
params.push("id=" + networkmap_id);
|
||||
params.push("x=" + pos_x);
|
||||
params.push("y=" + pos_y);
|
||||
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||
$.ajax({
|
||||
data: {
|
||||
page: "operation/agentes/pandora_networkmap.view",
|
||||
refresh_holding_area: 1,
|
||||
id: networkmap_id,
|
||||
x: pos_x,
|
||||
y: pos_y
|
||||
},
|
||||
dataType: "json",
|
||||
type: "POST",
|
||||
url: window.base_url_homedir + "/ajax.php",
|
||||
success: function(data) {
|
||||
if (data["correct"]) {
|
||||
const array_nodes = data["holding_area"]["nodes"];
|
||||
let array_links = data["holding_area"]["links"];
|
||||
jQuery.each(graph.links, function(j, g_link) {
|
||||
for (var i = 0; i < array_links.length; i++) {
|
||||
if (g_link["id_db"] == array_links[i]["id_db"]) {
|
||||
array_links.splice(i, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (array_nodes.length === 0 && array_links.length === 0) {
|
||||
update_networkmap();
|
||||
$("#spinner_networkmap").css("display", "none");
|
||||
} else {
|
||||
console.log("hay algun nodo o link nuevo, toca repintar mapa");
|
||||
// crear una funcion donde se llame a graphviz y se reciban las nuevas posiciones, pero sin borrar links.
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(e) {
|
||||
$("#spinner_networkmap").css("display", "none");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function restart_map() {
|
||||
$(
|
||||
"<div id='restart_map_confirm' class='dialog ui-dialog-content' title='" +
|
||||
|
|
|
@ -61,6 +61,7 @@ if ($new_networkmap) {
|
|||
$rank_sep = 1.0;
|
||||
$mindist = 1.0;
|
||||
$kval = 5;
|
||||
$refresh_time = 300;
|
||||
}
|
||||
|
||||
$disabled_generation_method_select = false;
|
||||
|
@ -137,6 +138,8 @@ if ($edit_networkmap) {
|
|||
$kval = 0.3;
|
||||
}
|
||||
|
||||
$refresh_time = $values['refresh_time'];
|
||||
|
||||
$node_radius = $filter['node_radius'];
|
||||
|
||||
$source = $values['source'];
|
||||
|
@ -449,6 +452,19 @@ if ($not_found) {
|
|||
$table->data['kval'][0] = __('Default ideal node separation');
|
||||
$table->data['kval'][1] = html_print_input_text('kval', $kval, '', 5, 10, true, $disabled_source, false, $itemClass).ui_print_help_tip(__('Only fdp. Default ideal node separation in the layout. By default 0.3'), true);
|
||||
|
||||
$table->data['refresh'][0] = __('Refresh');
|
||||
$table->data['refresh'][1] = html_print_extended_select_for_time(
|
||||
'refresh_time',
|
||||
$refresh_time,
|
||||
'',
|
||||
'',
|
||||
'0',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
echo '<form id="networkmap_options_form" method="post" action="index.php?sec=network&sec2=operation/agentes/pandora_networkmap">';
|
||||
|
||||
html_print_table($table);
|
||||
|
@ -628,9 +644,9 @@ $(document).ready(function() {
|
|||
event.preventDefault();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$("#refresh_units").trigger("change");
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -288,6 +288,8 @@ if ($new_networkmap || $save_networkmap) {
|
|||
$mindist = get_parameter('mindist', '1.0');
|
||||
$kval = get_parameter('kval', '0.3');
|
||||
|
||||
$refresh_time = get_parameter('refresh_time', '300');
|
||||
|
||||
$values = [];
|
||||
$values['name'] = $name;
|
||||
$values['id_group'] = $id_group;
|
||||
|
@ -297,6 +299,7 @@ if ($new_networkmap || $save_networkmap) {
|
|||
$values['id_user'] = $config['id_user'];
|
||||
$values['description'] = $description;
|
||||
$values['id_group_map'] = $id_group_map;
|
||||
$values['refresh_time'] = $refresh_time;
|
||||
|
||||
switch ($method) {
|
||||
case 'twopi':
|
||||
|
@ -473,6 +476,8 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
|||
$offset_y = get_parameter('pos_y', 0);
|
||||
$scale_z = get_parameter('scale_z', 0.5);
|
||||
|
||||
$refresh_time = get_parameter('refresh_time', '300');
|
||||
|
||||
$values = [];
|
||||
$values['name'] = $name;
|
||||
$values['id_group'] = $id_group;
|
||||
|
@ -481,6 +486,8 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
|||
$description = get_parameter('description', '');
|
||||
$values['description'] = $description;
|
||||
|
||||
$values['refresh_time'] = $refresh_time;
|
||||
|
||||
$dont_show_subgroups = (int) get_parameter('dont_show_subgroups', 0);
|
||||
$node_radius = (int) get_parameter('node_radius', 40);
|
||||
$row = db_get_row('tmap', 'id', $id);
|
||||
|
|
|
@ -76,6 +76,7 @@ if (is_ajax() === true) {
|
|||
$get_networkmap_from_fictional = (bool) get_parameter('get_networkmap_from_fictional', false);
|
||||
$get_reset_map_form = (bool) get_parameter('get_reset_map_form', false);
|
||||
$reset_map = (bool) get_parameter('reset_map', false);
|
||||
$refresh_map = (bool) get_parameter('refresh_map', false);
|
||||
|
||||
if ($get_reset_map_form) {
|
||||
$map_id = get_parameter('map_id');
|
||||
|
@ -937,6 +938,7 @@ if (is_ajax() === true) {
|
|||
}
|
||||
|
||||
if ($refresh_holding_area) {
|
||||
ob_start();
|
||||
$networkmap_id = (int) get_parameter('id', 0);
|
||||
$x = (int) get_parameter('x', 666);
|
||||
$y = (int) get_parameter('y', 666);
|
||||
|
@ -944,12 +946,11 @@ if (is_ajax() === true) {
|
|||
$return['correct'] = false;
|
||||
$return['holding_area'] = [];
|
||||
|
||||
// ACL for the network map
|
||||
// ACL for the network map.
|
||||
$id_group = db_get_value('id_group', 'tmap', 'id', $networkmap_id);
|
||||
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
|
||||
$networkmap_write = check_acl($config['id_user'], $id_group, 'MW');
|
||||
$networkmap_manage = check_acl($config['id_user'], $id_group, 'MM');
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
|
@ -966,6 +967,8 @@ if (is_ajax() === true) {
|
|||
$return['holding_area'] = $data;
|
||||
}
|
||||
|
||||
ob_end_clean();
|
||||
|
||||
echo json_encode($return);
|
||||
|
||||
return;
|
||||
|
|
|
@ -2317,6 +2317,7 @@ CREATE TABLE IF NOT EXISTS `tmap` (
|
|||
`generated` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`filter` TEXT,
|
||||
`id_group_map` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`refresh_time` INT UNSIGNED NOT NULL DEFAULT 300,
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||
|
||||
|
|
Loading…
Reference in New Issue