fixed histogram-graph

This commit is contained in:
Daniel Cebrian 2024-02-14 16:58:52 +01:00
parent 8d3a7e6a7f
commit 30893762a3
2 changed files with 15 additions and 4 deletions
pandora_console

View File

@ -5941,6 +5941,7 @@ ui_require_javascript_file('pandora');
?>
<script type="text/javascript">
const ACTION = '<?php echo $actionParameter; ?>';
$(document).ready (function () {
chooseType();
chooseSQLquery();
@ -7601,6 +7602,12 @@ function chooseType() {
$("#row_ncm_group").hide();
$("#row_ncm_agent").hide();
if (ACTION !== 'update') {
// Set default period value, this value will be change for each report.
period_set_value($("#hidden-period").attr('class'), 300);
$("#row_period").find('select').val('300').trigger('change');
}
switch (type) {
case 'event_report_group':
$("#row_description").show();
@ -7763,8 +7770,10 @@ function chooseType() {
$("#row_agent").show();
$("#row_module").show();
$("#row_historical_db_check").hide();
period_set_value($("#hidden-period").attr('class'), 3600);
$("#row_period").find('select').val('3600').trigger('change');
if (ACTION !== 'update') {
period_set_value($("#hidden-period").attr('class'), 3600);
$("#row_period").find('select').val('3600').trigger('change');
}
break;
case 'SLA_monthly':

View File

@ -16206,7 +16206,8 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
// Si viene de no iniciado busco el primer dato del modulo y si es de histórico.
$first_utimestamp = false;
$search_historydb = false;
$extract_first_data = modules_get_first_date($content['id_agent_module'], 0);
// Limitamos el primer dato al rango de tiempo seleccionado por el usuario.
$extract_first_data = modules_get_first_date($content['id_agent_module'], $date_start);
if (empty($extract_first_data) === false) {
$first_utimestamp = $extract_first_data['first_utimestamp'];
$search_historydb = (isset($extract_first_data['search_historydb']) === true) ? $extract_first_data['search_historydb'] : false;
@ -16311,7 +16312,8 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
$return['data_ok'] = $check_ok;
$return['data_total'] = $check_total;
if ($check_total > 0) {
$return['percent_ok'] = (($time_ok * 100) / $content['period']);
$percent_ok = (($time_ok * 100) / $content['period']);
$return['percent_ok'] = ($percent_ok > 100) ? 100 : $percent_ok;
} else {
$return['percent_ok'] = 0;
}