Fixed the limits of warnings/critical (the line) that freezed the legend. Ticket #1287

This commit is contained in:
mdtrooper 2014-10-01 11:18:03 +02:00
parent e708ceba12
commit 38d352ebe1
3 changed files with 57 additions and 32 deletions

View File

@ -708,10 +708,10 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
function grafico_modulo_sparse ($agent_module_id, $period, $show_events, function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$width, $height , $title = '', $unit_name = null, $width, $height , $title = '', $unit_name = null,
$show_alerts = false, $avg_only = 0, $pure = false, $show_alerts = false, $avg_only = 0, $pure = false, $date = 0,
$date = 0, $unit = '', $baseline = 0, $return_data = 0, $unit = '', $baseline = 0, $return_data = 0, $show_title = true,
$show_title = true, $only_image = false, $homeurl = '', $ttl = 1, $only_image = false, $homeurl = '', $ttl = 1, $projection = false,
$projection = false, $adapt_key = '', $compare = false, $show_unknown = false, $adapt_key = '', $compare = false, $show_unknown = false,
$menu = true, $backgroundColor = 'white') { $menu = true, $backgroundColor = 'white') {
global $config; global $config;
@ -735,7 +735,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$series_suffix_str = ''; $series_suffix_str = '';
if ($compare !== false) { if ($compare !== false) {
$series_suffix = '2'; $series_suffix = '2';
$series_suffix_str = ' ('.__('Previous').')'; $series_suffix_str = ' (' . __('Previous') . ')';
// Build the data of the previous period // Build the data of the previous period
grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
@ -761,7 +761,8 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$series_type_prev = $series_type; $series_type_prev = $series_type;
$color_prev = $color; $color_prev = $color;
foreach($color_prev as $k => $col) { foreach($color_prev as $k => $col) {
$color_prev[$k]['color'] = '#'.get_complementary_rgb($color_prev[$k]['color']); $color_prev[$k]['color'] = '#' .
get_complementary_rgb($color_prev[$k]['color']);
} }
break; break;
} }

View File

@ -764,6 +764,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
var legends = $('#legend_' + graph_id + ' .legendLabel'); var legends = $('#legend_' + graph_id + ' .legendLabel');
var updateLegendTimeout = null; var updateLegendTimeout = null;
var latestPosition = null; var latestPosition = null;
var currentPlot = null; var currentPlot = null;
@ -839,11 +840,17 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
// The graphs of points type and unknown graphs will dont be updated // The graphs of points type and unknown graphs will dont be updated
if (serie_types[i] != 'points' && series.label != $('#hidden-unknown_text').val()) { if (serie_types[i] != 'points' && series.label != $('#hidden-unknown_text').val()) {
legends.eq(i).text(label_aux.replace(/=.*/, '= ' + parseFloat(y).toFixed(2) +' '+unit));
$('#legend_' + graph_id + ' .legendLabel')
.eq(i).text(label_aux.replace(/=.*/,
'= ' + parseFloat(y).toFixed(2) + ' ' + unit));
} }
legends.eq(i).css('font-size',font_size+'pt'); $('#legend_' + graph_id + ' .legendLabel')
legends.eq(i).css('color','#000'); .eq(i).css('font-size',font_size+'pt');
$('#legend_' + graph_id + ' .legendLabel')
.eq(i).css('color','#000');
i++; i++;
} }
@ -936,7 +943,8 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
$('#timestamp_'+graph_id).hide(); $('#timestamp_'+graph_id).hide();
dataset = plot.getData(); dataset = plot.getData();
for (i = 0; i < dataset.length; ++i) { for (i = 0; i < dataset.length; ++i) {
legends.eq(i).text(legends.eq(i).text().replace(/=.*/, '')); $('#legend_' + graph_id + ' .legendLabel')
.eq(i).text(legends.eq(i).text().replace(/=.*/, ''));
} }
plot.clearCrosshair(); plot.clearCrosshair();
overview.clearCrosshair(); overview.clearCrosshair();
@ -972,14 +980,14 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
if (menu) { if (menu) {
var parent_height; var parent_height;
$('#menu_overview_'+graph_id).click(function() { $('#menu_overview_' + graph_id).click(function() {
if ( $('#overview_'+graph_id).css('visibility') == 'hidden' ) if ( $('#overview_' + graph_id).css('visibility') == 'hidden' )
$('#overview_'+graph_id).css('visibility','visible'); $('#overview_' + graph_id).css('visibility','visible');
else else
$('#overview_'+graph_id).css('visibility','hidden'); $('#overview_' + graph_id).css('visibility','hidden');
}); });
$('#menu_threshold_'+graph_id).click(function() { $('#menu_threshold_' + graph_id).click(function() {
datas = new Array(); datas = new Array();
if (thresholded) { if (thresholded) {
@ -999,12 +1007,12 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
//} //}
}); });
plot = $.plot($('#'+graph_id), datas, options); plot = $.plot($('#' + graph_id), datas, options);
plot.setSelection(currentRanges); plot.setSelection(currentRanges);
}); });
$('#menu_cancelzoom_'+graph_id).click(function() { $('#menu_cancelzoom_' + graph_id).click(function() {
// cancel the zooming // cancel the zooming
plot = $.plot($('#'+graph_id), data_base, plot = $.plot($('#'+graph_id), data_base,
$.extend(true, {}, options, { $.extend(true, {}, options, {
@ -1012,7 +1020,8 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
legend: { show: false } legend: { show: false }
})); }));
$('#menu_cancelzoom_'+graph_id).attr('src',homeurl+'/images/zoom_cross.disabled.png'); $('#menu_cancelzoom_' + graph_id)
.attr('src', homeurl + '/images/zoom_cross.disabled.png');
overview.clearSelection(); overview.clearSelection();
currentRanges = null; currentRanges = null;
}); });

