From 658f2853f7604c7411b83c5874aa95cd7a7b4748 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Tue, 14 Mar 2023 14:56:33 +0100 Subject: [PATCH 1/6] Dashboards widgets --- .../godmode/agentes/modificar_agente.php | 5 +- pandora_console/godmode/alerts/alert_view.php | 10 ++- pandora_console/include/functions_events.php | 2 +- pandora_console/include/functions_modules.php | 21 +++++ pandora_console/include/functions_ui.php | 2 + .../Dashboard/Widgets/AvgSumMaxMinModule.php | 51 ++++++++++-- .../lib/Dashboard/Widgets/module_icon.php | 78 +++++++++++++++++-- .../lib/Dashboard/Widgets/module_status.php | 46 ++++++++++- .../lib/Dashboard/Widgets/module_value.php | 69 ++++++++++++++-- .../lib/Dashboard/Widgets/os_quick_report.php | 20 ++--- .../lib/Dashboard/Widgets/sla_percent.php | 46 ++++++++++- pandora_console/include/styles/pandora.css | 4 + 12 files changed, 311 insertions(+), 43 deletions(-) diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 0e01bd051a..0d7e5fc0b6 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -406,9 +406,9 @@ $filterTable->data[1][0] = html_print_submit_button( ); // Print filter table. -echo '
'; +$form = ''; ui_toggle( - html_print_table($filterTable, true), + $form.html_print_table($filterTable, true).'
', ''.__('Filter').'', __('Filter'), 'filter', @@ -418,7 +418,6 @@ ui_toggle( 'white-box-content no_border', 'filter-datatable-main box-flat white_table_graph fixed_filter_bar' ); -echo ''; // Data table. $selected = true; diff --git a/pandora_console/godmode/alerts/alert_view.php b/pandora_console/godmode/alerts/alert_view.php index 67b31ed3f3..e8b906b220 100644 --- a/pandora_console/godmode/alerts/alert_view.php +++ b/pandora_console/godmode/alerts/alert_view.php @@ -61,13 +61,19 @@ if ($default_action != 0) { } // Header. -ui_print_page_header( +ui_print_standard_header( __('Alert details'), 'images/op_alerts.png', false, '', false, - '' + [], + [ + [ + 'link' => '', + 'label' => __('Alerts'), + ], + ] ); // TABLE DETAILS. diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 1c6740efff..8bc5cc500b 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -4356,7 +4356,7 @@ function events_page_details($event, $server_id=0) $graph_params_str = http_build_query($graph_params); - $link = "winopeng_var('".$url.'?'.$graph_params_str."','".$win_handle."', 800, 480)"; + $link = 'winopeng_var("'.$url.'?'.$graph_params_str.'","'.$win_handle.'", 800, 480)'; $data[1] = html_print_button(__('View graph'), 'view_graph_button', false, $link, ['mode' => 'link'], true); $table_details->data[] = $data; } diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index dbb988782a..6b6815b755 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -1153,6 +1153,27 @@ function modules_get_raw_data($id_agent_module, $date_init, $date_end) } +function module_get_min_max_tagente_datos($id_agent_module, $date_init, $date_end) +{ + $table = modules_get_table_data($id_agent_module, null); + + $datelimit = ($date_init - $date_end); + $search_in_history_db = db_search_in_history_db($datelimit); + + $data = db_get_all_rows_sql( + ' + SELECT max(datos) as max, min(datos) as min + FROM '.$table.' + WHERE id_agente_modulo = '.$id_agent_module.' + AND utimestamp >= '.$date_init.' + AND utimestamp <= '.$date_end, + $search_in_history_db + ); + + return $data; +} + + function modules_get_agent_groups($id_agent_module) { $return = false; diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index c0005c8cd9..1c632d6f9e 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -3885,6 +3885,7 @@ function ui_print_datatable(array $parameters) $("div.dataTables_paginate").hide(); $("div.dataTables_info").hide(); $("div.dataTables_length").hide(); + $("div.dt-buttons").hide(); if (dt_'.$table_id.'.page.info().pages > 1) { $(".dataTables_paginate.paging_simple_numbers").show() @@ -3895,6 +3896,7 @@ function ui_print_datatable(array $parameters) $("div.dataTables_paginate").show(); $("div.dataTables_info").show(); $("div.dataTables_length").show(); + $("div.dt-buttons").show(); if (dt_'.$table_id.'.page.info().pages == 1) { $(".dataTables_paginate.paging_simple_numbers").hide() diff --git a/pandora_console/include/lib/Dashboard/Widgets/AvgSumMaxMinModule.php b/pandora_console/include/lib/Dashboard/Widgets/AvgSumMaxMinModule.php index c1ea70eaba..cf7edb70c6 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/AvgSumMaxMinModule.php +++ b/pandora_console/include/lib/Dashboard/Widgets/AvgSumMaxMinModule.php @@ -316,6 +316,10 @@ class AvgSumMaxMinModule extends Widget $values['unit'] = $decoder['unit']; } + if (isset($decoder['layout']) === true) { + $values['layout'] = $decoder['layout']; + } + return $values; } @@ -501,6 +505,18 @@ class AvgSumMaxMinModule extends Widget ], ]; + // Layout. + $inputs[] = [ + 'label' => __('Layout').ui_print_help_tip(__('Off: vertical. On: horizontal'), true), + 'arguments' => [ + 'wrapper' => 'div', + 'name' => 'layout', + 'type' => 'switch', + 'value' => $values['layout'], + 'return' => true, + ], + ]; + return $inputs; } @@ -525,6 +541,7 @@ class AvgSumMaxMinModule extends Widget $values['sizeLabel'] = \get_parameter_switch('sizeLabel'); $values['text_color'] = \get_parameter('text_color', 0); $values['unit'] = \get_parameter_switch('unit'); + $values['layout'] = \get_parameter_switch('layout'); return $values; } @@ -601,13 +618,13 @@ class AvgSumMaxMinModule extends Widget break; case 2: - $rows = modules_get_min_max_data($id_module, $to); + $rows = module_get_min_max_tagente_datos($id_module, $to, $now); $data = $rows[0]['max']; break; case 3: - $rows = modules_get_min_max_data($id_module, $to); + $rows = module_get_min_max_tagente_datos($id_module, $to, $now); $data = $rows[0]['min']; break; @@ -621,11 +638,22 @@ class AvgSumMaxMinModule extends Widget $sizeLabel = (isset($this->values['sizeLabel']) === true) ? $this->values['sizeLabel'] : 40; $sizeValue = (isset($this->values['sizeValue']) === true) ? $this->values['sizeValue'] : 40; - $output .= '
'; + $uuid = uniqid(); + + $output .= '
'; + + $orientation = ''; + if ((int) $this->values['layout'] === 1) { + $orientation = 'flex'; + } else { + $orientation = 'grid'; + } + // General div. - $output .= '
'; + $output .= '
'; + // Div value. - $output .= '
'; + $output .= '
'; if (is_numeric($data) === true) { $dataDatos = remove_right_zeros( @@ -651,11 +679,22 @@ class AvgSumMaxMinModule extends Widget if (empty($label) === false) { // Div Label. - $output .= '
'.$label.'
'; + $output .= '
'.$label.'
'; } $output .= '
'; $output .= '
'; + + $output .= ''; return $output; } diff --git a/pandora_console/include/lib/Dashboard/Widgets/module_icon.php b/pandora_console/include/lib/Dashboard/Widgets/module_icon.php index 5523a851ef..316e8813b3 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/module_icon.php +++ b/pandora_console/include/lib/Dashboard/Widgets/module_icon.php @@ -305,6 +305,10 @@ class ModuleIconWidget extends Widget $values['imageSrc'] = $decoder['imageSrc']; } + if (isset($decoder['layout']) === true) { + $values['layout'] = $decoder['layout']; + } + return $values; } @@ -482,6 +486,18 @@ class ModuleIconWidget extends Widget ], ]; + // Layout. + $inputs[] = [ + 'label' => __('Layout').ui_print_help_tip(__('Off: vertical. On: horizontal'), true), + 'arguments' => [ + 'wrapper' => 'div', + 'name' => 'layout', + 'type' => 'switch', + 'value' => $values['layout'], + 'return' => true, + ], + ]; + return $inputs; } @@ -504,6 +520,7 @@ class ModuleIconWidget extends Widget $values['sizeValue'] = \get_parameter('sizeValue', 0); $values['sizeLabel'] = \get_parameter_switch('sizeLabel'); $values['sizeIcon'] = \get_parameter_switch('sizeIcon'); + $values['layout'] = \get_parameter_switch('layout'); return $values; } @@ -533,39 +550,84 @@ class ModuleIconWidget extends Widget $this->values['moduleId'] ); + $unit = \modules_get_unit($this->values['moduleId']); + $icon = $this->values['imageSrc']; $label = $this->values['label']; $sizeLabel = (($this->values['sizeLabel'] !== 0) ? $this->values['sizeLabel'] : 20); $sizeValue = (($this->values['sizeValue'] !== 0) ? $this->values['sizeValue'] : 20); $sizeIcon = (($this->values['sizeIcon'] !== 0) ? $this->values['sizeIcon'] : 100); - $output .= '
'; + $uuid = uniqid(); + + $output .= '
'; + + $orientation = ''; + if ((int) $this->values['layout'] === 1) { + $orientation = 'flex aligni_center'; + } else { + $orientation = 'grid'; + } + // General div. - $output .= '
'; + $output .= '
'; + + $sql = 'SELECT min_warning, + max_warning, + min_critical, + max_critical, + str_warning, + str_critical + FROM tagente_modulo + WHERE id_agente_modulo = '.(int) $this->values['moduleId']; + $sql_data = db_get_row_sql($sql); + + $last = modules_get_last_value($this->values['moduleId']); + + $color_icon = '_ok'; + if (($last >= $sql_data['min_warning']) && ($last < $sql_data['max_warning'])) { + $color_icon = '_warning'; + } + + if ($last >= $sql_data['max_warning']) { + $color_icon = '_bad'; + } // Div image. - $output .= '
'; + $style_icon = 'flex: 0 1 '.$sizeIcon.'px;'; + + $output .= '
'; $output .= html_print_image( - 'images/console/icons/'.$icon.'.png', + 'images/console/icons/'.$icon.$color_icon.'.png', true, ['width' => $sizeIcon] ); $output .= '
'; - // Div value. - $output .= '
'; + $output .= '
'; $output .= remove_right_zeros( number_format($data_module, $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator']) - ); + ).$unit; $output .= '
'; if (empty($label) === false) { // Div Label. - $output .= '
'.$label.'
'; + $output .= '
'.$label.'
'; } $output .= '
'; $output .= '
'; + + $output .= ''; return $output; } diff --git a/pandora_console/include/lib/Dashboard/Widgets/module_status.php b/pandora_console/include/lib/Dashboard/Widgets/module_status.php index 6a1b2f1ebb..f8b7dda933 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/module_status.php +++ b/pandora_console/include/lib/Dashboard/Widgets/module_status.php @@ -300,6 +300,10 @@ class ModuleStatusWidget extends Widget $values['imageSrc'] = $decoder['imageSrc']; } + if (isset($decoder['layout']) === true) { + $values['layout'] = $decoder['layout']; + } + return $values; } @@ -461,6 +465,18 @@ class ModuleStatusWidget extends Widget ], ]; + // Layout. + $inputs[] = [ + 'label' => __('Layout').ui_print_help_tip(__('Off: vertical. On: horizontal'), true), + 'arguments' => [ + 'wrapper' => 'div', + 'name' => 'layout', + 'type' => 'switch', + 'value' => $values['layout'], + 'return' => true, + ], + ]; + return $inputs; } @@ -483,6 +499,7 @@ class ModuleStatusWidget extends Widget $values['sizeValue'] = \get_parameter('sizeValue', 0); $values['sizeLabel'] = \get_parameter_switch('sizeLabel'); $values['sizeIcon'] = \get_parameter_switch('sizeIcon'); + $values['layout'] = \get_parameter_switch('layout'); return $values; } @@ -538,12 +555,22 @@ class ModuleStatusWidget extends Widget break; } - $output .= '
'; + $uuid = uniqid(); + + $output .= '
'; + + $orientation = ''; + if ((int) $this->values['layout'] === 1) { + $orientation = 'flex aligni_center'; + } else { + $orientation = 'grid'; + } + // General div. - $output .= '
'; + $output .= '
'; // Div image. - $output .= '
'; + $output .= '
'; $output .= html_print_image( 'images/console/icons/'.$icon, true, @@ -553,11 +580,22 @@ class ModuleStatusWidget extends Widget if (empty($label) === false) { // Div Label. - $output .= '
'.$label.'
'; + $output .= '
'.$label.'
'; } $output .= '
'; $output .= '
'; + + $output .= ''; return $output; } diff --git a/pandora_console/include/lib/Dashboard/Widgets/module_value.php b/pandora_console/include/lib/Dashboard/Widgets/module_value.php index 6577ad3c89..818db36b92 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/module_value.php +++ b/pandora_console/include/lib/Dashboard/Widgets/module_value.php @@ -284,6 +284,10 @@ class ModuleValueWidget extends Widget $values['sizeLabel'] = $decoder['sizeLabel']; } + if (isset($decoder['layout']) === true) { + $values['layout'] = $decoder['layout']; + } + return $values; } @@ -385,6 +389,18 @@ class ModuleValueWidget extends Widget ], ]; + // Layout. + $inputs[] = [ + 'label' => __('Layout').ui_print_help_tip(__('Off: vertical. On: horizontal'), true), + 'arguments' => [ + 'wrapper' => 'div', + 'name' => 'layout', + 'type' => 'switch', + 'value' => $values['layout'], + 'return' => true, + ], + ]; + return $inputs; } @@ -405,6 +421,7 @@ class ModuleValueWidget extends Widget $values['moduleId'] = \get_parameter('moduleId', 0); $values['sizeValue'] = \get_parameter('sizeValue', 0); $values['sizeLabel'] = \get_parameter_switch('sizeLabel'); + $values['layout'] = \get_parameter_switch('layout'); return $values; } @@ -422,6 +439,7 @@ class ModuleValueWidget extends Widget $output = ''; $id_module = $this->values['moduleId']; + $unit = modules_get_unit($this->values['moduleId']); $data_module = \modules_get_last_value($id_module); @@ -429,11 +447,41 @@ class ModuleValueWidget extends Widget $sizeLabel = (isset($this->values['sizeLabel']) === true) ? $this->values['sizeLabel'] : 40; $sizeValue = (isset($this->values['sizeValue']) === true) ? $this->values['sizeValue'] : 40; - $output .= '
'; + $sql = 'SELECT min_warning, + max_warning, + min_critical, + max_critical, + str_warning, + str_critical + FROM tagente_modulo + WHERE id_agente_modulo = '.(int) $this->values['moduleId']; + $sql_data = db_get_row_sql($sql); + + $last = modules_get_last_value($this->values['moduleId']); + + if (($last >= $sql_data['min_warning']) && ($last < $sql_data['max_warning'])) { + $color = COL_WARNING; + } + + if ($last >= $sql_data['max_warning']) { + $color = COL_CRITICAL; + } + + $uuid = uniqid(); + $output .= '
'; + + $orientation = ''; + if ((int) $this->values['layout'] === 1) { + $orientation = 'flex'; + } else { + $orientation = 'grid'; + } + // General div. - $output .= '
'; + $output .= '
'; + // Div value. - $output .= '
'; + $output .= '
'; if (is_numeric($data_module) === true) { $dataDatos = remove_right_zeros( @@ -443,7 +491,7 @@ class ModuleValueWidget extends Widget $config['decimal_separator'], $config['thousand_separator'] ) - ); + ).$unit; } else { $dataDatos = trim($data_module); } @@ -454,11 +502,22 @@ class ModuleValueWidget extends Widget if (empty($label) === false) { // Div Label. - $output .= '
'.$label.'
'; + $output .= '
'.$label.'
'; } $output .= '
'; $output .= '
'; + + $output .= ''; return $output; } diff --git a/pandora_console/include/lib/Dashboard/Widgets/os_quick_report.php b/pandora_console/include/lib/Dashboard/Widgets/os_quick_report.php index 892d1f219a..f775ec7444 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/os_quick_report.php +++ b/pandora_console/include/lib/Dashboard/Widgets/os_quick_report.php @@ -282,10 +282,10 @@ class OsQuickReportWidget extends Widget $table->head = []; $table->head[0] = __('OS'); $table->head[1] = __('OS name'); - $table->head[2] = ucfirst(__('total agents')); - $table->head[3] = ucfirst(__('normal agents')); - $table->head[4] = ucfirst(__('critical agents')); - $table->head[5] = ucfirst(__('unknown agents')); + $table->head[2] = ucfirst(__('total')); + $table->head[3] = ucfirst(__('normal')); + $table->head[4] = ucfirst(__('critical')); + $table->head[5] = ucfirst(__('unknown')); $table->headstyle = []; $table->headstyle[0] = 'text-align:center;background-color: '.$values['background']; @@ -296,12 +296,12 @@ class OsQuickReportWidget extends Widget $table->headstyle[5] = 'text-align:center;background-color: '.$values['background']; $table->style = []; - $table->style[0] = 'background-color: '.$values['background']; - $table->style[1] = 'background-color: '.$values['background']; - $table->style[2] = 'font-size: 22px;background-color: '.$values['background']; - $table->style[3] = 'font-size: 22px;background-color: '.$values['background']; - $table->style[4] = 'font-size: 22px;background-color: '.$values['background']; - $table->style[5] = 'font-size: 22px;background-color: '.$values['background']; + $table->style[0] = 'background-color: '.$values['background'].';'; + $table->style[1] = 'background-color: '.$values['background'].';'; + $table->style[2] = 'background-color: '.$values['background'].'; font-size: 1.5em; font-weight: bolder;'; + $table->style[3] = 'background-color: '.$values['background'].'; font-size: 1.5em; font-weight: bolder;'; + $table->style[4] = 'background-color: '.$values['background'].'; font-size: 1.5em; font-weight: bolder;'; + $table->style[5] = 'background-color: '.$values['background'].'; font-size: 1.5em; font-weight: bolder;'; foreach ($result as $id => $os) { $data = []; diff --git a/pandora_console/include/lib/Dashboard/Widgets/sla_percent.php b/pandora_console/include/lib/Dashboard/Widgets/sla_percent.php index 4cd9bd7f0d..874d07fee2 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/sla_percent.php +++ b/pandora_console/include/lib/Dashboard/Widgets/sla_percent.php @@ -289,6 +289,10 @@ class SLAPercentWidget extends Widget $values['period'] = $decoder['period']; } + if (isset($decoder['layout']) === true) { + $values['layout'] = $decoder['layout']; + } + return $values; } @@ -404,6 +408,18 @@ class SLAPercentWidget extends Widget ], ]; + // Layout. + $inputs[] = [ + 'label' => __('Layout').ui_print_help_tip(__('Off: vertical. On: horizontal'), true), + 'arguments' => [ + 'wrapper' => 'div', + 'name' => 'layout', + 'type' => 'switch', + 'value' => $values['layout'], + 'return' => true, + ], + ]; + return $inputs; } @@ -425,6 +441,7 @@ class SLAPercentWidget extends Widget $values['period'] = \get_parameter('period', 0); $values['sizeValue'] = \get_parameter('sizeValue', ''); $values['sizeLabel'] = \get_parameter('sizeLabel', ''); + $values['layout'] = \get_parameter_switch('layout'); return $values; } @@ -494,21 +511,42 @@ class SLAPercentWidget extends Widget $sizeLabel = (isset($this->values['sizeLabel']) === true) ? $this->values['sizeLabel'] : 30; $sizeValue = (isset($this->values['sizeValue']) === true) ? $this->values['sizeValue'] : 30; - $output .= '
'; + $uuid = uniqid(); + + $output .= '
'; + + $orientation = ''; + if ((int) $this->values['layout'] === 1) { + $orientation = 'flex'; + } else { + $orientation = 'grid'; + } + // General div. - $output .= '
'; + $output .= '
'; // Div value. - $output .= '
'; + $output .= '
'; $output .= $sla_array['sla_fixed'].'%'; $output .= '
'; if (empty($label) === false) { // Div Label. - $output .= '
'.$label.'
'; + $output .= '
'.$label.'
'; } $output .= '
'; $output .= '
'; + + $output .= ''; return $output; } diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 4324dc0175..e8632a83aa 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -11664,3 +11664,7 @@ div.ui-dialog-buttonset > button.ui-button.ui-corner-all.ui-widget:active { background-color: #0d312f; border-color: #0d312f; } + +div#menu_full > div#menu_tabs > ul.tabs_ul { + margin-bottom: 0px; +} From dac980e55edeea19278ec95cd9bf605afeabddd8 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 14 Mar 2023 15:41:55 +0100 Subject: [PATCH 2/6] PDFs visual changes --- pandora_console/include/functions_reporting_html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 01af7d49ce..013cb1c617 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -2178,7 +2178,7 @@ function reporting_html_agent_module($table, $item) if ($module === null) { $table_data .= ''; } else { - $table_data .= ""; + $table_data .= ''; if (isset($row['show_type']) === true && $row['show_type'] === '1') { $table_data .= $module; } else { From 620bff28af70cbf60e5729c9e082d597c6e3fcd9 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Tue, 14 Mar 2023 15:59:20 +0100 Subject: [PATCH 3/6] Dashboards widgets --- .../include/lib/Dashboard/Widgets/single_graph.php | 2 +- pandora_console/include/styles/dashboards.css | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/lib/Dashboard/Widgets/single_graph.php b/pandora_console/include/lib/Dashboard/Widgets/single_graph.php index e6372c49f4..09f1c15a16 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/single_graph.php +++ b/pandora_console/include/lib/Dashboard/Widgets/single_graph.php @@ -418,7 +418,7 @@ class SingleGraphWidget extends Widget 'dashboard' => true, ]; - $output = '
'; + $output = '
'; $output .= \grafico_modulo_sparse($params); $output .= '
'; return $output; diff --git a/pandora_console/include/styles/dashboards.css b/pandora_console/include/styles/dashboards.css index 63b4f79b9f..501cfe40da 100644 --- a/pandora_console/include/styles/dashboards.css +++ b/pandora_console/include/styles/dashboards.css @@ -835,3 +835,11 @@ form.modal-dashboard border: 0px; width: 90%; } + +div.widget-mrgn-0px > div.parent_graph { + margin: 0px; +} + +div.widget-mrgn-0px > div.parent_graph > div[id^="graph_"] { + width: calc(100% + 14px) !important; +} From c4f4d371cc615a8ce83dff0ce0f9f362d3a1dcdd Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 14 Mar 2023 17:25:58 +0100 Subject: [PATCH 4/6] fixed styles --- .../agentes/module_manager_editor_common.php | 215 +++++++----------- 1 file changed, 88 insertions(+), 127 deletions(-) diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 2cceb5fa34..b87d508546 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -444,7 +444,8 @@ $tableBasicThresholds->data = []; $tableBasicThresholds->rowclass['caption_warning_threshold'] = 'field_half_width pdd_t_10px'; $tableBasicThresholds->rowclass['warning_threshold'] = 'field_half_width'; $tableBasicThresholds->data['caption_warning_threshold'][0] .= __('Warning threshold').' '; -if ($edit_module === false && (isset($stringTypeModule) === false || $stringTypeModule === false)) { + +if ((isset($stringTypeModule) === false || $stringTypeModule === false)) { $tableBasicThresholds->data['caption_warning_threshold'][0] .= '('.__('Min / Max').')'; $tableBasicThresholds->data['warning_threshold'][0] .= html_print_input_text( 'min_warning', @@ -482,7 +483,7 @@ if ($edit_module === false && (isset($stringTypeModule) === false || $stringType ); } -if ($edit_module === false && isset($stringTypeModule) === true && $stringTypeModule === true) { +if (isset($stringTypeModule) === true && $stringTypeModule === true) { $basicThresholdsIntervalWarning = []; $basicThresholdsIntervalWarning[] = ''.__('Inverse interval').''; $basicThresholdsIntervalWarning[] = html_print_checkbox_switch( @@ -531,7 +532,7 @@ $tableBasicThresholds->data['switch_warning_threshold'][0] .= html_print_div( $tableBasicThresholds->rowclass['caption_critical_threshold'] = 'field_half_width pdd_t_10px'; $tableBasicThresholds->rowclass['critical_threshold'] = 'field_half_width'; $tableBasicThresholds->data['caption_critical_threshold'][0] .= __('Critical threshold').' '; -if ($edit_module === false && (isset($stringTypeModule) === false || $stringTypeModule === false)) { +if ((isset($stringTypeModule) === false || $stringTypeModule === false)) { $tableBasicThresholds->data['caption_critical_threshold'][0] .= '('.__('Min / Max').')'; $tableBasicThresholds->data['critical_threshold'][0] .= html_print_input_text( 'min_critical', @@ -569,7 +570,7 @@ if ($edit_module === false && (isset($stringTypeModule) === false || $stringType ); } -if ($edit_module === false && isset($stringTypeModule) === true && $stringTypeModule === true) { +if (isset($stringTypeModule) === true && $stringTypeModule === true) { $basicThresholdsIntervalCritical = []; $basicThresholdsIntervalCritical[] = ''.__('Inverse interval').''; $basicThresholdsIntervalCritical[] = html_print_checkbox_switch( @@ -1905,78 +1906,63 @@ $(document).ready (function () { }); $('.switch_radio_button label').on('click', function(){ + console.log('primero'); var thisLabel = $(this).attr('for'); - $('#'+thisLabel).attr('checked', 'checked'); - $('#'+thisLabel).siblings().attr('checked', false); - - if ($('#radius-warning_inverse').prop('checked') === true) { - //$('#percentage_warning').hide(); - $("#svg_dinamic").show(); - } + console.log(thisLabel); + $('#'+thisLabel).prop('checked', true); + $('#'+thisLabel).siblings().prop('checked', false); - if ($('#radius-critical_inverse').prop('checked') === true) { - //$('#percentage_critical').hide(); + console.log('++++++++++Los warning++++++++++++++'); + console.log('normal_warning: '+$('#radius-normal_warning').prop('checked')); + console.log('warning_inverse: '+$('#radius-warning_inverse').prop('checked')); + console.log('percentage_warning: '+$('#radius-percentage_warning').prop('checked')); + + console.log('++++++++++Los critical++++++++++++++'); + console.log('normal_critical: '+$('#radius-normal_critical').prop('checked')); + console.log('critical_inverse: '+$('#radius-critical_inverse').prop('checked')); + console.log('percentage_critical: '+$('#radius-percentage_critical').prop('checked')); + + if ($('#radius-percentage_warning').prop('checked') === true || $('#radius-percentage_critical').prop('checked') === true) { + $("#svg_dinamic").hide(); + } else { + paint_graph_values(); $("#svg_dinamic").show(); } if ($('#radius-percentage_warning').prop('checked') === true) { - //$('#warning_inverse').hide(); - $("#svg_dinamic").hide(); + $('#radius-warning_inverse').hide(); + $('#label-radius-warning_inverse').hide(); } + if ($('#radius-warning_inverse').prop('checked') === true) { + $('#radius-percentage_warning').hide(); + $('#label-radius-percentage_warning').hide(); + } + + if ($('#radius-normal_warning').prop('checked') === true) { + $('#radius-warning_inverse').show(); + $('#label-radius-warning_inverse').show(); + $('#radius-percentage_warning').show(); + $('#label-radius-percentage_warning').show(); + } + + if ($('#radius-percentage_critical').prop('checked') === true) { - //$('#critical_inverse').hide(); - $("#svg_dinamic").hide(); + $('#radius-critical_inverse').hide(); + $('#label-radius-critical_inverse').hide(); } - $('#radius-warning_inverse').change (function() { - paint_graph_values(); - if ($('#radius-warning_inverse').prop('checked') === true){ - $('#radius-percentage_warning').prop('checked', false); - $('#percentage_warning').attr('onClick', 'return false;'); - $('#percentage_warning>em').addClass('color_666'); - } else { - $('#percentage_warning').removeAttr('onClick'); - $('#percentage_warning>em').removeClass('color_666'); - } - }); + if ($('#radius-critical_inverse').prop('checked') === true) { + $('#radius-percentage_critical').hide(); + $('#label-radius-percentage_critical').hide(); + } - $('#radius-critical_inverse').change (function() { - paint_graph_values(); - - if ($('#radius-critical_inverse').prop('checked') === true){ - $('#radius-percentage_critical').prop('checked', false); - $('#percentage_critical').attr('onClick', 'return false;'); - $('#percentage_critical>em').addClass('color_666'); - } else { - $('#percentage_critical').removeAttr('onClick'); - $('#percentage_critical>em').removeClass('color_666'); - } - }); - - $('#radius-percentage_warning').change (function() { - paint_graph_values(); - if ($('#radius-percentage_warning').prop('checked') === true){ - $('#radius-warning_inverse').prop('checked', false); - $('#warning_inverse').attr('onClick', 'return false;'); - $('#warning_inverse>em').addClass('color_666'); - } else { - $('#warning_inverse').removeAttr('onClick'); - $('#warning_inverse>em').removeClass('color_666'); - } - }); - - $('#radius-percentage_critical').change (function() { - paint_graph_values(); - if ($('#radius-percentage_critical').prop('checked') === true){ - $('#radius-critical_inverse').prop('checked', false); - $('#critical_inverse').attr('onClick', 'return false;'); - $('#critical_inverse>em').addClass('color_666'); - } else { - $('#critical_inverse').removeAttr('onClick'); - $('#critical_inverse>em').removeClass('color_666'); - } - }); + if ($('#radius-normal_critical').prop('checked') === true) { + $('#radius-critical_inverse').show(); + $('#label-radius-critical_inverse').show(); + $('#radius-percentage_critical').show(); + $('#label-radius-percentage_critical').show(); + } }); @@ -2235,91 +2221,66 @@ function validate_post_process() { } } -//function paint graph +//function paint graph. function paint_graph_values(){ - //Parse integrer var min_w = parseFloat($('#text-min_warning').val()); - if(min_w == '0.00'){ min_w = 0; } - var max_w = parseFloat($('#text-max_warning').val()); - if(max_w == '0.00'){ max_w = 0; } - var min_c = parseFloat($('#text-min_critical').val()); - if(min_c =='0.00'){ min_c = 0; } - var max_c = parseFloat($('#text-max_critical').val()); - if(max_c =='0.00'){ max_c = 0; } - var inverse_w = $('input:radio[name=warning_inverse]:checked').val(); - if(!inverse_w){ inverse_w = 0; } - var inverse_c = $('input:radio[name=critical_inverse]:checked').val(); - if(!inverse_c){ inverse_c = 0; } + if(min_w == '0.00' || isNaN(min_w)){ min_w = 0; } - //inicialiced error + var max_w = parseFloat($('#text-max_warning').val()); + if(max_w == '0.00' || isNaN(max_w)){ max_w = 0; } + + var min_c = parseFloat($('#text-min_critical').val()); + if(min_c =='0.00' || isNaN(min_c)){ min_c = 0; } + + var max_c = parseFloat($('#text-max_critical').val()); + if(max_c =='0.00' || isNaN(max_c)){ max_c = 0; } + + var inverse_w = $('input:radio[value=warning_inverse]:checked').val(); + if(!inverse_w){ inverse_w = 0; } + + var inverse_c = $('input:radio[value=critical_inverse]:checked').val(); + if(!inverse_c){ inverse_c = 0; } + + //inicialiced error. var error_w = 0; var error_c = 0; - //messages legend + + //messages legend. var legend_normal = ''; var legend_warning = ''; var legend_critical = ''; - //messages error + + //messages error. var message_error_warning = ''; var message_error_critical = ''; var message_error_percentage = ''; - - - //Percentage selector - var percentage_w = $('#checkbox-percentage_warning').prop('checked'); - var percentage_c = $('#checkbox-percentage_critical').prop('checked'); - - if(percentage_w == true || percentage_c == true) { - d3.select("#svg_dinamic rect").remove(); - //create svg - var svg = d3.select("#svg_dinamic"); - svg.selectAll("g").remove(); - if (percentage_w === true) { - if(max_w < 0 || min_w < 0) { - paint_graph_status(0,0,0,0,0,0,1,0,legend_normal,legend_warning,legend_critical,message_error_percentage,message_error_percentage); - } else { - $("#text-max_warning").removeClass("input_error"); - $("#text-min_warning").removeClass("input_error"); - } - - } - - if(percentage_c === true) { - if(max_c < 0 || min_c < 0) { - paint_graph_status(0,0,0,0,0,0,0,1,legend_normal,legend_warning,legend_critical,message_error_percentage,message_error_percentage); - } else { - $("#text-min-critical").removeClass("input_error"); - $("#text-max_critical").removeClass("input_error"); - - } - } - - return; - - } else { - $('#svg_dinamic').show(); - } //if haven't error if(max_w == 0 || max_w > min_w){ if(max_c == 0 || max_c > min_c){ - paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, - inverse_c, error_w, error_c, - legend_normal, legend_warning, legend_critical, - message_error_warning, message_error_critical); + paint_graph_status( + min_w, max_w, min_c, max_c, inverse_w, + inverse_c, error_w, error_c, + legend_normal, legend_warning, legend_critical, + message_error_warning, message_error_critical + ); } else { error_c = 1; - paint_graph_status(0,0,0,0,0,0, error_w, error_c, - legend_normal, legend_warning, legend_critical, - message_error_warning, message_error_critical); + paint_graph_status( + 0,0,0,0,0,0, error_w, error_c, + legend_normal, legend_warning, legend_critical, + message_error_warning, message_error_critical + ); } } else { error_w = 1; - paint_graph_status(0,0,0,0,0,0, error_w, error_c, - legend_normal, legend_warning, legend_critical, - message_error_warning, message_error_critical); + paint_graph_status( + 0,0,0,0,0,0, error_w, error_c, + legend_normal, legend_warning, legend_critical, + message_error_warning, message_error_critical + ); } } -/* End of relationship javascript */ /* ]]> */ From 423767a32a1c82e3193eb1b8c7ddc8dca597770f Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 14 Mar 2023 17:27:01 +0100 Subject: [PATCH 5/6] fixed styles --- .../godmode/agentes/module_manager_editor_common.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index b87d508546..0231245274 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -1906,21 +1906,9 @@ $(document).ready (function () { }); $('.switch_radio_button label').on('click', function(){ - console.log('primero'); var thisLabel = $(this).attr('for'); - console.log(thisLabel); $('#'+thisLabel).prop('checked', true); $('#'+thisLabel).siblings().prop('checked', false); - - console.log('++++++++++Los warning++++++++++++++'); - console.log('normal_warning: '+$('#radius-normal_warning').prop('checked')); - console.log('warning_inverse: '+$('#radius-warning_inverse').prop('checked')); - console.log('percentage_warning: '+$('#radius-percentage_warning').prop('checked')); - - console.log('++++++++++Los critical++++++++++++++'); - console.log('normal_critical: '+$('#radius-normal_critical').prop('checked')); - console.log('critical_inverse: '+$('#radius-critical_inverse').prop('checked')); - console.log('percentage_critical: '+$('#radius-percentage_critical').prop('checked')); if ($('#radius-percentage_warning').prop('checked') === true || $('#radius-percentage_critical').prop('checked') === true) { $("#svg_dinamic").hide(); From f9fe35e0c391e19432221625b290dc570982a712 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 14 Mar 2023 17:28:17 +0100 Subject: [PATCH 6/6] log viewer and sort reporting --- .../reporting_builder.list_items.php | 2 +- pandora_console/include/functions_ui.php | 19 +++++-------------- .../javascript/elasticsearch_queryResult.js | 2 +- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.list_items.php b/pandora_console/godmode/reporting/reporting_builder.list_items.php index 15f9e391c3..6b5dda8159 100755 --- a/pandora_console/godmode/reporting/reporting_builder.list_items.php +++ b/pandora_console/godmode/reporting/reporting_builder.list_items.php @@ -875,7 +875,7 @@ if (defined('METACONSOLE')) { ], true ); - $form .= html_print_input_hidden('action', 'filter', true); + $form .= html_print_input_hidden('action', 'sort_items', true); $form .= ''; ui_toggle($form, __('Sort items'), '', '', false); diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 1c632d6f9e..e04246a4f2 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -7073,20 +7073,6 @@ function ui_query_result_editor($name='default') true ); - $editorSubContainer .= html_print_div( - [ - 'class' => 'action-buttons edit-button', - 'content' => html_print_submit_button( - __('Execute query'), - 'execute_query', - false, - ['icon' => 'next'], - true - ), - ], - true - ); - $editorContainer = html_print_div( [ 'id' => $name.'_editor_container', @@ -7144,6 +7130,11 @@ function ui_query_result_editor($name='default') 'content' => ui_get_full_url(false, false, false, false), ] ); + + $buttons = html_print_submit_button(__('Execute query'), 'execute_query', false, ['icon' => 'update'], true); + html_print_action_buttons( + $buttons + ); } diff --git a/pandora_console/include/javascript/elasticsearch_queryResult.js b/pandora_console/include/javascript/elasticsearch_queryResult.js index 6a57e266bc..c50f8955b3 100644 --- a/pandora_console/include/javascript/elasticsearch_queryResult.js +++ b/pandora_console/include/javascript/elasticsearch_queryResult.js @@ -9,7 +9,7 @@ view.renderer.setShowGutter(false); view.setReadOnly(true); view.setShowPrintMargin(false); -$("#submit-execute_query").click(function() { +$("#button-execute_query").click(function() { view.setValue(""); let text; let selectText = editor.getSelectedText();