Merge branch 'ent-12884-item-module-histogram-graph' into 'develop'

Ent 12884 Item "module histogram graph"

See merge request artica/pandorafms!6939
This commit is contained in:
Rafael Ameijeiras 2024-02-15 12:07:05 +00:00
commit 80991a32f9
2 changed files with 15 additions and 4 deletions

View File

@ -5941,6 +5941,7 @@ ui_require_javascript_file('pandora');
?> ?>
<script type="text/javascript"> <script type="text/javascript">
const ACTION = '<?php echo $actionParameter; ?>';
$(document).ready (function () { $(document).ready (function () {
chooseType(); chooseType();
chooseSQLquery(); chooseSQLquery();
@ -7601,6 +7602,12 @@ function chooseType() {
$("#row_ncm_group").hide(); $("#row_ncm_group").hide();
$("#row_ncm_agent").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) { switch (type) {
case 'event_report_group': case 'event_report_group':
$("#row_description").show(); $("#row_description").show();
@ -7763,8 +7770,10 @@ function chooseType() {
$("#row_agent").show(); $("#row_agent").show();
$("#row_module").show(); $("#row_module").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
period_set_value($("#hidden-period").attr('class'), 3600); if (ACTION !== 'update') {
$("#row_period").find('select').val('3600').trigger('change'); period_set_value($("#hidden-period").attr('class'), 3600);
$("#row_period").find('select').val('3600').trigger('change');
}
break; break;
case 'SLA_monthly': 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. // Si viene de no iniciado busco el primer dato del modulo y si es de histórico.
$first_utimestamp = false; $first_utimestamp = false;
$search_historydb = 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) { if (empty($extract_first_data) === false) {
$first_utimestamp = $extract_first_data['first_utimestamp']; $first_utimestamp = $extract_first_data['first_utimestamp'];
$search_historydb = (isset($extract_first_data['search_historydb']) === true) ? $extract_first_data['search_historydb'] : false; $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_ok'] = $check_ok;
$return['data_total'] = $check_total; $return['data_total'] = $check_total;
if ($check_total > 0) { 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 { } else {
$return['percent_ok'] = 0; $return['percent_ok'] = 0;
} }