Added module units in module graphs

Former-commit-id: d17383bd9e8ea7101cf5479b01e2ab0bf45c6813
This commit is contained in:
samucarc 2019-03-04 15:53:47 +01:00
parent 3ed6a2b089
commit 7d88af625e
2 changed files with 9 additions and 6 deletions

View File

@ -3533,21 +3533,21 @@ function series_type_graph_array($data, $show_elements_graph)
&& is_array($show_elements_graph['labels'])
&& (count($show_elements_graph['labels']) > 0)
) {
if ($show_elements_graph['unit']) {
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].' / '.__('Unit ').' '.$show_elements_graph['unit'].': ';
if ($value['unit']) {
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].' / '.__('Unit ').' '.$value['unit'].': ';
} else {
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].': ';
}
} else {
if (strpos($key, 'baseline') !== false) {
if ($show_elements_graph['unit']) {
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].' / '.__('Unit ').' '.$show_elements_graph['unit'].'Baseline ';
if ($value['unit']) {
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].' / '.__('Unit ').' '.$value['unit'].'Baseline ';
} else {
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].'Baseline ';
}
} else {
if ($show_elements_graph['unit']) {
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].' / '.__('Unit ').' '.$show_elements_graph['unit'].': ';
if ($value['unit']) {
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].' / '.__('Unit ').' '.$value['unit'].': ';
} else {
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].': ';
}

View File

@ -256,6 +256,7 @@ function grafico_modulo_sparse_data(
$array_data['sum'.$series_suffix]['agent_name'] = $data_module_graph['agent_name'];
$array_data['sum'.$series_suffix]['module_name'] = $data_module_graph['module_name'];
$array_data['sum'.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
$array_data['sum'.$series_suffix]['unit'] = $data_module_graph['unit'];
// This is for a specific type of report that consists in passing an interval and doing the average sum and avg.
if ($params['force_interval'] != '') {
@ -754,6 +755,7 @@ function grafico_modulo_sparse($params)
$data_module_graph['c_min'] = $module_data['min_critical'];
$data_module_graph['c_max'] = $module_data['max_critical'];
$data_module_graph['c_inv'] = $module_data['critical_inverse'];
$data_module_graph['unit'] = $module_data['unit'];
} else {
$data_module_graph = false;
}
@ -1352,6 +1354,7 @@ function graphic_combined_module(
$data_module_graph['c_max'] = $module_data['max_critical'];
$data_module_graph['c_inv'] = $module_data['critical_inverse'];
$data_module_graph['module_id'] = $agent_module_id;
$data_module_graph['unit'] = $module_data['unit'];
// stract data
$array_data_module = grafico_modulo_sparse_data(