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; +}