Merge branch 'ent-3630-7648-7712-campo-label-no-se-muestra-en-informes-de-graficas' into 'develop'
fixed label reports and more fixed See merge request artica/pandorafms!2413
This commit is contained in:
commit
f5586d7b70
|
@ -4865,7 +4865,6 @@ function chooseType() {
|
|||
switch (type) {
|
||||
case 'event_report_agent':
|
||||
case 'simple_graph':
|
||||
case 'agent_configuration':
|
||||
case 'event_report_module':
|
||||
case 'alert_report_agent':
|
||||
case 'alert_report_module':
|
||||
|
@ -4876,8 +4875,6 @@ function chooseType() {
|
|||
case 'min_value':
|
||||
case 'max_value':
|
||||
case 'avg_value':
|
||||
case 'projection_graph':
|
||||
case 'prediction_date':
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1914,6 +1914,11 @@ function reporting_event_report_module(
|
|||
$return['title'] = $content['name'];
|
||||
$return['subtitle'] = agents_get_alias($content['id_agent']).' - '.io_safe_output(modules_get_agentmodule_name($content['id_agent_module']));
|
||||
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
if ($return['label'] != '') {
|
||||
$return['label'] = reporting_label_macro($content, $return['label']);
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
@ -1921,7 +1926,6 @@ function reporting_event_report_module(
|
|||
$return['description'] = $content['description'];
|
||||
$return['show_extended_events'] = $content['show_extended_events'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
|
||||
$event_filter = $content['style'];
|
||||
$return['show_summary_group'] = $event_filter['show_summary_group'];
|
||||
|
@ -2741,6 +2745,17 @@ function reporting_group_report($report, $content)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create data report event agent.
|
||||
*
|
||||
* @param array $report Data report.
|
||||
* @param array $content Content report.
|
||||
* @param string $type Type report.
|
||||
* @param integer $force_width_chart Force width.
|
||||
* @param integer $force_height_chart Force height.
|
||||
*
|
||||
* @return array Data.
|
||||
*/
|
||||
function reporting_event_report_agent(
|
||||
$report,
|
||||
$content,
|
||||
|
@ -2761,26 +2776,26 @@ function reporting_event_report_agent(
|
|||
$history = true;
|
||||
}
|
||||
|
||||
$return['title'] = $content['name'];
|
||||
$return['subtitle'] = agents_get_alias($content['id_agent']);
|
||||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
$return['title'] = $content['name'];
|
||||
$return['subtitle'] = agents_get_alias($content['id_agent']);
|
||||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
|
||||
$return['show_summary_group'] = $content['style']['show_summary_group'];
|
||||
$return['show_extended_events'] = $content['show_extended_events'];
|
||||
|
||||
$style = $content['style'];
|
||||
|
||||
// filter
|
||||
$show_summary_group = $style['show_summary_group'];
|
||||
$filter_event_severity = json_decode($style['filter_event_severity'], true);
|
||||
$filter_event_type = json_decode($style['filter_event_type'], true);
|
||||
$filter_event_status = json_decode($style['filter_event_status'], true);
|
||||
// Filter.
|
||||
$show_summary_group = $style['show_summary_group'];
|
||||
$filter_event_severity = json_decode($style['filter_event_severity'], true);
|
||||
$filter_event_type = json_decode($style['filter_event_type'], true);
|
||||
$filter_event_status = json_decode($style['filter_event_status'], true);
|
||||
$filter_event_filter_search = $style['event_filter_search'];
|
||||
|
||||
// graph
|
||||
$event_graph_by_user_validator = $style['event_graph_by_user_validator'];
|
||||
$event_graph_by_criticity = $style['event_graph_by_criticity'];
|
||||
// Graph.
|
||||
$event_graph_by_user_validator = $style['event_graph_by_user_validator'];
|
||||
$event_graph_by_criticity = $style['event_graph_by_criticity'];
|
||||
$event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
|
||||
|
||||
$return['data'] = reporting_get_agents_detailed_event(
|
||||
|
@ -2825,6 +2840,12 @@ function reporting_event_report_agent(
|
|||
$metaconsole_dbtable = false;
|
||||
}
|
||||
|
||||
$label = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
if ($label != '') {
|
||||
$label = reporting_label_macro($content, $label);
|
||||
}
|
||||
$return['label'] = $label;
|
||||
|
||||
if ($event_graph_by_user_validator) {
|
||||
$data_graph = events_get_count_events_validated_by_user(
|
||||
['id_agent' => $content['id_agent']],
|
||||
|
@ -2908,7 +2929,7 @@ function reporting_event_report_agent(
|
|||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
// total_events
|
||||
// Total events.
|
||||
if ($return['data'] != '') {
|
||||
$return['total_events'] = count($return['data']);
|
||||
} else {
|
||||
|
@ -2941,7 +2962,11 @@ function reporting_historical_data($report, $content)
|
|||
$return['subtitle'] = $agent_name.' - '.$module_name;
|
||||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
if ($return['label'] != '') {
|
||||
$return['label'] = reporting_label_macro($content, $return['label']);
|
||||
}
|
||||
|
||||
$return['keys'] = [
|
||||
__('Date'),
|
||||
|
@ -3017,7 +3042,6 @@ function reporting_database_serialized($report, $content)
|
|||
$return['subtitle'] = $agent_name.' - '.$module_name;
|
||||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
|
||||
$keys = [];
|
||||
if (isset($content['header_definition']) && ($content['header_definition'] != '')) {
|
||||
|
@ -3043,6 +3067,11 @@ function reporting_database_serialized($report, $content)
|
|||
metaconsole_connect($server);
|
||||
}
|
||||
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
if ($return['label'] != '') {
|
||||
$return['label'] = reporting_label_macro($content, $return['label']);
|
||||
}
|
||||
|
||||
$datelimit = ($report['datetime'] - $content['period']);
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
|
@ -3589,7 +3618,12 @@ function reporting_alert_report_agent($report, $content)
|
|||
$return['subtitle'] = $agent_name;
|
||||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
if ($return['label'] != '') {
|
||||
$return['label'] = reporting_label_macro($content, $return['label']);
|
||||
}
|
||||
|
||||
$module_list = agents_get_modules($content['id_agent']);
|
||||
|
||||
$data = [];
|
||||
|
@ -3721,6 +3755,9 @@ function reporting_alert_report_module($report, $content)
|
|||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
if ($return['label'] != '') {
|
||||
$return['label'] = reporting_label_macro($content, $return['label']);
|
||||
}
|
||||
|
||||
$data_row = [];
|
||||
|
||||
|
@ -3923,7 +3960,6 @@ function reporting_monitor_report($report, $content)
|
|||
$return['subtitle'] = $agent_name.' - '.$module_name;
|
||||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
|
||||
if ($config['metaconsole']) {
|
||||
$id_meta = metaconsole_get_id_server($content['server_name']);
|
||||
|
@ -3932,6 +3968,11 @@ function reporting_monitor_report($report, $content)
|
|||
metaconsole_connect($server);
|
||||
}
|
||||
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
if ($return['label'] != '') {
|
||||
$return['label'] = reporting_label_macro($content, $return['label']);
|
||||
}
|
||||
|
||||
$module_name = io_safe_output(
|
||||
modules_get_agentmodule_name($content['id_agent_module'])
|
||||
);
|
||||
|
@ -7335,6 +7376,7 @@ function reporting_simple_graph(
|
|||
$report,
|
||||
$content
|
||||
);
|
||||
|
||||
$label = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
if ($label != '') {
|
||||
$label = reporting_label_macro($content, $label);
|
||||
|
@ -7346,7 +7388,7 @@ function reporting_simple_graph(
|
|||
|
||||
$return['chart'] = '';
|
||||
|
||||
// Get chart
|
||||
// Get chart.
|
||||
reporting_set_conf_charts($width, $height, $only_image, $type, $content, $ttl);
|
||||
|
||||
if (!empty($force_width_chart)) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* global $ */
|
||||
|
||||
function pandoraFlotPie(
|
||||
graph_id,
|
||||
values,
|
||||
|
@ -1074,7 +1076,6 @@ function pandoraFlotArea(
|
|||
.split(".")
|
||||
.shift();
|
||||
var width = params.width;
|
||||
var height = params.height;
|
||||
var vconsole = params.vconsole;
|
||||
var dashboard = params.dashboard;
|
||||
var menu = params.menu;
|
||||
|
@ -1088,9 +1089,8 @@ function pandoraFlotArea(
|
|||
var background_color = params.backgroundColor;
|
||||
var legend_color = params.legend_color;
|
||||
var update_legend = {};
|
||||
|
||||
//XXXXXX colocar
|
||||
var force_integer = 0;
|
||||
var title = params.title;
|
||||
|
||||
if (typeof type === "undefined" || type == "") {
|
||||
type = params.type_graph;
|
||||
|
@ -1105,8 +1105,6 @@ function pandoraFlotArea(
|
|||
var red_up = parseFloat(data_module_graph.c_max);
|
||||
var yellow_inverse = parseInt(data_module_graph.w_inv);
|
||||
var red_inverse = parseInt(data_module_graph.c_inv);
|
||||
|
||||
//XXXXX
|
||||
var markins_graph = true;
|
||||
|
||||
// If threshold and up are the same, that critical or warning is disabled
|
||||
|
@ -1934,11 +1932,12 @@ function pandoraFlotArea(
|
|||
}
|
||||
}
|
||||
|
||||
var stacked = null;
|
||||
var filled_s = 0.3;
|
||||
|
||||
switch (type) {
|
||||
case "line":
|
||||
case 2:
|
||||
stacked = null;
|
||||
filled_s = false;
|
||||
break;
|
||||
case 3:
|
||||
stacked = "stack";
|
||||
|
@ -1960,7 +1959,15 @@ function pandoraFlotArea(
|
|||
var data_base = new Array();
|
||||
var lineWidth = $("#hidden-line_width_graph").val() || 1;
|
||||
|
||||
i = 0;
|
||||
var i = 0;
|
||||
var fill_color = "green";
|
||||
var line_show = true;
|
||||
var points_show = false;
|
||||
var filled = false;
|
||||
var steps_chart = false;
|
||||
var radius = false;
|
||||
var fill_points = fill_color;
|
||||
|
||||
$.each(values, function(index, value) {
|
||||
if (typeof value.data !== "undefined") {
|
||||
if (index.search("alert") >= 0) {
|
||||
|
@ -1974,7 +1981,7 @@ function pandoraFlotArea(
|
|||
switch (series_type[index]) {
|
||||
case "area":
|
||||
line_show = true;
|
||||
points_show = false; // XXX - false
|
||||
points_show = false;
|
||||
filled = filled_s;
|
||||
steps_chart = false;
|
||||
radius = false;
|
||||
|
@ -1995,7 +2002,7 @@ function pandoraFlotArea(
|
|||
points_show = true;
|
||||
filled = false;
|
||||
steps_chart = false;
|
||||
radius = 1.5;
|
||||
radius = 3;
|
||||
fill_points = fill_color;
|
||||
break;
|
||||
case "unknown":
|
||||
|
@ -2033,7 +2040,7 @@ function pandoraFlotArea(
|
|||
},
|
||||
points: {
|
||||
show: points_show,
|
||||
radius: 3,
|
||||
radius: radius,
|
||||
fillColor: fill_points
|
||||
},
|
||||
legend: legend.index
|
||||
|
@ -2051,7 +2058,8 @@ function pandoraFlotArea(
|
|||
number_ticks = 5;
|
||||
}
|
||||
|
||||
var maxticks = date_array["period"] / 3600 / number_ticks;
|
||||
// masticks this variable is commented because the library defines the tick number by itself
|
||||
// var maxticks = date_array["period"] / 3600 / number_ticks;
|
||||
|
||||
var options = {
|
||||
series: {
|
||||
|
@ -2125,16 +2133,11 @@ function pandoraFlotArea(
|
|||
options.selection = false;
|
||||
}
|
||||
|
||||
var stack = 0,
|
||||
bars = true,
|
||||
lines = false,
|
||||
steps = false;
|
||||
|
||||
var plot = $.plot($("#" + graph_id), datas, options);
|
||||
|
||||
// Re-calculate the graph height with the legend height
|
||||
if (dashboard) {
|
||||
$acum = 0;
|
||||
var $acum = 0;
|
||||
if (dashboard) $acum = 35;
|
||||
var hDiff =
|
||||
$("#" + graph_id).height() - $("#legend_" + graph_id).height() - $acum;
|
||||
|
@ -2143,22 +2146,12 @@ function pandoraFlotArea(
|
|||
navigator.userAgent
|
||||
)
|
||||
) {
|
||||
// not defined.???
|
||||
} else {
|
||||
$("#" + graph_id).css("height", hDiff);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
//XXXREvisar esto
|
||||
if (vconsole) {
|
||||
var myCanvas = plot.getCanvas();
|
||||
plot.setupGrid(); // redraw plot to new size
|
||||
plot.draw();
|
||||
var image = myCanvas.toDataURL("image/png");
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
// Adjust the overview plot to the width and position of the main plot
|
||||
adjust_left_width_canvas(graph_id, "overview_" + graph_id);
|
||||
update_left_width_canvas(graph_id);
|
||||
|
@ -2251,7 +2244,7 @@ function pandoraFlotArea(
|
|||
return;
|
||||
}
|
||||
|
||||
dataInSelection = ranges.xaxis.to - ranges.xaxis.from;
|
||||
var dataInSelection = ranges.xaxis.to - ranges.xaxis.from;
|
||||
|
||||
var maxticks_zoom = dataInSelection / 3600000 / number_ticks;
|
||||
if (maxticks_zoom < 0.001) {
|
||||
|
@ -2261,8 +2254,9 @@ function pandoraFlotArea(
|
|||
}
|
||||
}
|
||||
|
||||
var y_recal = "";
|
||||
if (thresholded) {
|
||||
var y_recal = axis_thresholded(
|
||||
y_recal = axis_thresholded(
|
||||
threshold_data,
|
||||
plot.getAxes().yaxis.min,
|
||||
plot.getAxes().yaxis.max,
|
||||
|
@ -2271,11 +2265,11 @@ function pandoraFlotArea(
|
|||
red_up
|
||||
);
|
||||
} else {
|
||||
var y_recal = ranges.yaxis;
|
||||
y_recal = ranges.yaxis;
|
||||
}
|
||||
|
||||
if (thresholded) {
|
||||
data_base_treshold = add_threshold(
|
||||
var data_base_treshold = add_threshold(
|
||||
data_base,
|
||||
threshold_data,
|
||||
ranges.yaxis.from,
|
||||
|
@ -2400,7 +2394,6 @@ function pandoraFlotArea(
|
|||
var updateLegendTimeout = null;
|
||||
var latestPosition = null;
|
||||
var currentPlot = null;
|
||||
var currentRanges = null;
|
||||
|
||||
// Update legend with the data of the plot in the mouse position
|
||||
function updateLegend() {
|
||||
|
@ -2434,7 +2427,7 @@ function pandoraFlotArea(
|
|||
"Dec"
|
||||
];
|
||||
|
||||
date_format =
|
||||
var date_format =
|
||||
(d.getDate() < 10 ? "0" : "") +
|
||||
d.getDate() +
|
||||
" " +
|
||||
|
@ -2455,7 +2448,7 @@ function pandoraFlotArea(
|
|||
|
||||
var timesize = $("#timestamp_" + graph_id).width();
|
||||
|
||||
dataset = currentPlot.getData();
|
||||
var dataset = currentPlot.getData();
|
||||
|
||||
var timenewpos =
|
||||
dataset[0].xaxis.p2c(pos.x) +
|
||||
|
@ -2481,9 +2474,8 @@ function pandoraFlotArea(
|
|||
$("#timestamp_" + graph_id).css("left", timenewpos);
|
||||
}
|
||||
|
||||
var dataset = currentPlot.getData();
|
||||
var i = 0;
|
||||
for (k = 0; k < dataset.length; k++) {
|
||||
for (var k = 0; k < dataset.length; k++) {
|
||||
// k is the real series counter
|
||||
// i is the series counter without thresholds
|
||||
var series = dataset[k];
|
||||
|
@ -2492,7 +2484,7 @@ function pandoraFlotArea(
|
|||
}
|
||||
|
||||
// find the nearest points, x-wise
|
||||
for (j = 0; j < series.data.length; ++j) {
|
||||
for (var j = 0; j < series.data.length; ++j) {
|
||||
if (series.data[j][0] > pos.x) {
|
||||
break;
|
||||
}
|
||||
|
@ -2503,10 +2495,10 @@ function pandoraFlotArea(
|
|||
}
|
||||
}
|
||||
|
||||
y_array = format_unit_yaxes(y);
|
||||
var y_array = format_unit_yaxes(y);
|
||||
|
||||
y = y_array["y"];
|
||||
how_bigger = y_array["unit"];
|
||||
var how_bigger = y_array["unit"];
|
||||
|
||||
var data_legend = [];
|
||||
|
||||
|
@ -2516,8 +2508,9 @@ function pandoraFlotArea(
|
|||
series_type[dataset[k]["label"]] != "unknown" &&
|
||||
series_type[dataset[k]["label"]] != "percentil"
|
||||
) {
|
||||
var label_aux = "";
|
||||
if (Object.keys(update_legend).length == 0) {
|
||||
var label_aux = legend[series.label];
|
||||
label_aux = legend[series.label];
|
||||
|
||||
$("#legend_" + graph_id + " .legendLabel")
|
||||
.eq(i)
|
||||
|
@ -2532,6 +2525,16 @@ function pandoraFlotArea(
|
|||
unit
|
||||
);
|
||||
} else {
|
||||
var min_y_array;
|
||||
var min_y = 0;
|
||||
var min_bigger = "";
|
||||
var max_y_array;
|
||||
var max_y = 0;
|
||||
var max_bigger = "";
|
||||
var avg_y_array;
|
||||
var avg_y = 0;
|
||||
var avg_bigger = "";
|
||||
|
||||
$.each(update_legend, function(index, value) {
|
||||
if (!value[x]) {
|
||||
x = x + 1;
|
||||
|
@ -2581,7 +2584,7 @@ function pandoraFlotArea(
|
|||
avg_bigger;
|
||||
});
|
||||
|
||||
var label_aux =
|
||||
label_aux =
|
||||
legend[series.label].split(":")[0] + data_legend[series.label];
|
||||
$("#legend_" + graph_id + " .legendLabel")
|
||||
.eq(i)
|
||||
|
@ -2604,7 +2607,7 @@ function pandoraFlotArea(
|
|||
}
|
||||
|
||||
// Events
|
||||
$("#overview_" + graph_id).bind("plothover", function(event, pos, item) {
|
||||
$("#overview_" + graph_id).bind("plothover", function(event, pos) {
|
||||
plot.setCrosshair({ x: pos.x, y: pos.y });
|
||||
currentPlot = plot;
|
||||
latestPosition = pos;
|
||||
|
@ -2613,7 +2616,7 @@ function pandoraFlotArea(
|
|||
}
|
||||
});
|
||||
|
||||
$("#" + graph_id).bind("plothover", function(event, pos, item) {
|
||||
$("#" + graph_id).bind("plothover", function(event, pos) {
|
||||
overview.setCrosshair({ x: pos.x, y: pos.y });
|
||||
currentPlot = plot;
|
||||
latestPosition = pos;
|
||||
|
@ -2636,7 +2639,6 @@ function pandoraFlotArea(
|
|||
$("#extra_" + graph_id).css("width", "170px");
|
||||
$("#extra_" + graph_id).css("height", "60px");
|
||||
|
||||
var dataset = plot.getData();
|
||||
var extra_info = "<i>No info to show</i>";
|
||||
var extra_show = false;
|
||||
var extra_height = $("#extra_" + graph_id).height();
|
||||
|
@ -2657,8 +2659,6 @@ function pandoraFlotArea(
|
|||
coord_x = coord_x - extra_width;
|
||||
}
|
||||
|
||||
var coord_y = offset_graph.top + height_legend + extra_height;
|
||||
|
||||
$("#extra_" + graph_id).css("left", coord_x);
|
||||
$("#extra_" + graph_id).css("top", coord_y);
|
||||
|
||||
|
@ -2677,21 +2677,22 @@ function pandoraFlotArea(
|
|||
});
|
||||
});
|
||||
|
||||
var extra_color = "#ffffff";
|
||||
if (events_data.event_type.search("alert") >= 0) {
|
||||
$extra_color = "#FFA631";
|
||||
extra_color = "#FFA631";
|
||||
} else if (events_data.event_type.search("critical") >= 0) {
|
||||
$extra_color = "#FC4444";
|
||||
extra_color = "#FC4444";
|
||||
} else if (events_data.event_type.search("warning") >= 0) {
|
||||
$extra_color = "#FAD403";
|
||||
extra_color = "#FAD403";
|
||||
} else if (events_data.event_type.search("unknown") >= 0) {
|
||||
$extra_color = "#3BA0FF";
|
||||
extra_color = "#3BA0FF";
|
||||
} else if (events_data.event_type.search("normal") >= 0) {
|
||||
$extra_color = "#80BA27";
|
||||
extra_color = "#80BA27";
|
||||
} else {
|
||||
$extra_color = "#ffffff";
|
||||
extra_color = "#ffffff";
|
||||
}
|
||||
|
||||
$("#extra_" + graph_id).css("background-color", $extra_color);
|
||||
$("#extra_" + graph_id).css("background-color", extra_color);
|
||||
|
||||
extra_info = "<b>" + events_data.evento + ":";
|
||||
extra_info +=
|
||||
|
@ -2717,9 +2718,10 @@ function pandoraFlotArea(
|
|||
}
|
||||
|
||||
if (image_treshold) {
|
||||
var y_recal = plot.getAxes().yaxis.max;
|
||||
if (!thresholded) {
|
||||
// Recalculate the y axis
|
||||
var y_recal = axis_thresholded(
|
||||
y_recal = axis_thresholded(
|
||||
threshold_data,
|
||||
plot.getAxes().yaxis.min,
|
||||
plot.getAxes().yaxis.max,
|
||||
|
@ -2727,11 +2729,9 @@ function pandoraFlotArea(
|
|||
extremes,
|
||||
red_up
|
||||
);
|
||||
} else {
|
||||
var y_recal = plot.getAxes().yaxis.max;
|
||||
}
|
||||
|
||||
datas_treshold = add_threshold(
|
||||
var datas_treshold = add_threshold(
|
||||
data_base,
|
||||
threshold_data,
|
||||
plot.getAxes().yaxis.min,
|
||||
|
@ -2762,7 +2762,7 @@ function pandoraFlotArea(
|
|||
// Reset interactivity styles
|
||||
function resetInteractivity() {
|
||||
$("#timestamp_" + graph_id).hide();
|
||||
dataset = plot.getData();
|
||||
var dataset = plot.getData();
|
||||
for (i = 0; i < dataset.length; ++i) {
|
||||
var series = dataset[i];
|
||||
var label_aux = legend[series.label];
|
||||
|
@ -2784,15 +2784,14 @@ function pandoraFlotArea(
|
|||
overview.clearCrosshair();
|
||||
}
|
||||
|
||||
function yFormatter(v, axis) {
|
||||
function yFormatter(v) {
|
||||
var formatted = v;
|
||||
if (short_data) {
|
||||
var formatted = number_format(v, force_integer, "", short_data);
|
||||
formatted = number_format(v, force_integer, "", short_data);
|
||||
} else {
|
||||
// It is an integer
|
||||
if (v - Math.floor(v) == 0) {
|
||||
var formatted = number_format(v, force_integer, "", 2);
|
||||
} else {
|
||||
var formatted = v;
|
||||
formatted = number_format(v, force_integer, "", 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2801,7 +2800,7 @@ function pandoraFlotArea(
|
|||
return formatted;
|
||||
}
|
||||
|
||||
function lFormatter(v, item) {
|
||||
function lFormatter(v) {
|
||||
return '<span style="color:' + legend_color + '">' + legend[v] + "</span>";
|
||||
}
|
||||
|
||||
|
@ -2858,9 +2857,10 @@ function pandoraFlotArea(
|
|||
);
|
||||
thresholded = false;
|
||||
} else {
|
||||
var y_recal = plot.getAxes().yaxis.max;
|
||||
if (!thresholded) {
|
||||
// Recalculate the y axis
|
||||
var y_recal = axis_thresholded(
|
||||
y_recal = axis_thresholded(
|
||||
threshold_data,
|
||||
plot.getAxes().yaxis.min,
|
||||
plot.getAxes().yaxis.max,
|
||||
|
@ -2868,8 +2868,6 @@ function pandoraFlotArea(
|
|||
extremes,
|
||||
red_up
|
||||
);
|
||||
} else {
|
||||
var y_recal = plot.getAxes().yaxis.max;
|
||||
}
|
||||
|
||||
datas_treshold = add_threshold(
|
||||
|
@ -2917,7 +2915,6 @@ function pandoraFlotArea(
|
|||
homeurl + "images/zoom_cross.disabled.png"
|
||||
);
|
||||
overview.clearSelection();
|
||||
currentRanges = null;
|
||||
thresholded = false;
|
||||
max_draw = [];
|
||||
});
|
||||
|
@ -2932,7 +2929,6 @@ function pandoraFlotArea(
|
|||
|
||||
// Add bottom margin in the legend
|
||||
// Estimated height of 24 (works fine with this data in all browsers)
|
||||
menu_height = 24;
|
||||
$("#legend_" + graph_id).css("margin-bottom", "10px");
|
||||
parent_height = parseInt(
|
||||
$("#menu_" + graph_id)
|
||||
|
@ -2979,6 +2975,7 @@ function format_unit_yaxes(y) {
|
|||
}
|
||||
|
||||
function adjust_menu(graph_id, plot, parent_height, width, show_legend) {
|
||||
var left_ticks_width = 0;
|
||||
if (
|
||||
$("#" + graph_id + " .xAxis .tickLabel")
|
||||
.eq(0)
|
||||
|
@ -2988,14 +2985,11 @@ function adjust_menu(graph_id, plot, parent_height, width, show_legend) {
|
|||
.eq(0)
|
||||
.css("width")
|
||||
.split("px")[0];
|
||||
} else {
|
||||
left_ticks_width = 0;
|
||||
}
|
||||
|
||||
var parent_height_new = 0;
|
||||
|
||||
var legend_height = 0;
|
||||
if (show_legend) {
|
||||
var legend_height =
|
||||
legend_height =
|
||||
parseInt(
|
||||
$("#legend_" + graph_id)
|
||||
.css("height")
|
||||
|
@ -3006,12 +3000,9 @@ function adjust_menu(graph_id, plot, parent_height, width, show_legend) {
|
|||
.css("margin-top")
|
||||
.split("px")[0]
|
||||
);
|
||||
} else {
|
||||
var legend_height = 0;
|
||||
}
|
||||
|
||||
var menu_height = "25";
|
||||
|
||||
if (
|
||||
$("#menu_" + graph_id).height() != undefined &&
|
||||
$("#menu_" + graph_id).height() > 20
|
||||
|
@ -3019,7 +3010,7 @@ function adjust_menu(graph_id, plot, parent_height, width, show_legend) {
|
|||
menu_height = $("#menu_" + graph_id).height();
|
||||
}
|
||||
|
||||
offset = $("#" + graph_id)[0].offsetTop;
|
||||
var offset = $("#" + graph_id)[0].offsetTop;
|
||||
|
||||
$("#menu_" + graph_id).css("top", offset + "px");
|
||||
|
||||
|
|
|
@ -82,9 +82,22 @@ function include_javascript_dependencies_flot_graph($return=false)
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
// AREA GRAPHS ////////
|
||||
//
|
||||
/**
|
||||
* Function create container for print charts.
|
||||
*
|
||||
* @param integer $agent_module_id Id module.
|
||||
* @param array $array_data Data.
|
||||
* @param array $legend Legend.
|
||||
* @param array $series_type Series.
|
||||
* @param array $color Color.
|
||||
* @param array $date_array Date.
|
||||
* @param array $data_module_graph Data module.
|
||||
* @param array $params Params.
|
||||
* @param string $water_mark Water.
|
||||
* @param array $array_events_alerts Events array.
|
||||
*
|
||||
* @return string Return graphs.
|
||||
*/
|
||||
function flot_area_graph(
|
||||
$agent_module_id,
|
||||
$array_data,
|
||||
|
@ -99,8 +112,7 @@ function flot_area_graph(
|
|||
) {
|
||||
global $config;
|
||||
|
||||
// include_javascript_dependencies_flot_graph();
|
||||
// Get a unique identifier to graph
|
||||
// Get a unique identifier to graph.
|
||||
$graph_id = uniqid('graph_');
|
||||
|
||||
$background_style = '';
|
||||
|
@ -126,19 +138,26 @@ function flot_area_graph(
|
|||
break;
|
||||
}
|
||||
|
||||
$padding_vconsole = $params['dashboard'] ? 'padding: 1px 0px 10px 10px;' : '';
|
||||
$padding_vconsole = ($params['dashboard']) ? 'padding: 1px 0px 10px 10px;' : '';
|
||||
|
||||
// Parent layer
|
||||
// Parent layer.
|
||||
$return = "<div class='parent_graph' style='width: ".($params['width']).';'.$background_style.$padding_vconsole."'>";
|
||||
|
||||
if (empty($params['title']) === false) {
|
||||
$return .= '<p style="text-align:center;">'.$params['title'].'</p>';
|
||||
}
|
||||
|
||||
// Set some containers to legend, graph, timestamp tooltip, etc.
|
||||
if ($params['show_legend']) {
|
||||
$return .= "<p id='legend_$graph_id' style='text-align:left;'></p>";
|
||||
$return .= '<p id="legend_'.$graph_id.'" style="text-align:left;"></p>';
|
||||
}
|
||||
|
||||
if (isset($params['graph_combined']) && $params['graph_combined']
|
||||
&& (!isset($params['from_interface']) || !$params['from_interface'])
|
||||
) {
|
||||
if (isset($params['threshold_data']) && is_array($params['threshold_data'])) {
|
||||
if (isset($params['threshold_data'])
|
||||
&& is_array($params['threshold_data'])
|
||||
) {
|
||||
$yellow_threshold = $params['threshold_data']['yellow_threshold'];
|
||||
$red_threshold = $params['threshold_data']['red_threshold'];
|
||||
$yellow_up = $params['threshold_data']['yellow_up'];
|
||||
|
@ -154,7 +173,7 @@ function flot_area_graph(
|
|||
} else if (!isset($params['combined']) || !$params['combined']) {
|
||||
$yellow_threshold = $data_module_graph['w_min'];
|
||||
$red_threshold = $data_module_graph['c_min'];
|
||||
// Get other required module datas to draw warning and critical
|
||||
// Get other required module datas to draw warning and critical.
|
||||
if ($agent_module_id == 0) {
|
||||
$yellow_up = 0;
|
||||
$red_up = 0;
|
||||
|
@ -166,8 +185,12 @@ function flot_area_graph(
|
|||
$yellow_inverse = !($data_module_graph['w_inv'] == 0);
|
||||
$red_inverse = !($data_module_graph['c_inv'] == 0);
|
||||
}
|
||||
} else if (isset($params['from_interface']) && $params['from_interface']) {
|
||||
if (isset($params['threshold_data']) && is_array($params['threshold_data'])) {
|
||||
} else if (isset($params['from_interface'])
|
||||
&& $params['from_interface']
|
||||
) {
|
||||
if (isset($params['threshold_data'])
|
||||
&& is_array($params['threshold_data'])
|
||||
) {
|
||||
$yellow_threshold = $params['threshold_data']['yellow_threshold'];
|
||||
$red_threshold = $params['threshold_data']['red_threshold'];
|
||||
$yellow_up = $params['threshold_data']['yellow_up'];
|
||||
|
@ -200,7 +223,11 @@ function flot_area_graph(
|
|||
);
|
||||
}
|
||||
|
||||
$return .= html_print_input_hidden('line_width_graph', $config['custom_graph_width'], true);
|
||||
$return .= html_print_input_hidden(
|
||||
'line_width_graph',
|
||||
$config['custom_graph_width'],
|
||||
true
|
||||
);
|
||||
$return .= "<div id='timestamp_$graph_id'
|
||||
class='timestamp_graph'
|
||||
style=' font-size:".$params['font_size']."pt;
|
||||
|
@ -239,20 +266,21 @@ function flot_area_graph(
|
|||
$series_type_unique['data_'.$graph_id.'_'.$k] = $v;
|
||||
}
|
||||
|
||||
// Store data series in javascript format
|
||||
// Store data series in javascript format.
|
||||
$extra_width = (int) ($params['width'] / 3);
|
||||
$return .= "<div id='extra_$graph_id'
|
||||
style='font-size: ".$params['font_size'].'pt;
|
||||
display:none; position:absolute; overflow: auto;
|
||||
max-height: '.($params['height'] + 50).'px;
|
||||
width: '.$extra_width."px;
|
||||
background:#fff; padding: 2px 2px 2px 2px;
|
||||
border: solid #000 1px;'></div>";
|
||||
style='font-size: ".$params['font_size'].'pt;
|
||||
display:none; position:absolute; overflow: auto;
|
||||
max-height: '.($params['height'] + 50).'px;
|
||||
width: '.$extra_width."px;
|
||||
background:#fff; padding: 2px 2px 2px 2px;
|
||||
border: solid #000 1px;'></div>";
|
||||
|
||||
// Trick to get translated string from javascript
|
||||
// Trick to get translated string from javascript.
|
||||
$return .= html_print_input_hidden('unknown_text', __('Unknown'), true);
|
||||
|
||||
$values = json_encode($array_data);
|
||||
$values = json_encode($array_data);
|
||||
|
||||
$legend = json_encode($legend);
|
||||
$series_type = json_encode($series_type);
|
||||
$color = json_encode($color);
|
||||
|
@ -261,7 +289,7 @@ function flot_area_graph(
|
|||
$params = json_encode($params);
|
||||
$array_events_alerts = json_encode($array_events_alerts);
|
||||
|
||||
// Javascript code
|
||||
// Javascript code.
|
||||
if ($font_size == '') {
|
||||
$font_size = '\'\'';
|
||||
}
|
||||
|
@ -272,7 +300,7 @@ function flot_area_graph(
|
|||
$return .= '});';
|
||||
$return .= '</script>';
|
||||
|
||||
// Parent layer
|
||||
// Parent layer.
|
||||
$return .= '</div>';
|
||||
|
||||
return $return;
|
||||
|
|
Loading…
Reference in New Issue