Added new check to equalize maximum thresholds. Ticket #3732.
This commit is contained in:
parent
791a4c307f
commit
bb26f4b82d
|
@ -64,6 +64,12 @@ if ($edit_graph) {
|
|||
$id_group = $graphInTgraph['id_group'];
|
||||
$width = $graphInTgraph['width'];
|
||||
$height = $graphInTgraph['height'];
|
||||
$check = false;
|
||||
|
||||
if ($stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
|
||||
$stacked = CUSTOM_GRAPH_BULLET_CHART;
|
||||
$check = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$id_agent = 0;
|
||||
|
@ -74,7 +80,8 @@ else {
|
|||
$height = 210;
|
||||
$period = SECONDS_1DAY;
|
||||
$factor = 1;
|
||||
$stacked = 0;
|
||||
$stacked = 4;
|
||||
$check = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -137,7 +144,7 @@ echo "<td class='datos'>";
|
|||
html_print_extended_select_for_time ('period', $period, '', '', '0', 10);
|
||||
echo "</td><td class='datos2'>";
|
||||
echo "<b>".__('Type of graph')."</b></td>";
|
||||
echo "<td class='datos2'>";
|
||||
echo "<td class='datos2'> <div style='float:left;display:inline-block'>";
|
||||
|
||||
include_once($config["homedir"] . "/include/functions_graph.php");
|
||||
|
||||
|
@ -153,7 +160,16 @@ $stackeds = array(
|
|||
CUSTOM_GRAPH_PIE => __('Pie')
|
||||
);
|
||||
html_print_select ($stackeds, 'stacked', $stacked);
|
||||
echo "</td>";
|
||||
|
||||
echo "<div style='float:right' id='thresholdDiv' name='thresholdDiv'> <b>".__('Equalize maximum thresholds')."</b>" .
|
||||
ui_print_help_tip (__("If an option is selected, all graphs will have the highest value from all modules included in the graph as a maximum threshold"), true);
|
||||
|
||||
html_print_checkbox('threshold', CUSTOM_GRAPH_BULLET_CHART_THRESHOLD, $check, false, false, '', false);
|
||||
echo "</div>";
|
||||
|
||||
|
||||
|
||||
echo "</div></td>";
|
||||
|
||||
echo "</table>";
|
||||
|
||||
|
@ -167,17 +183,31 @@ echo "</form>";
|
|||
|
||||
|
||||
echo '<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
if ($("#stacked").val() == '. CUSTOM_GRAPH_BULLET_CHART .') {
|
||||
$("#thresholdDiv").show();
|
||||
}else{
|
||||
$("#thresholdDiv").hide();
|
||||
}
|
||||
});
|
||||
|
||||
$("#stacked").change(function(){
|
||||
console.log($(this).val());
|
||||
if ( $(this).val() == '. CUSTOM_GRAPH_GAUGE .') {
|
||||
$("[name=threshold]").prop("checked", false);
|
||||
$(".stacked").hide();
|
||||
$("input[name=\'width\']").hide();
|
||||
}
|
||||
else {
|
||||
$("#thresholdDiv").hide();
|
||||
} else if ($(this).val() == '. CUSTOM_GRAPH_BULLET_CHART .') {
|
||||
$("#thresholdDiv").show();
|
||||
$(".stacked").show();
|
||||
$("input[name=\'width\']").show();
|
||||
} else {
|
||||
$("[name=threshold]").prop("checked", false);
|
||||
$(".stacked").show();
|
||||
$("input[name=\'width\']").show();
|
||||
$("#thresholdDiv").hide();
|
||||
}
|
||||
});
|
||||
|
||||
</script>';
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -74,7 +74,12 @@ if ($add_graph) {
|
|||
$height = get_parameter_post ("height");
|
||||
$stacked = get_parameter ("stacked", 0);
|
||||
$period = get_parameter_post ("period");
|
||||
|
||||
$threshold = get_parameter('threshold');
|
||||
|
||||
if ($threshold == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
|
||||
$stacked = $threshold;
|
||||
}
|
||||
|
||||
// Create graph
|
||||
$values = array(
|
||||
'id_user' => $config['id_user'],
|
||||
|
@ -112,7 +117,12 @@ if ($update_graph) {
|
|||
$period = get_parameter('period');
|
||||
$stacked = get_parameter('stacked');
|
||||
$alerts = get_parameter('alerts');
|
||||
|
||||
$threshold = get_parameter('threshold');
|
||||
|
||||
if ($threshold == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
|
||||
$stacked = $threshold;
|
||||
}
|
||||
|
||||
if (trim($name) != "") {
|
||||
|
||||
$success = db_process_sql_update('tgraph',
|
||||
|
|
|
@ -430,6 +430,7 @@ define("CUSTOM_GRAPH_GAUGE", 5);
|
|||
define("CUSTOM_GRAPH_HBARS", 6);
|
||||
define("CUSTOM_GRAPH_VBARS", 7);
|
||||
define("CUSTOM_GRAPH_PIE", 8);
|
||||
define("CUSTOM_GRAPH_BULLET_CHART_THRESHOLD", 9);
|
||||
|
||||
/* COLLECTIONS */
|
||||
define("COLLECTION_PENDING_APPLY", 0);
|
||||
|
|
|
@ -1083,7 +1083,8 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
|
||||
$graph_values = array();
|
||||
$module_name_list = array();
|
||||
|
||||
$collector = 0;
|
||||
|
||||
// Calculate data for each module
|
||||
for ($i = 0; $i < $module_number; $i++) {
|
||||
$automatic_custom_graph_meta = false;
|
||||
|
@ -1432,8 +1433,26 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
$stacked = CUSTOM_GRAPH_BULLET_CHART;
|
||||
|
||||
switch ($stacked) {
|
||||
case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD:
|
||||
case CUSTOM_GRAPH_BULLET_CHART:
|
||||
$datelimit = $date - $period;
|
||||
if($stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
|
||||
$acumulador = 0;
|
||||
foreach ($module_list as $module_item) {
|
||||
$module = $module_item;
|
||||
$query_last_value = sprintf('
|
||||
SELECT datos
|
||||
FROM tagente_datos
|
||||
WHERE id_agente_modulo = %d
|
||||
AND utimestamp < %d
|
||||
ORDER BY utimestamp DESC',
|
||||
$module, $date);
|
||||
$temp_data = db_get_value_sql($query_last_value);
|
||||
if ($acumulador < $temp_data){
|
||||
$acumulador = $temp_data;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($module_list as $module_item) {
|
||||
$automatic_custom_graph_meta = false;
|
||||
if ($config['metaconsole']) {
|
||||
|
@ -1486,7 +1505,12 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
$temp_max = reporting_get_agentmodule_data_max($module,$period,$date);
|
||||
if ($temp_max < 0)
|
||||
$temp_max = 0;
|
||||
$temp[$module]['max'] = ($temp_max === false) ? 0 : $temp_max;
|
||||
if (isset($acumulador)){
|
||||
$temp[$module]['max'] = $acumulador;
|
||||
}else{
|
||||
$temp[$module]['max'] = ($temp_max === false) ? 0 : $temp_max;
|
||||
}
|
||||
|
||||
$temp_min = reporting_get_agentmodule_data_min($module,$period,$date);
|
||||
if ($temp_min < 0)
|
||||
$temp_min = 0;
|
||||
|
@ -1788,6 +1812,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
"", "", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||
"", $ttl, $homeurl, $background_color,$dashboard, $vconsole);
|
||||
break;
|
||||
case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD:
|
||||
case CUSTOM_GRAPH_BULLET_CHART:
|
||||
return stacked_bullet_chart($flash_charts, $graph_values,
|
||||
$width, $height, $color, $module_name_list, $long_index,
|
||||
|
|
|
@ -94,10 +94,16 @@ if ($view_graph) {
|
|||
$events = $graph["events"];
|
||||
$description = $graph["description"];
|
||||
$stacked = (int) get_parameter ('stacked', -1);
|
||||
$check = get_parameter('threshold',false);
|
||||
|
||||
if($check == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
|
||||
$check = true;
|
||||
$stacked = CUSTOM_GRAPH_BULLET_CHART_THRESHOLD;
|
||||
}
|
||||
if ($stacked == -1)
|
||||
$stacked = $graph["stacked"];
|
||||
|
||||
if ($stacked == CUSTOM_GRAPH_BULLET_CHART )
|
||||
|
||||
if ($stacked == CUSTOM_GRAPH_BULLET_CHART || $stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD)
|
||||
$height = 50;
|
||||
|
||||
if ($stacked == CUSTOM_GRAPH_GAUGE ){
|
||||
|
@ -174,7 +180,9 @@ if ($view_graph) {
|
|||
else {
|
||||
ui_print_info_message ( array ( 'no_close' => true, 'message' => __('No data.') ) );
|
||||
}
|
||||
|
||||
if ($stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
|
||||
$stacked = 4;
|
||||
}
|
||||
$period_label = human_time_description_raw ($period);
|
||||
echo "<form method='POST' action='index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id=$id_graph'>";
|
||||
echo "<table class='databox filters' cellpadding='4' cellspacing='4' style='width: 100%'>";
|
||||
|
@ -214,7 +222,15 @@ if ($view_graph) {
|
|||
$stackeds[CUSTOM_GRAPH_PIE] = __('Pie');
|
||||
html_print_select ($stackeds, 'stacked', $stacked , '', '', -1, false, false);
|
||||
echo "</td>";
|
||||
|
||||
|
||||
echo "<td class='datos'>";
|
||||
echo "<div style='float:left' id='thresholdDiv' name='thresholdDiv'> <b>".__('Equalize maximum thresholds')."</b>" .
|
||||
ui_print_help_tip (__("If an option is selected, all graphs will have the highest value from all modules included in the graph as a maximum threshold"), true);
|
||||
|
||||
html_print_checkbox('threshold', CUSTOM_GRAPH_BULLET_CHART_THRESHOLD, $check, false, false, '', false);
|
||||
echo "</div>";
|
||||
echo "</td>";
|
||||
|
||||
echo "<td class='datos'>";
|
||||
$zooms = array();
|
||||
$zooms[0] = __('Graph defined');
|
||||
|
@ -260,6 +276,26 @@ if ($view_graph) {
|
|||
changeMonth: true,
|
||||
changeYear: true,
|
||||
showAnim: "slideDown"});
|
||||
|
||||
if ($("#stacked").val() == '4') {
|
||||
$("#thresholdDiv").show();
|
||||
}else{
|
||||
$("#thresholdDiv").hide();
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$("#stacked").change(function(){
|
||||
if ($(this).val() == '4') {
|
||||
console.log($(this).val());
|
||||
$("#thresholdDiv").show();
|
||||
$(".stacked").show();
|
||||
} else {
|
||||
$("[name=threshold]").prop("checked", false);
|
||||
$(".stacked").show();
|
||||
$("#thresholdDiv").hide();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue