fixed errors in setup tip AND prediction modules

This commit is contained in:
daniel 2017-10-11 13:17:29 +02:00
parent 6bc0949942
commit e912e151a9
2 changed files with 41 additions and 24 deletions

View File

@ -4223,8 +4223,13 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$chart_extra_data['legend_alerts'] = $legend['alert'.$series_suffix];
}
$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.remove_right_zeros(number_format($graph_stats['sum']['last'], $config['graph_precision'])).' '.$unit.' ; '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['sum']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['sum']['min'], $config['graph_precision'])).' '.$unit;
if(!$fullscale){
$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.remove_right_zeros(number_format($graph_stats['sum']['last'], $config['graph_precision'])).' '.$unit.' ; '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['sum']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['sum']['min'], $config['graph_precision'])).' '.$unit;
}
else{
$legend['sum'.$series_suffix] = __('Data');
}
if ($show_unknown) {
$legend['unknown'.$series_suffix] = __('Unknown').$series_suffix_str;
$chart_extra_data['legend_unknown'] = $legend['unknown'.$series_suffix];

View File

@ -111,6 +111,9 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
$id = (int) get_parameter ("id", 0);
// Agent id
$agent_id = (int) modules_get_agentmodule_agent($id);
// Kind module
$type_module = modules_get_agentmodule_kind($id);
if (empty($id) || empty($agent_id)) {
ui_print_error_message(__('There was a problem locating the source of the graph'));
exit;
@ -167,27 +170,34 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
$time_compare_separated = get_parameter ("time_compare_separated", 0);
$time_compare_overlapped = get_parameter ("time_compare_overlapped", 0);
$unknown_graph = get_parameter_checkbox ("unknown_graph", 1);
if(!isset($config['full_scale_option']) || $config['full_scale_option'] == 0){
$fullscale = 0;
}
elseif($config['full_scale_option'] == 1){
$fullscale = 1;
}
elseif($config['full_scale_option'] == 2){
if($graph_type == 'boolean'){
$fullscale = 1;
}else{
//$type_module == 'predictionserver';
$fullscale_sent = get_parameter ("fullscale_sent", 0);
if(!$fullscale_sent){
if(!isset($config['full_scale_option']) || $config['full_scale_option'] == 0){
$fullscale = 0;
}
elseif($config['full_scale_option'] == 1){
$fullscale = 1;
}
elseif($config['full_scale_option'] == 2){
if($graph_type == 'boolean'){
html_debug_print('entra1');
$fullscale = 1;
}else{
html_debug_print('entra2');
$fullscale = 0;
}
}
}
$fullscale_other = get_parameter ("fullscale_other", $fullscale);
if(isset($fullscale_other)){
$fullscale = $fullscale_other;
else{
$fullscale = get_parameter('fullscale', 0);
}
html_debug_print($fullscale);
// To avoid the horizontal overflow
$width -= 20;
@ -419,12 +429,14 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
break;
}
$data = array();
$data[0] = __('Show full scale graph (TIP)');
$data[1] = html_print_checkbox ("fullscale", 1, (bool) $fullscale, true, false,'fullscal_other()');
$data[1] .= html_print_input_hidden('fullscale_other', 0, true);
$table->data[] = $data;
$table->rowclass[] = '';
if($type_module != 'predictionserver'){
$data = array();
$data[0] = __('Show full scale graph (TIP)');
$data[1] = html_print_checkbox ("fullscale", 1, (bool) $fullscale,
true, false);
$table->data[] = $data;
$table->rowclass[] = '';
}
$form_table = html_print_table($table, true);