Added new radio button to interface graphs (area or line graph) and fix agents graph section type (now get the stack value from the visual config). Ticket

This commit is contained in:
Arturo Gonzalez 2016-11-30 10:23:06 +01:00
parent 6842abcd58
commit 00c81d5863
5 changed files with 38 additions and 5 deletions

View File

@ -447,6 +447,15 @@ $table_chars->data[$row][1] .= __('Line').' ' .
$config["type_module_charts"] != 'area', true);
$row++;
$table_chars->data[$row][0] = __('Type of interface charts');
$table_chars->data[$row][1] = __('Area').' ' .
html_print_radio_button ('type_interface_charts', 'area', '',
$config["type_interface_charts"] == 'area', true).'  ';
$table_chars->data[$row][1] .= __('Line').' ' .
html_print_radio_button ('type_interface_charts', 'line', '',
$config["type_interface_charts"] != 'area', true);
$row++;
$table_chars->data[$row][0] = __('Show only average');
$table_chars->data[$row][0] .= ui_print_help_tip(__('Allows only show the average in graphs'), true);
$table_chars->data[$row][1] = __('Yes').' ' .

View File

@ -514,6 +514,8 @@ function config_update_config () {
$error_update[] = __('Default line thickness for the Custom Graph.');
if (!config_update_value ('type_module_charts', (string) get_parameter('type_module_charts', 'area')))
$error_update[] = __('Default type of module charts.');
if (!config_update_value ('type_interface_charts', (string) get_parameter('type_interface_charts', 'line')))
$error_update[] = __('Default type of interface charts.');
if (!config_update_value ('only_average', (bool) get_parameter('only_average', false)))
$error_update[] = __('Default show only average or min and max');
if (!config_update_value ('render_proc', (bool) get_parameter('render_proc', false)))
@ -1515,6 +1517,10 @@ function config_process_config () {
if (!isset($config['type_module_charts'])) {
config_update_value ('type_module_charts', 'area');
}
if (!isset($config['type_interface_charts'])) {
config_update_value ('type_interface_charts', 'line');
}
if (!isset($config['render_proc'])) {
config_update_value ('render_proc', 0);

View File

@ -168,11 +168,21 @@ function custom_graphs_print($id_graph, $height, $width, $period,
global $config;
if ($id_graph == 0) {
$graph_conf['stacked'] = CUSTOM_GRAPH_LINE;
if ($from_interface) {
if ($config["type_interface_charts"] == 'line') {
$graph_conf['stacked'] = CUSTOM_GRAPH_LINE;
}
else {
$graph_conf['stacked'] = CUSTOM_GRAPH_AREA;
}
}
else {
$graph_conf = db_get_row('tgraph', 'id_graph', $id_graph);
if ($id_graph == 0) {
$graph_conf['stacked'] = CUSTOM_GRAPH_LINE;
}
else {
$graph_conf = db_get_row('tgraph', 'id_graph', $id_graph);
}
}
if ($stacked === null) {

View File

@ -1877,7 +1877,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$height, $color, $module_name_list, $long_index,
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
$title, "", $homeurl, $water_mark, $config['fontpath'],
$fixed_font_size, $unit, $ttl, array(), array(), 0, 0, '',
$fixed_font_size, $unit, $ttl, array(), array(), $yellow_threshold, $red_threshold, '',
false, '', true, $background_color,$dashboard, $vconsole);
break;
default:

View File

@ -349,7 +349,15 @@ echo "</div>";
var $container = $(element);
var $errorMessage = $('div#graph-error-message');
var period = $container.data('period');
var stacked = $container.data('stacked');
var conf_stacked = '<?php echo $config['type_module_charts']; ?>';
switch (conf_stacked) {
case 'area':
var stacked = 0;
break;
case 'line':
var stacked = 2;
break;
}
var date = $container.data('date');
var height = $container.data('height');