Merge branch '1908-No-se-muestran-correctamente-las-gráficas-en-valores-con-decimales-dev' into 'develop'
Fixed graph precision See merge request artica/pandorafms!1327
This commit is contained in:
commit
5ef9e08770
|
@ -0,0 +1,13 @@
|
|||
START TRANSACTION;
|
||||
|
||||
SET @st_oum720 = (SELECT IF(
|
||||
(SELECT value FROM tconfig WHERE token like 'short_module_graph_data') = 1,
|
||||
"UPDATE tconfig SET value = 2 WHERE token LIKE 'short_module_graph_data'",
|
||||
"UPDATE tconfig SET value = '' WHERE token LIKE 'short_module_graph_data'"
|
||||
));
|
||||
|
||||
PREPARE pr_oum720 FROM @st_oum720;
|
||||
EXECUTE pr_oum720;
|
||||
DEALLOCATE PREPARE pr_oum720;
|
||||
|
||||
COMMIT;
|
|
@ -1159,10 +1159,10 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
|
|||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 12);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 13);
|
||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '719');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '720');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tplanned_downtime_agents`
|
||||
|
|
|
@ -487,11 +487,18 @@ if (!enterprise_installed()) {
|
|||
$disabled_graph_precision = true;
|
||||
}
|
||||
|
||||
$table_chars->data[$row][0] = __('Data precision for reports and visual consoles');
|
||||
$table_chars->data[$row][0] .= ui_print_help_tip(__('Number of decimals shown in reports and visual consoles. It must be a number between 0 and 5'), true);
|
||||
$table_chars->data[$row][0] = __('Data precision in PandoraFMS');
|
||||
$table_chars->data[$row][0] .= ui_print_help_tip(__('Number of decimals shown. It must be a number between 0 and 5, except in graphs.'), true);
|
||||
$table_chars->data[$row][1] = html_print_input_text ('graph_precision', $config["graph_precision"], '', 5, 5, true, $disabled_graph_precision, false, "onChange=\"change_precision()\"");
|
||||
$row++;
|
||||
|
||||
if (!isset($config["short_module_graph_data"]))
|
||||
$config["short_module_graph_data"] = true;
|
||||
$table_chars->data[$row][0] = __('Data precision in graphs');
|
||||
$table_chars->data[$row][0] .= ui_print_help_tip(__('Number of decimals shown. If the field is empty, it will show all the decimals'), true);
|
||||
$table_chars->data[$row][1] = html_print_input_text ('short_module_graph_data', $config["short_module_graph_data"], '', 5, 5, true, $disabled_graph_precision, false, "onChange=\"change_precision()\"");
|
||||
$row++;
|
||||
|
||||
$table_chars->data[$row][0] = __('Default line thickness for the Custom Graph.');
|
||||
$table_chars->data[$row][1] = html_print_input_text ('custom_graph_width',
|
||||
$config["custom_graph_width"], '', 5, 5, true);
|
||||
|
@ -510,18 +517,6 @@ $table_chars->data[$row][1] .= __('No').' ' .
|
|||
html_print_radio_button ('flash_charts', 0, '', $config["global_flash_charts"], true);
|
||||
$row++;
|
||||
|
||||
if (!isset($config["short_module_graph_data"]))
|
||||
$config["short_module_graph_data"] = true;
|
||||
$table_chars->data[$row][0] = __('Shortened module graph data');
|
||||
$table_chars->data[$row][0] .= ui_print_help_tip(__('The data number of the module graphs will be rounded and shortened'), true);
|
||||
$table_chars->data[$row][1] = __('Yes') . ' ' .
|
||||
html_print_radio_button ('short_module_graph_data', 1, '',
|
||||
$config["short_module_graph_data"], true) .
|
||||
' ';
|
||||
$table_chars->data[$row][1] .= __('No') . ' ' .
|
||||
html_print_radio_button ('short_module_graph_data', 0, '',
|
||||
$config["short_module_graph_data"], true);
|
||||
$row++;
|
||||
|
||||
$table_chars->data[$row][0] = __('Type of module charts');
|
||||
$table_chars->data[$row][1] = __('Area').' ' .
|
||||
|
|
|
@ -1864,6 +1864,10 @@ function config_process_config () {
|
|||
config_update_value ('networkmap_max_width', 900);
|
||||
}
|
||||
|
||||
if (!isset($config['short_module_graph_data'])) {
|
||||
config_update_value ('short_module_graph_data', '');
|
||||
}
|
||||
|
||||
if (!isset($config['tutorial_mode'])) {
|
||||
config_update_value ('tutorial_mode', 'full');
|
||||
}
|
||||
|
|
|
@ -1773,7 +1773,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||
$('#timestamp_'+graph_id).show();
|
||||
// If no legend, the timestamp labels are short and with value
|
||||
if (legend.length == 0) {
|
||||
$('#timestamp_'+graph_id).text(labels[j] + ' (' + (short_data ? parseFloat(y).toFixed(2) : parseFloat(y)) + ')');
|
||||
$('#timestamp_'+graph_id).text(labels[j] + ' (' + (short_data ? number_format(y, 0, "", short_data) : parseFloat(y)) + ')');
|
||||
}
|
||||
else {
|
||||
$('#timestamp_'+graph_id).text(labels_long[j]);
|
||||
|
@ -1809,7 +1809,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||
// The graphs of points type and unknown graphs will dont be updated
|
||||
if (serie_types[i] != 'points' && series.label != $('#hidden-unknown_text').val()) {
|
||||
$('#legend_' + graph_id + ' .legendLabel')
|
||||
.eq(i).html(label_aux + '= ' + (short_data ? parseFloat(y).toFixed(2) : parseFloat(y)) + how_bigger + ' ' + unit);
|
||||
.eq(i).html(label_aux + '= ' + (short_data ? number_format(y, 0, "", short_data) : parseFloat(y)) + how_bigger + ' ' + unit);
|
||||
}
|
||||
|
||||
$('#legend_' + graph_id + ' .legendLabel')
|
||||
|
@ -1925,7 +1925,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||
function yFormatter(v, axis) {
|
||||
axis.datamin = 0;
|
||||
if (short_data) {
|
||||
var formatted = number_format(v, force_integer, "");
|
||||
var formatted = number_format(v, force_integer, "", short_data);
|
||||
}
|
||||
else {
|
||||
var formatted = v;
|
||||
|
@ -2177,15 +2177,16 @@ function check_adaptions(graph_id) {
|
|||
});
|
||||
}
|
||||
|
||||
function number_format(number, force_integer, unit) {
|
||||
function number_format(number, force_integer, unit, short_data) {
|
||||
if (force_integer) {
|
||||
if (Math.round(number) != number) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Round to 2 decimals
|
||||
number = Math.round(number * 100) / 100;
|
||||
short_data ++;
|
||||
decimals = pad(1, short_data, 0);
|
||||
number = Math.round(number * decimals) / decimals;
|
||||
}
|
||||
|
||||
var shorts = ["", "K", "M", "G", "T", "P", "E", "Z", "Y"];
|
||||
|
@ -2206,6 +2207,11 @@ function number_format(number, force_integer, unit) {
|
|||
|
||||
return number + ' ' + shorts[pos] + unit;
|
||||
}
|
||||
|
||||
function pad(input, length, padding) {
|
||||
var str = input + "";
|
||||
return (length <= str.length) ? str : pad(str+padding, length, padding);
|
||||
}
|
||||
// Recalculate the threshold data depends on warning and critical
|
||||
function axis_thresholded (threshold_data, y_min, y_max, red_threshold, extremes, red_up) {
|
||||
|
||||
|
|
|
@ -490,14 +490,10 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
|||
true);
|
||||
|
||||
if (!isset($config["short_module_graph_data"]))
|
||||
$config["short_module_graph_data"] = true;
|
||||
$config["short_module_graph_data"] = '';
|
||||
|
||||
$short_data = $config["short_module_graph_data"];
|
||||
|
||||
if ($config["short_module_graph_data"]) {
|
||||
$short_data = true;
|
||||
}
|
||||
else {
|
||||
$short_data = false;
|
||||
}
|
||||
|
||||
|
||||
// Javascript code
|
||||
|
|
|
@ -109,10 +109,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
||||
('custom_report_front_header', ''),
|
||||
('custom_report_front_footer', ''),
|
||||
('MR', 12),
|
||||
('MR', 13),
|
||||
('identification_reminder', 1),
|
||||
('identification_reminder_timestamp', 0),
|
||||
('current_package_enterprise', '719'),
|
||||
('current_package_enterprise', '720'),
|
||||
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}');
|
||||
|
||||
UNLOCK TABLES;
|
||||
|
|
Loading…
Reference in New Issue