From 53bf10acc0d0c52ac1c4bdc5d6c800787df5dc42 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Mon, 14 Aug 2023 14:54:15 +0200 Subject: [PATCH 1/2] #11819 wizard visual console update --- .../reporting/visual_console_builder.php | 22 ++++- .../visual_console_builder.wizard.php | 84 +++++++++++++++++- .../include/functions_visual_map.php | 88 ++++++++++++------- pandora_console/include/styles/pandora.css | 4 + 4 files changed, 161 insertions(+), 37 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.php b/pandora_console/godmode/reporting/visual_console_builder.php index c7da988cd0..986dcb423b 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.php +++ b/pandora_console/godmode/reporting/visual_console_builder.php @@ -555,6 +555,7 @@ switch ($activeTab) { $type = (int) get_parameter('type', STATIC_GRAPH); $image = get_parameter('image'); $range = (int) get_parameter('range', 50); + $range_vertical = (int) get_parameter('range_vertical', 50); $width = (int) get_parameter('width', 0); $height = (int) get_parameter('height', 0); $period = (int) get_parameter('period', 0); @@ -567,6 +568,9 @@ switch ($activeTab) { $label_type = get_parameter('label_type', 'agent_module'); $enable_link = get_parameter('enable_link', 'enable_link'); $show_on_top = get_parameter('show_on_top', 0); + $pos_x = get_parameter('pos_x', 0); + $pos_y = get_parameter('pos_y', 0); + $max_elements_row = (int) get_parameter('max_elements_row', 0); // This var switch between creation of items, item_per_agent = 0 => item per module; item_per_agent <> 0 => item per agent $item_per_agent = get_parameter('item_per_agent', 0); @@ -611,6 +615,7 @@ switch ($activeTab) { $image, $idVisualConsole, $range, + $range_vertical, $width, $height, $period, @@ -626,7 +631,10 @@ switch ($activeTab) { $kind_relationship, $item_in_the_map, $fontf, - $fonts + $fonts, + $pos_x, + $pos_y, + $max_elements_row ); $statusProcessInDB = [ @@ -668,6 +676,7 @@ switch ($activeTab) { $image, $idVisualConsole, $range, + $range_vertical, $width, $height, $period, @@ -683,7 +692,10 @@ switch ($activeTab) { $kind_relationship, $item_in_the_map, $fontf, - $fonts + $fonts, + $pos_x, + $pos_y, + $max_elements_row ); } else { $id_modules = []; @@ -722,6 +734,7 @@ switch ($activeTab) { $image, $idVisualConsole, $range, + $range_vertical, $width, $height, $period, @@ -737,7 +750,10 @@ switch ($activeTab) { $kind_relationship, $item_in_the_map, $fontf, - $fonts + $fonts, + $pos_x, + $pos_y, + $max_elements_row ); } } diff --git a/pandora_console/godmode/reporting/visual_console_builder.wizard.php b/pandora_console/godmode/reporting/visual_console_builder.wizard.php index 6e644f0f6d..6a54b2c049 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.wizard.php +++ b/pandora_console/godmode/reporting/visual_console_builder.wizard.php @@ -144,22 +144,28 @@ $table->data['all_0'][0] = html_print_label_input_block( $table->rowstyle['staticgraph'] = 'display: none;'; +$table->colspan['staticgraph'][0] = 2; $table->data['staticgraph'][0] = html_print_label_input_block( __('Image'), - html_print_select( + '
'.html_print_select( $images_list, 'image', '', '', '', '', - true - ) + true, + false, + true, + '', + false, + 'width: 49%' + ).'
' ); $table->rowstyle['all_1'] = 'display: none;'; $table->data['all_1'][0] = html_print_label_input_block( - __('Range between elements (px)'), + __('Horizontal range between elements (px)'), html_print_input_text( 'range', 50, @@ -170,6 +176,18 @@ $table->data['all_1'][0] = html_print_label_input_block( ) ); +$table->data['all_1'][1] = html_print_label_input_block( + __('Vertical range between elements (px)'), + html_print_input_text( + 'range_vertical', + 50, + '', + 5, + 5, + true + ) +); + $input_size = __('Width').': '; $input_size .= html_print_input_text('width', 0, '', 5, 5, true); $input_size .= __('Height').': '; @@ -425,6 +443,16 @@ if (is_metaconsole() === false) { ); } +$table->data['all_4_01'][0] = html_print_label_input_block( + __('Filter agents'), + html_print_input_text('filter_agents', '', '', false, 255, true) +); + +$table->data['all_4_01'][1] = html_print_label_input_block( + __('Filter modules'), + html_print_input_text('filter_modules', '', '', false, 255, true) +); + $table->rowstyle['all_4'] = 'display: none;'; $table->data['all_4'][0] = html_print_label_input_block( __('Agents').ui_print_help_tip( @@ -549,6 +577,16 @@ $table->data['all_8'][1] = html_print_label_input_block( ).'' ); +$table->data['all_10'][0] = html_print_label_input_block( + __('Max. elements for row'), + html_print_input_text('max_elements_row', 0, '', false, 255, true) +); + +$table->data['all_10'][1] = html_print_label_input_block( + __('Position'), + '
X'.html_print_input_text('pos_x', 0, '', false, 255, true, false, false, '', 'w50p').'Y'.html_print_input_text('pos_y', 0, '', false, 255, true, false, false, '', 'w50p').'
' +); + if (is_metaconsole() === true) { $pure = get_parameter('pure', 0); @@ -831,6 +869,44 @@ function item_per_agent_change(itemPerAgent) { function metaconsole_init() { $("#groups").change(); } + +$('#text-filter_agents').on('keyup',function(){ + if ($(this).val() !== ''){ + findInSelect('id_agents',$(this).val()); + } else { + $('#id_agents option').each(function(){ + $(this).removeClass('invisible'); + }); + } +}); + +$('#text-filter_modules').on('keyup',function(){ + if ($(this).val() !== ''){ + findInSelect('module',$(this).val()); + } else { + $('#module option').each(function(){ + $(this).removeClass('invisible'); + }); + } +}); + +function findInSelect(selectid, find){ + var select = $('#'+selectid+' option'); + select.each(function(){ + var regex = new RegExp(find, "gi"); + if ($(this).html().match(regex) === null) { + $(this).addClass('invisible'); + } else { + $(this).removeClass('invisible'); + } + }) +} + +$('#image').on('change', function(){ + var img = $(this).val(); + $('#image_prev').html(''); +}) +