#10194 graph adjusted and fixed bug

This commit is contained in:
Daniel Cebrian 2023-10-03 15:32:53 +02:00
parent e64eadcb37
commit c2bc53bbd9
4 changed files with 16 additions and 9 deletions

View File

@ -156,7 +156,11 @@ class Element
$rawData = modules_get_raw_data($module['id_agente_modulo'], $dateInit, $dateEnd); $rawData = modules_get_raw_data($module['id_agente_modulo'], $dateInit, $dateEnd);
} }
return $rawData; if ($rawData === false || is_array($rawData) === false) {
return [['datos' => 0]];
} else {
return $rawData;
}
} else { } else {
return [['datos' => 0]]; return [['datos' => 0]];
} }

View File

@ -135,7 +135,7 @@ class Alerts extends Element
'field' => 'title', 'field' => 'title',
'direction' => 'asc', 'direction' => 'asc',
], ],
'default_pagination' => 8, 'default_pagination' => 10,
'search_button_class' => 'sub filter float-right', 'search_button_class' => 'sub filter float-right',
'return' => true, 'return' => true,
] ]

View File

@ -178,8 +178,13 @@ class LogStorage extends Element
{ {
$data = $this->valueMonitoring('Longest data archived'); $data = $this->valueMonitoring('Longest data archived');
$date = $data[0]['datos']; $date = $data[0]['datos'];
$interval = (time() - strtotime($date)); if ($date > 0) {
$days = round($interval / 86400); $interval = (time() - strtotime($date));
$days = round($interval / 86400);
} else {
$days = '-';
}
return html_print_div( return html_print_div(
[ [
'content' => $days, 'content' => $days,

View File

@ -173,14 +173,12 @@ class Overview extends Element
// TODO connect to automonitorization. // TODO connect to automonitorization.
$options = [ $options = [
'labels' => [ 'labels' => [
'Open Source', 'Agents used',
'Enterprise', 'Free agents',
'MaaS',
], ],
'colors' => [ 'colors' => [
'#1C4E6B', '#1C4E6B',
'#5C63A2', '#5C63A2',
'#EC7176',
], ],
'legend' => [ 'legend' => [
'position' => 'bottom', 'position' => 'bottom',
@ -188,7 +186,7 @@ class Overview extends Element
], ],
'cutout' => 80, 'cutout' => 80,
]; ];
$pie = ring_graph([2, 4, 6], $options); $pie = ring_graph([60, 40], $options);
$output = html_print_div( $output = html_print_div(
[ [
'content' => $pie, 'content' => $pie,