Added module value control to shows units in max, min and avg values. Ticket #159

This commit is contained in:
Arturo Gonzalez 2017-01-17 11:38:00 +01:00
parent 2cbe165d25
commit 1f07d8a022
4 changed files with 53 additions and 14 deletions

View File

@ -334,6 +334,14 @@ $table_font->data[$row][1] = html_print_input_text('item_title_size_text',
$config["item_title_size_text"], '', 3, 3, true);
$row++;
$table_font->data[$row][0] = __('Show units in values report') .
ui_print_help_tip(__('This enabling this, max, min and avg values will be shown with units.'), true);
$table_font->data[$row][1] = __('Yes') . ' ' .
html_print_radio_button ('simple_module_value', 1, '', $config["simple_module_value"], true).'  ';
$table_font->data[$row][1] .= __('No') . ' ' .
html_print_radio_button ('simple_module_value', 0, '', $config["simple_module_value"], true);
$row++;
echo "<fieldset>";
echo "<legend>" . __('Font and Text configuration') . "</legend>";
html_print_table ($table_font);

View File

@ -494,6 +494,8 @@ function config_update_config () {
$error_update[] = __('Item title size text');
if (!config_update_value ('gis_label', get_parameter ('gis_label')))
$error_update[] = __('GIS Labels');
if (!config_update_value ('simple_module_value', get_parameter ('simple_module_value')))
$error_update[] = __('Show units in values report');
if (!config_update_value ('gis_default_icon', get_parameter ('gis_default_icon')))
$error_update[] = __('Default icon in GIS');
if (!config_update_value ('autohidden_menu', get_parameter('autohidden_menu')))
@ -1476,6 +1478,10 @@ function config_process_config () {
if (!isset($config['item_title_size_text'])) {
config_update_value ('item_title_size_text', 45);
}
if (!isset($config['simple_module_value'])) {
config_update_value ('simple_module_value', 1);
}
if (!isset($config['gis_label'])) {
config_update_value ('gis_label', 0);

View File

@ -3690,18 +3690,33 @@ function reporting_value($report, $content, $type) {
break;
case 'min':
$value = reporting_get_agentmodule_data_min(
$content['id_agent_module'], $content['period'], $report["datetime"]);
$formated_value = format_for_graph($value, 2) . " " . $unit;
$content['id_agent_module'], $content['period'], $report["datetime"]);
if (!$config['simple_module_value']) {
$formated_value = $value;
}
else {
$formated_value = format_for_graph($value, 2) . " " . $unit;
}
break;
case 'avg':
$value = reporting_get_agentmodule_data_average(
$content['id_agent_module'], $content['period'], $report["datetime"]);
$formated_value = format_for_graph($value, 2) . " " . $unit;
if (!$config['simple_module_value']) {
$formated_value = $value;
}
else {
$formated_value = format_for_graph($value, 2) . " " . $unit;
}
break;
case 'sum':
$value = reporting_get_agentmodule_data_sum(
$content['id_agent_module'], $content['period'], $report["datetime"]);
$formated_value = format_for_graph($value, 2) . " " . $unit;
if (!$config['simple_module_value']) {
$formated_value = $value;
}
else {
$formated_value = format_for_graph($value, 2) . " " . $unit;
}
break;
case 'MTTR':
$value = reporting_get_agentmodule_mttr(

View File

@ -1553,10 +1553,11 @@ function visual_map_get_simple_value($type, $id_module, $period = SECONDS_1DAY)
$value = __('Unknown');
}
else {
if ( is_numeric($value) )
$value = remove_right_zeros(number_format($value, $config['graph_precision']));
//$value = format_for_graph($value, $config['graph_precision']);
if ( is_numeric($value) ) {
if ($config['simple_module_value']) {
$value = remove_right_zeros(number_format($value, $config['graph_precision']));
}
}
if (!empty($unit_text)) {
$value .= " " . $unit_text;
}
@ -1573,8 +1574,11 @@ function visual_map_get_simple_value($type, $id_module, $period = SECONDS_1DAY)
$value = __('Unknown');
}
else {
if ( is_numeric($value) )
$value = format_for_graph($value, 2);
if ( is_numeric($value) ) {
if ($config['simple_module_value']) {
$value = format_for_graph($value, 2);
}
}
if (!empty($unit_text))
$value .= " " . $unit_text;
}
@ -1586,8 +1590,11 @@ function visual_map_get_simple_value($type, $id_module, $period = SECONDS_1DAY)
$value = __('Unknown');
}
else {
if ( is_numeric($value) )
$value = format_for_graph($value, 2);
if ( is_numeric($value) ) {
if ($config['simple_module_value']) {
$value = format_for_graph($value, 2);
}
}
if (!empty($unit_text))
$value .= " " . $unit_text;
}
@ -1599,8 +1606,11 @@ function visual_map_get_simple_value($type, $id_module, $period = SECONDS_1DAY)
$value = __('Unknown');
}
else {
if ( is_numeric($value) )
$value = format_for_graph($value, 2);
if ( is_numeric($value) ) {
if ($config['simple_module_value']) {
$value = format_for_graph($value, 2);
}
}
if (!empty($unit_text))
$value .= " " . $unit_text;
}