Fixed bug showing total events in tactical view on dashboard - #4075

This commit is contained in:
Tatiana Llorente 2019-06-17 12:31:20 +02:00
parent 38412f2c9a
commit 4d287a6f36
1 changed files with 29 additions and 13 deletions

View File

@ -11105,7 +11105,8 @@ function reporting_get_stats_servers()
$output = '<fieldset class="databox tactical_set">
<legend>'.__('Server performance').'</legend>'.html_print_table($table_srv, true).'</fieldset>';
$public_hash = get_parameter('hash', false);
if ($public_hash === false) {
$output .= '<script type="text/javascript">';
$output .= '$(document).ready(function () {';
$output .= 'var parameters = {};';
@ -11119,6 +11120,21 @@ function reporting_get_stats_servers()
$output .= '});';
$output .= '});';
$output .= '</script>';
} else {
// This is for public link on the dashboard
$sql_count_event = 'SELECT SQL_NO_CACHE COUNT(id_evento) FROM tevento ';
if ($config['event_view_hr']) {
$sql_count_event .= 'WHERE utimestamp > (UNIX_TIMESTAMP(NOW()) - '.($config['event_view_hr'] * SECONDS_1HOUR).')';
}
$system_events = db_get_value_sql($sql_count_event);
$output .= '<script type="text/javascript">';
$output .= '$(document).ready(function () {';
$output .= '$("#total_events").text("'.$system_events.'");';
$output .= '});';
$output .= '</script>';
}
return $output;
}