#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);
}
return $rawData;
if ($rawData === false || is_array($rawData) === false) {
return [['datos' => 0]];
} else {
return $rawData;
}
} else {
return [['datos' => 0]];
}

View File

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

View File

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

View File

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