From 6381aaa9a86027a4528f5e5cc73a976a783ed121 Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 24 Feb 2023 10:18:52 +0100 Subject: [PATCH] restyling --- pandora_console/extensions/agents_modules.php | 9 +- .../extensions/realtime_graphs.php | 216 ++++++++++-------- .../realtime_graphs/realtime_graphs.css | 1 - .../include/class/AgentsAlerts.class.php | 30 ++- 4 files changed, 145 insertions(+), 111 deletions(-) diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index 487f1b476d..84380991f8 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -602,7 +602,14 @@ function mainAgentsModules() $show_filters .= ''; ui_toggle( $show_filters, - __('Filters ').ui_print_help_tip(__('Secondary groups and agent subgroups will be taken into account.'), true) + __('Filters ').ui_print_help_tip(__('Secondary groups and agent subgroups will be taken into account.'), true), + 'filter_form', + '', + true, + false, + '', + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' ); } diff --git a/pandora_console/extensions/realtime_graphs.php b/pandora_console/extensions/realtime_graphs.php index 8f978f0fac..eae6253d59 100644 --- a/pandora_console/extensions/realtime_graphs.php +++ b/pandora_console/extensions/realtime_graphs.php @@ -74,61 +74,11 @@ function pandora_realtime_graphs() ); } - $chart[time()]['graph'] = '0'; - $interactive_graph = true; - $color = []; - $legend = ''; - $long_index = []; - $no_data_image = ''; - - $canvas = '
'; - $canvas .= '
'; - - $width = 800; - $height = 300; - - $data_array['realtime']['data'][0][0] = (time() - 10); - $data_array['realtime']['data'][0][1] = 0; - $data_array['realtime']['data'][1][0] = time(); - $data_array['realtime']['data'][1][1] = 0; - $data_array['realtime']['color'] = 'green'; - - $params = [ - 'agent_module_id' => false, - 'period' => 300, - 'width' => $width, - 'height' => $height, - 'unit' => $unit, - 'only_image' => $only_image, - 'homeurl' => $homeurl, - 'type_graph' => 'area', - 'font' => $config['fontpath'], - 'font-size' => $config['font_size'], - 'array_data_create' => $data_array, - 'show_legend' => false, - 'show_menu' => false, - ]; - - $canvas .= grafico_modulo_sparse($params); - - $canvas .= '
'; - echo $canvas; - $table = new stdClass(); $table->width = '100%'; $table->id = 'table-form'; - $table->class = 'databox filters'; + $table->class = 'filter-table-adv'; $table->style = []; - $table->cellpadding = '0'; - $table->cellspacing = '0'; - $table->style['graph'] = 'font-weight: bold;'; - $table->style['refresh'] = 'font-weight: bold;'; - $table->style['incremental'] = 'font-weight: bold;'; - $table->style['reset'] = 'font-weight: bold;'; - $table->style['snmp_address'] = 'font-weight: bold;'; - $table->style['snmp_community'] = 'font-weight: bold;'; - $table->style['snmp_oid'] = 'font-weight: bold;'; - $table->style['snmp_oid'] = 'font-weight: bold;'; $table->data = []; $graph_fields['cpu_load'] = __('%s Server CPU', get_product_name()); @@ -158,15 +108,22 @@ function pandora_realtime_graphs() $refresh = get_parameter('refresh', '1000'); if ($graph != 'snmp_module') { - $data['graph'] = __('Graph').'  '; - $data['graph'] .= html_print_select( - $graph_fields, - 'graph', - $graph, - '', - '', - 0, - true + $data['graph'] = html_print_label_input_block( + __('Graph'), + html_print_select( + $graph_fields, + 'graph', + $graph, + '', + '', + 0, + true, + false, + true, + '', + false, + 'width: 100%' + ) ); } @@ -179,18 +136,35 @@ function pandora_realtime_graphs() $agent_alias = io_safe_output(get_parameter('agent_alias', '')); $module_name = io_safe_output(get_parameter('module_name', '')); $module_incremental = get_parameter('incremental', 0); - $data['module_info'] = $agent_alias.': '.$module_name.''; - - // Append all the hidden in this cell. - $data['module_info'] .= html_print_input_hidden( - 'incremental', - $module_incremental, - true + $data['module_info'] = html_print_label_input_block( + $agent_alias.': '.$module_name, + html_print_input_hidden( + 'incremental', + $module_incremental, + true + ).html_print_select( + ['snmp_module' => '-'], + 'graph', + 'snmp_module', + '', + '', + 0, + true, + false, + true, + '', + false, + 'width: 100%; display: none;' + ) ); - $data['module_info'] .= html_print_select( - ['snmp_module' => '-'], - 'graph', - 'snmp_module', + } + + $data['refresh'] = html_print_label_input_block( + __('Refresh interval'), + html_print_select( + $refresh_fields, + 'refresh', + $refresh, '', '', 0, @@ -199,33 +173,17 @@ function pandora_realtime_graphs() true, '', false, - 'display: none;' + 'width: 100%' + ) + ); + + if ($graph != 'snmp_module') { + $data['incremental'] = html_print_label_input_block( + __('Incremental'), + html_print_checkbox_switch('incremental', 1, 0, true) ); } - $data['refresh'] = __('Refresh interval').'  '; - $data['refresh'] .= html_print_select( - $refresh_fields, - 'refresh', - $refresh, - '', - '', - 0, - true - ); - if ($graph != 'snmp_module') { - $data['incremental'] = __('Incremental').'  '; - $data['incremental'] .= html_print_checkbox('incremental', 1, 0, true); - } - - $data['reset'] = html_print_button( - __('Clear graph'), - 'reset', - false, - 'javascript:realtimeGraphs.clearGraph();', - 'class="sub delete mgn_tp_0" ', - true - ); $table->data[] = $data; if ($graph == 'snmp_interface' || $graph == 'snmp_module') { @@ -236,9 +194,71 @@ function pandora_realtime_graphs() html_print_input_hidden('rel_path', get_parameter('rel_path', '')); // Print the form. - echo '
'; - html_print_table($table); - echo '
'; + $searchForm = '
'; + $searchForm .= html_print_table($table, true); + $searchForm .= html_print_div( + [ + 'class' => 'action-buttons', + 'content' => html_print_submit_button( + __('Clear graph'), + 'srcbutton', + false, + [ + 'icon' => 'delete', + 'mode' => 'mini', + 'onClick' => 'javascript:realtimeGraphs.clearGraph();', + ], + true + ), + ], + true + ); + $searchForm .= '
'; + + ui_toggle( + $searchForm, + ''.__('Filters').'', + 'filter_form', + '', + true, + false, + '', + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' + ); + + $chart[time()]['graph'] = '0'; + $canvas = '
'; + $canvas .= '
'; + + $width = 800; + $height = 300; + + $data_array['realtime']['data'][0][0] = (time() - 10); + $data_array['realtime']['data'][0][1] = 0; + $data_array['realtime']['data'][1][0] = time(); + $data_array['realtime']['data'][1][1] = 0; + $data_array['realtime']['color'] = 'green'; + + $params = [ + 'agent_module_id' => false, + 'period' => 300, + 'width' => $width, + 'height' => $height, + 'only_image' => false, + 'type_graph' => 'area', + 'font' => $config['fontpath'], + 'font-size' => $config['font_size'], + 'array_data_create' => $data_array, + 'show_legend' => false, + 'show_menu' => false, + 'backgroundColor' => 'transparent', + ]; + + $canvas .= grafico_modulo_sparse($params); + + $canvas .= '
'; + echo $canvas; // Define a custom action to save // the OID selected in the SNMP browser to the form. diff --git a/pandora_console/extensions/realtime_graphs/realtime_graphs.css b/pandora_console/extensions/realtime_graphs/realtime_graphs.css index a5dfa19975..a839ad6ab0 100644 --- a/pandora_console/extensions/realtime_graphs/realtime_graphs.css +++ b/pandora_console/extensions/realtime_graphs/realtime_graphs.css @@ -12,6 +12,5 @@ #graph_container { width: 800px; margin: 20px auto; - background-color: white; border-radius: 3px; } diff --git a/pandora_console/include/class/AgentsAlerts.class.php b/pandora_console/include/class/AgentsAlerts.class.php index 798ef5ff91..656c397417 100644 --- a/pandora_console/include/class/AgentsAlerts.class.php +++ b/pandora_console/include/class/AgentsAlerts.class.php @@ -230,14 +230,14 @@ class AgentsAlerts extends HTML $agent_modules = db_get_all_rows_sql($sql); - ui_pagination( + $tablePagination = ui_pagination( $count_agent_module[0]['COUNT(tagente_modulo.nombre)'], ui_get_url_refresh(), 0, false, - false, - 'offset', true, + 'offset', + false, '', '', false, @@ -419,6 +419,11 @@ class AgentsAlerts extends HTML } html_print_table($table); + + html_print_action_buttons( + '', + ['right_content' => $tablePagination] + ); } @@ -781,7 +786,7 @@ class AgentsAlerts extends HTML 'name' => 'show-modules-without-alerts', 'checked' => $this->showWithoutAlertModules, 'input_class' => 'flex-row', - 'type' => 'checkbox', + 'type' => 'switch', 'class' => '', 'disabled_hidden' => true, 'return' => true, @@ -858,13 +863,16 @@ class AgentsAlerts extends HTML true ); - // Prints the header controls. - $header = html_print_div( - [ - 'class' => 'white_box agents_alerts_header', - 'content' => $filterForm, - ], - true + $header = ui_toggle( + $filterForm, + ''.__('Filters').'', + 'filter_form', + '', + true, + true, + '', + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' ); echo $header;