View File

@ -33,7 +33,9 @@ if (! isset ($config['id_user']) && get_parameter("loginhash", 0)) {
$loginhash_data = get_parameter("loginhash_data", ""); $loginhash_data = get_parameter("loginhash_data", "");
$loginhash_user = get_parameter("loginhash_user", ""); $loginhash_user = get_parameter("loginhash_user", "");
if ($config["loginhash_pwd"] != "" && $loginhash_data == md5($loginhash_user.$config["loginhash_pwd"])) { if ($config["loginhash_pwd"] != ""
&& $loginhash_data == md5($loginhash_user.$config["loginhash_pwd"])) {
db_logon ($loginhash_user, $_SERVER['REMOTE_ADDR']); db_logon ($loginhash_user, $_SERVER['REMOTE_ADDR']);
$_SESSION['id_usuario'] = $loginhash_user; $_SESSION['id_usuario'] = $loginhash_user;
$config["id_user"] = $loginhash_user; $config["id_user"] = $loginhash_user;
@ -101,7 +103,8 @@ $label = base64_decode(get_parameter('label', ''));
// Get input parameters // Get input parameters
$label = get_parameter ("label",""); $label = get_parameter ("label","");
if (!isset($_GET["period"]) OR (!isset($_GET["id"]))) { if (!isset($_GET["period"]) OR (!isset($_GET["id"]))) {
ui_print_error_message(__('There was a problem locating the source of the graph')); ui_print_error_message(
__('There was a problem locating the source of the graph'));
exit; exit;
} }
@ -202,9 +205,9 @@ $label = base64_decode(get_parameter('label', ''));
} }
echo '</div>'; echo '</div>';
/////////////////////////// ////////////////////////////////////////////////////////////////
// SIDE MENU // SIDE MENU
/////////////////////////// ////////////////////////////////////////////////////////////////
$params = array(); $params = array();
// TOP TEXT // TOP TEXT
$params['top_text'] = "<div style='color: white; width: 100%; text-align: center; font-weight: bold; vertical-align: top;'>" . html_print_image('images/config_mc.png', true, array('width' => '16px')) . ' ' . __('Pandora FMS Graph configuration menu') . "</div>"; $params['top_text'] = "<div style='color: white; width: 100%; text-align: center; font-weight: bold; vertical-align: top;'>" . html_print_image('images/config_mc.png', true, array('width' => '16px')) . ' ' . __('Pandora FMS Graph configuration menu') . "</div>";
@ -240,17 +243,19 @@ $label = base64_decode(get_parameter('label', ''));
//$table->size[0] = '50%'; //$table->size[0] = '50%';
$table->styleTable = 'border-spacing: 4px;'; $table->styleTable = 'border-spacing: 4px;';
$table->class = 'alternate'; $table->class = 'alternate';
$data = array(); $data = array();
$data[0] = __('Refresh time'); $data[0] = __('Refresh time');
$data[1] = html_print_extended_select_for_time("refresh", $refresh, '', '', 0, 7, true); $data[1] = html_print_extended_select_for_time("refresh",
$refresh, '', '', 0, 7, true);
$table->data[] = $data; $table->data[] = $data;
$table->rowclass[] = ''; $table->rowclass[] = '';
if ($graph_type != "boolean" && $graph_type != "string") { if ($graph_type != "boolean" && $graph_type != "string") {
$data = array(); $data = array();
$data[0] = __('Avg. Only'); $data[0] = __('Avg. Only');
$data[1] = html_print_checkbox ("avg_only", 1, (bool) $avg_only, true, false, 'show_others()'); $data[1] = html_print_checkbox ("avg_only", 1,
(bool)$avg_only, true, false, 'show_others()');
$data[1] .= html_print_input_hidden('show_other', 0, true); $data[1] .= html_print_input_hidden('show_other', 0, true);
$table->data[] = $data; $table->data[] = $data;
$table->rowclass[] = ''; $table->rowclass[] = '';
@ -258,15 +263,19 @@ $label = base64_decode(get_parameter('label', ''));
$data = array(); $data = array();
$data[0] = __('Begin date'); $data[0] = __('Begin date');
$data[1] = html_print_input_text ("start_date", substr ($start_date, 0, 10),'', 15, 255, true); $data[1] = html_print_input_text ("start_date",
$data[1] .= html_print_image ("images/calendar_view_day.png", true, array ("onclick" => "scwShow(scwID('text-start_date'),this);", "style" => 'vertical-align: bottom;')); substr($start_date, 0, 10),'', 15, 255, true);
$data[1] .= html_print_image ("images/calendar_view_day.png",
true, array(
"onclick" => "scwShow(scwID('text-start_date'),this);",
"style" => 'vertical-align: bottom;'));
$table->data[] = $data; $table->data[] = $data;
$table->rowclass[] = ''; $table->rowclass[] = '';
$data = array(); $data = array();
$data[0] = __('Zoom factor'); $data[0] = __('Zoom factor');
$options = array (); $options = array ();
$options[$zoom] = 'x'.$zoom; $options[$zoom] = 'x' . $zoom;
$options[1] = 'x1'; $options[1] = 'x1';
$options[2] = 'x2'; $options[2] = 'x2';
$options[3] = 'x3'; $options[3] = 'x3';
@ -277,7 +286,8 @@ $label = base64_decode(get_parameter('label', ''));
$data = array(); $data = array();
$data[0] = __('Time range'); $data[0] = __('Time range');
$data[1] = html_print_extended_select_for_time('period', $period, '', '', 0, 7, true); $data[1] = html_print_extended_select_for_time('period',
$period, '', '', 0, 7, true);
$table->data[] = $data; $table->data[] = $data;
$table->rowclass[] = ''; $table->rowclass[] = '';
@ -345,12 +355,16 @@ $label = base64_decode(get_parameter('label', ''));
$table->class = 'databox'; $table->class = 'databox';
$data = array(); $data = array();
$data[0] = html_print_div(array('content' => $form_table, 'style' => 'overflow: auto; height: 220px'), true); $data[0] = html_print_div(array('content' => $form_table,
'style' => 'overflow: auto; height: 220px'), true);
$table->data[] = $data; $table->data[] = $data;
$table->rowclass[] = ''; $table->rowclass[] = '';
$data = array(); $data = array();
$data[0] = '<div style="width:100%; text-align:right;">' . html_print_submit_button (__('Reload'), "submit", false, 'class="sub upd"', true) . "</div>"; $data[0] = '<div style="width:100%; text-align:right;">' .
html_print_submit_button(__('Reload'), "submit", false,
'class="sub upd"', true) .
"</div>";
$table->data[] = $data; $table->data[] = $data;
$table->rowclass[] = ''; $table->rowclass[] = '';
@ -371,7 +385,8 @@ $label = base64_decode(get_parameter('label', ''));
html_print_side_layer($params); html_print_side_layer($params);
// Hidden div to forced title // Hidden div to forced title
html_print_div(array('id' => 'forced_title_layer', 'class' => 'forced_title_layer', 'hidden' => true)); html_print_div(array('id' => 'forced_title_layer',
'class' => 'forced_title_layer', 'hidden' => true));
?> ?>
</body> </body>