From b10247abdf39fe32a70ec278e6505234f38ab48c Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Thu, 14 Mar 2024 15:44:17 +0100 Subject: [PATCH] #13055 changes in interface view --- .../agentes/interface_view.functions.php | 22 +++++++++++-------- .../operation/agentes/interface_view.php | 7 ++++-- .../operation/agentes/ver_agente.php | 2 ++ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/pandora_console/operation/agentes/interface_view.functions.php b/pandora_console/operation/agentes/interface_view.functions.php index dd7bb5eddc..bf81d214be 100644 --- a/pandora_console/operation/agentes/interface_view.functions.php +++ b/pandora_console/operation/agentes/interface_view.functions.php @@ -597,15 +597,19 @@ function print_table( } else { foreach ($all_interfaces as $key => $value) { // Filter interfaces array. - $filtered_interfaces[$key] = array_filter( - $value, - function ($interface) use ($selected_interfaces) { - return in_array( - $interface['status_module_id'], - $selected_interfaces - ); - } - ); + if (empty($selected_interfaces) === false && in_array('', $selected_interfaces) === false) { + $filtered_interfaces[$key] = array_filter( + $value, + function ($interface) use ($selected_interfaces) { + return in_array( + $interface['status_module_id'], + $selected_interfaces + ); + } + ); + } else { + $filtered_interfaces = $all_interfaces; + } } } diff --git a/pandora_console/operation/agentes/interface_view.php b/pandora_console/operation/agentes/interface_view.php index 3799e4816e..c832980cdd 100644 --- a/pandora_console/operation/agentes/interface_view.php +++ b/pandora_console/operation/agentes/interface_view.php @@ -265,13 +265,16 @@ function load_agent_interfaces_selector(selected_agents) { }, function (data, status) { $("#module").html(''); - + var option = $("") + .attr ("value", "") + .html ("Any"); + $("#selected_interfaces").append(option); if (data) { Object.values(data).forEach(function(obj) { for (const [key, value] of Object.entries(obj.interfaces)) { option = $("") .attr ("value", value.status_module_id) - .html (key + ' (' + obj.agent_alias + ')'); + .html ('(' + obj.agent_alias + ') ' + key); $("#selected_interfaces").append(option); } }); diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index ccda3eb9f3..14bd68c972 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -169,6 +169,8 @@ if (is_ajax()) { }, [] ); + } else { + echo json_encode([]); } }