mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
Merge branch 'ent-7651-anadir-nodos-filtrando-por-grupo-en-un-mapa-de-red-no-es-recursivo' into 'develop'
Added checkbox for group recursion in network maps See merge request artica/pandorafms!4297
This commit is contained in:
commit
9beda8eada
@ -3205,6 +3205,16 @@ class NetworkMap
|
|||||||
-1,
|
-1,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$table->data[0][2] = html_print_checkbox(
|
||||||
|
'group_recursion',
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
'choose_group_for_show_agents()'
|
||||||
|
).__('Recursion');
|
||||||
|
|
||||||
$table->data[1][0] = __('Agents');
|
$table->data[1][0] = __('Agents');
|
||||||
$table->data[1][1] = html_print_select(
|
$table->data[1][1] = html_print_select(
|
||||||
[-1 => __('None')],
|
[-1 => __('None')],
|
||||||
|
@ -4062,7 +4062,7 @@ function networkmap_get_new_nodes_and_links($networkmap, $x, $y)
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if ($map_filter['dont_show_subgroups'] == 'true') {
|
if ($map_filter['dont_show_subgroups'] == 'true' && $map_filter['dont_show_subgroups'] !== 0) {
|
||||||
// Show only current selected group.
|
// Show only current selected group.
|
||||||
$filter['id_grupo'] = $networkmap['id_group'];
|
$filter['id_grupo'] = $networkmap['id_group'];
|
||||||
} else {
|
} else {
|
||||||
|
@ -3891,6 +3891,8 @@ function get_node_name_ov(data) {
|
|||||||
|
|
||||||
function choose_group_for_show_agents() {
|
function choose_group_for_show_agents() {
|
||||||
var group = $("#group_for_show_agents option:selected").val();
|
var group = $("#group_for_show_agents option:selected").val();
|
||||||
|
var group_recursion =
|
||||||
|
$("#checkbox-group_recursion").prop("checked") === true ? 1 : 0;
|
||||||
|
|
||||||
$("#agents_filter_group").attr("disabled", true);
|
$("#agents_filter_group").attr("disabled", true);
|
||||||
$("#spinner_group").css("display", "");
|
$("#spinner_group").css("display", "");
|
||||||
@ -3906,6 +3908,7 @@ function choose_group_for_show_agents() {
|
|||||||
params.push("get_agents_in_group=1");
|
params.push("get_agents_in_group=1");
|
||||||
params.push("id=" + networkmap_id);
|
params.push("id=" + networkmap_id);
|
||||||
params.push("group=" + group);
|
params.push("group=" + group);
|
||||||
|
params.push("group_recursion=" + group_recursion);
|
||||||
params.push("page=operation/agentes/pandora_networkmap.view");
|
params.push("page=operation/agentes/pandora_networkmap.view");
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
data: params.join("&"),
|
data: params.join("&"),
|
||||||
|
@ -55,6 +55,7 @@ if (is_ajax()) {
|
|||||||
$process_migration = (bool) get_parameter('process_migration', false);
|
$process_migration = (bool) get_parameter('process_migration', false);
|
||||||
$get_agent_info = (bool) get_parameter('get_agent_info', false);
|
$get_agent_info = (bool) get_parameter('get_agent_info', false);
|
||||||
$update_node = (bool) get_parameter('update_node', false);
|
$update_node = (bool) get_parameter('update_node', false);
|
||||||
|
$get_agents_in_group = (bool) get_parameter('get_agents_in_group', false);
|
||||||
|
|
||||||
if ($update_node) {
|
if ($update_node) {
|
||||||
$node_json = io_safe_output(get_parameter('node', ''));
|
$node_json = io_safe_output(get_parameter('node', ''));
|
||||||
@ -80,6 +81,65 @@ if (is_ajax()) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($get_agents_in_group) {
|
||||||
|
$id = (int) get_parameter('id', 0);
|
||||||
|
$group = (int) get_parameter('group', -1);
|
||||||
|
$group_recursion = (int) get_parameter('group_recursion', 0);
|
||||||
|
|
||||||
|
$return = [];
|
||||||
|
$return['correct'] = false;
|
||||||
|
|
||||||
|
if ($group != -1) {
|
||||||
|
$where_id_agente = ' 1=1 ';
|
||||||
|
|
||||||
|
$agents_in_networkmap = db_get_all_rows_filter(
|
||||||
|
'titem',
|
||||||
|
[
|
||||||
|
'id_map' => $id,
|
||||||
|
'deleted' => 0,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
if ($agents_in_networkmap !== false) {
|
||||||
|
$ids = [];
|
||||||
|
foreach ($agents_in_networkmap as $agent) {
|
||||||
|
if ($agent['type'] == 0) {
|
||||||
|
$ids[] = $agent['source_data'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($ids) === false) {
|
||||||
|
$where_id_agente = 'id_agente NOT IN ('.implode(',', $ids).')';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($group_recursion !== 0) {
|
||||||
|
$group_tree = groups_get_children_ids($group);
|
||||||
|
$group = implode(',', $group_tree);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'SELECT id_agente, alias
|
||||||
|
FROM tagente
|
||||||
|
WHERE id_grupo IN ('.$group.') AND '.$where_id_agente.'
|
||||||
|
ORDER BY alias ASC';
|
||||||
|
|
||||||
|
$agents = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
|
if ($agents !== false) {
|
||||||
|
$return['agents'] = [];
|
||||||
|
foreach ($agents as $agent) {
|
||||||
|
$return['agents'][$agent['id_agente']] = $agent['alias'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$return['correct'] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($return);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($module_get_status) {
|
if ($module_get_status) {
|
||||||
$id = (int) get_parameter('id', 0);
|
$id = (int) get_parameter('id', 0);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user