diff --git a/pandora_console/godmode/reporting/graph_builder.graph_editor.php b/pandora_console/godmode/reporting/graph_builder.graph_editor.php index fdf11c8425..1ff88206ea 100644 --- a/pandora_console/godmode/reporting/graph_builder.graph_editor.php +++ b/pandora_console/godmode/reporting/graph_builder.graph_editor.php @@ -333,10 +333,10 @@ echo "'; echo ''; echo ''; diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 885b239d2c..b7f21f392d 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1480,11 +1480,43 @@ function html_print_select_multiple_modules_filtered(array $data):string 'return' => true, 'nothing' => __('All'), 'nothing_value' => 0, - 'script' => 'fmModuleChange(\''.$uniqId.'\', '.is_metaconsole().')', + 'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')', ] ); $output .= ''; + if (empty($data['searchBar']) === false && $data['searchBar'] === true) { + $output .= '
'; + + $output .= '
'; + $output .= html_print_input( + [ + 'type' => 'text', + 'name' => 'agent-searchBar-'.$uniqId, + 'onKeyUp' => 'searchAgent(\''.$uniqId.'\')', + 'value' => __('Type for search...'), + 'return' => true, + ] + ); + + $output .= '
'; + + $output .= '
'; + $output .= html_print_input( + [ + 'type' => 'text', + 'name' => 'module-searchBar-'.$uniqId, + 'onKeyUp' => 'searchModule(\''.$uniqId.'\')', + 'return' => true, + 'value' => 'test', + ] + ); + + $output .= '
'; + + $output .= '
'; + } + $output .= '
'; // Agent. $agents = agents_get_group_agents( @@ -1533,7 +1565,7 @@ function html_print_select_multiple_modules_filtered(array $data):string 'return' => true, 'multiple' => true, 'style' => 'min-width: 200px;max-width:200px;', - 'script' => 'fmModuleChange(\''.$uniqId.'\', '.is_metaconsole().')', + 'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')', ] ); @@ -1550,7 +1582,7 @@ function html_print_select_multiple_modules_filtered(array $data):string 'name' => 'filtered-module-show-common-modules-'.$uniqId, 'selected' => $data['mShowCommonModules'], 'return' => true, - 'script' => 'fmModuleChange(\''.$uniqId.'\', '.is_metaconsole().')', + 'script' => 'fmModuleChange(\''.$uniqId.'\', '.(int) is_metaconsole().')', ] ); diff --git a/pandora_console/include/javascript/multiselect_filtered.js b/pandora_console/include/javascript/multiselect_filtered.js index 8de92ffcf3..88a0ad8dde 100644 --- a/pandora_console/include/javascript/multiselect_filtered.js +++ b/pandora_console/include/javascript/multiselect_filtered.js @@ -231,7 +231,7 @@ function fmModuleChange(uniqId, isMeta) { if (data) { jQuery.each(data, function(id, value) { var option = $(""); - if (isMeta === true) { + if (isMeta === 1) { option .attr( "value", @@ -251,3 +251,50 @@ function fmModuleChange(uniqId, isMeta) { "json" ); } + +// Function to search in agents select. +function searchAgent(uniqId) { + // Declare variables + var agents = $("#filtered-module-agents-" + uniqId + " option"); + + // Loop through all list items, and hide those who don't match the search query + agents.each(function() { + var filter = $("#text-agent-searchBar-modules") + .val() + .toUpperCase(); + + if ( + $(this) + .text() + .toUpperCase() + .indexOf(filter) > -1 + ) { + $(this).show(); + } else { + $(this).hide(); + } + }); +} + +// Function to search in modules select. +function searchModule(uniqId) { + // Declare variables + var modules = $("#filtered-module-modules-" + uniqId + " option"); + + // Loop through all list items, and hide those who don't match the search query + modules.each(function() { + var filter = $("#text-module-searchBar-modules") + .val() + .toUpperCase(); + if ( + $(this) + .text() + .toUpperCase() + .indexOf(filter) > -1 + ) { + $(this).show(); + } else { + $(this).hide(); + } + }); +} diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index c804175618..bec08fdb10 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -8473,7 +8473,7 @@ div#err_msg_centralised { #select_multiple_modules_filtered > div { display: flex; flex-direction: row; - justify-content: space-around; + justify-content: space-between; align-items: center; margin: 5px; flex-wrap: wrap; @@ -8500,3 +8500,7 @@ div#err_msg_centralised { #select_multiple_modules_filtered > div > div > .select2 { min-width: 250px !important; } + +#select_multiple_modules_filtered > div > div > select { + max-width: 250px !important; +}
'.html_print_input( [ - 'type' => 'select_multiple_modules_filtered', - 'uniqId' => 'modules', - 'class' => 'flex flex-row', - + 'type' => 'select_multiple_modules_filtered', + 'uniqId' => 'modules', + 'class' => 'flex flex-row', + 'searchBar' => true, ] ).'