Merge branch 'ent-1419-umbrales-en-graficas-pdf-4649-com1' into 'develop'

add treshold pdf pandora_enterprise#1419

See merge request artica/pandorafms!4894
This commit is contained in:
daniel 2022-06-28 13:45:53 +00:00
commit 867e659118
8 changed files with 54 additions and 21 deletions

View File

@ -135,6 +135,7 @@ $current_month = true;
// Only avg is selected by default for the simple graphs.
$fullscale = false;
$percentil = false;
$image_threshold = false;
$time_compare_overlapped = false;
// Added for events items.
@ -307,6 +308,7 @@ switch ($action) {
case 'simple_graph':
$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
$percentil = isset($style['percentil']) ? (bool) $style['percentil'] : 0;
$image_threshold = (isset($style['image_threshold']) === true) ? (bool) $style['image_threshold'] : false;
$graph_render = $item['graph_render'];
// The break hasn't be forgotten.
case 'simple_baseline_graph':
@ -2504,6 +2506,23 @@ $class = 'databox filters';
</td>
</tr>
<tr id="row_image_threshold" class="datos">
<td class="bolder">
<?php
echo __('Show threshold');
?>
</td>
<td>
<?php
html_print_checkbox_switch(
'image_threshold',
1,
$image_threshold
);
?>
</td>
</tr>
<tr id="row_time_compare_overlapped" class="datos">
<td class="bolder">
<?php
@ -5965,6 +5984,7 @@ function chooseType() {
$("#row_show_graph").hide();
$("#row_max_min_avg").hide();
$("#row_fullscale").hide();
$("#row_image_threshold").hide();
$("#row_graph_render").hide();
$("#row_macros_definition").hide();
$("#row_render_definition").hide();
@ -6099,6 +6119,7 @@ function chooseType() {
case 'simple_graph':
$("#row_time_compare_overlapped").show();
$("#row_fullscale").show();
$("#row_image_threshold").show();
$("#row_graph_render").show();
$("#row_percentil").show();

View File

@ -2255,6 +2255,9 @@ switch ($action) {
$style['fullscale'] = (int) get_parameter(
'fullscale'
);
$style['image_threshold'] = (int) get_parameter(
'image_threshold'
);
if ($label != '') {
$style['label'] = $label;
} else {
@ -3006,6 +3009,9 @@ switch ($action) {
$style['fullscale'] = (int) get_parameter(
'fullscale'
);
$style['image_threshold'] = (int) get_parameter(
'image_threshold'
);
if ($label != '') {
$style['label'] = $label;
} else {

View File

@ -410,7 +410,7 @@ if (check_login()) {
$table_modules->head = [];
$table_modules->head[0] = __('Module name');
$table_modules->head[1] = __('Data');
$table_modules->head[2] = __('Treshold');
$table_modules->head[2] = __('Threshold');
$table_modules->head[3] = __('Current interval');
$table_modules->head[4] = __('Timestamp');
$table_modules->head[5] = __('Status');

View File

@ -1196,7 +1196,7 @@ class AgentWizard extends HTML
$table->head[1] = '<b>'.__('Server').'</b>';
$table->head[2] = '<b>'.__('Type').'</b>';
$table->head[3] = '<b>'.__('Description').'</b>';
$table->head[4] = '<b>'.__('Treshold').'</b>';
$table->head[4] = '<b>'.__('Threshold').'</b>';
$table->data = [];

View File

@ -14699,7 +14699,7 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4)
'type_graph' => $config['type_module_charts'],
'fullscale' => false,
'return_img_base_64' => true,
'image_treshold' => $graph_threshold,
'image_threshold' => $graph_threshold,
'graph_font_size' => $graph_font_size,
];

View File

@ -626,7 +626,7 @@ function grafico_modulo_sparse_data(
* 'show_legend' => true,
* 'show_overview' => true,
* 'return_img_base_64' => false,
* 'image_treshold' => false,
* 'image_threshold' => false,
* 'graph_combined' => false,
* 'graph_render' => 0,
* 'zoom' => 1,
@ -782,8 +782,8 @@ function grafico_modulo_sparse($params)
$params['return_img_base_64'] = false;
}
if (isset($params['image_treshold']) === false) {
$params['image_treshold'] = false;
if (isset($params['image_threshold']) === false) {
$params['image_threshold'] = false;
}
if (isset($params['graph_combined']) === false) {
@ -1305,8 +1305,8 @@ function graphic_combined_module(
$params['return_img_base_64'] = false;
}
if (isset($params['image_treshold']) === false) {
$params['image_treshold'] = false;
if (isset($params['image_threshold']) === false) {
$params['image_threshold'] = false;
}
if (isset($params['show_unknown']) === false) {

View File

@ -10159,6 +10159,11 @@ function reporting_simple_graph(
$fullscale = (bool) $content['style']['fullscale'];
}
$image_threshold = false;
if (isset($content['style']['image_threshold'])) {
$image_threshold = (bool) $content['style']['image_threshold'];
}
$return['chart'] = '';
// Get chart.
@ -10213,6 +10218,7 @@ function reporting_simple_graph(
'backgroundColor' => 'transparent',
'return_img_base_64' => true,
'graph_render' => $content['graph_render'],
'image_threshold' => $image_threshold,
];
if ($only_image === false) {

View File

@ -1017,7 +1017,7 @@ function pandoraFlotArea(
var max_x = date_array["final_date"] * 1000;
var type = parseInt(params.stacked);
var show_legend = params.show_legend;
var image_treshold = params.image_treshold;
var image_threshold = params.image_threshold;
var short_data = params.short_data != "" ? params.short_data : 3;
var grid_color = params.grid_color;
var background_color = params.backgroundColor;
@ -2212,7 +2212,7 @@ function pandoraFlotArea(
}
if (thresholded) {
var data_base_treshold = add_threshold(
var data_base_threshold = add_threshold(
data_base,
threshold_data,
ranges.yaxis.from,
@ -2225,7 +2225,7 @@ function pandoraFlotArea(
plot = $.plot(
$("#" + graph_id),
data_base_treshold,
data_base_threshold,
$.extend(true, {}, options, {
grid: {
borderWidth: 1,
@ -2611,7 +2611,7 @@ function pandoraFlotArea(
$("#overview_" + graph_id).bind("mouseout", resetInteractivity);
}
if (image_treshold) {
if (image_threshold) {
var y_recal = plot.getAxes().yaxis.max;
if (!thresholded) {
// Recalculate the y axis
@ -2625,7 +2625,7 @@ function pandoraFlotArea(
);
}
var datas_treshold = add_threshold(
var datas_threshold = add_threshold(
data_base,
threshold_data,
plot.getAxes().yaxis.min,
@ -2638,7 +2638,7 @@ function pandoraFlotArea(
plot = $.plot(
$("#" + graph_id),
datas_treshold,
datas_threshold,
$.extend(true, {}, options, {
yaxis: {
max: y_recal.max
@ -2772,7 +2772,7 @@ function pandoraFlotArea(
);
}
datas_treshold = add_threshold(
datas_threshold = add_threshold(
data_base,
threshold_data,
plot.getAxes().yaxis.min,
@ -2785,7 +2785,7 @@ function pandoraFlotArea(
plot = $.plot(
$("#" + graph_id),
datas_treshold,
datas_threshold,
$.extend(true, {}, options, {
yaxis: {
min: max_draw["min"],
@ -3096,7 +3096,7 @@ function axis_thresholded(
return y;
}
//add treshold
//add threshold
function add_threshold(
data_base,
threshold_data,
@ -3216,13 +3216,13 @@ function add_threshold(
}
});
var extreme_treshold_array = [];
var extreme_threshold_array = [];
var i = 0;
var flag = true;
$.each(threshold_array, function(index, value) {
flag = true;
extreme_treshold_array[i] = {
extreme_threshold_array[i] = {
below: value["max"],
color: value["color"]
};
@ -3233,7 +3233,7 @@ function add_threshold(
}
});
if (flag) {
extreme_treshold_array[i] = {
extreme_threshold_array[i] = {
below: value["min"],
color: datas[0].color
};
@ -3241,7 +3241,7 @@ function add_threshold(
}
});
datas[0].threshold = extreme_treshold_array;
datas[0].threshold = extreme_threshold_array;
return datas;
}