Fixed events filter from agent events graph
This commit is contained in:
parent
200bcc3b49
commit
1b766f8ce2
|
@ -3565,7 +3565,7 @@ function graph_custom_sql_graph ($id, $width, $height,
|
|||
* @param string homeurl
|
||||
* @param bool return or echo the result
|
||||
*/
|
||||
function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false) {
|
||||
function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false, $from_agent_view = false) {
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
||||
|
@ -3582,13 +3582,14 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
|||
$data = array ();
|
||||
$legend = array();
|
||||
$full_legend = array();
|
||||
$full_legend_date = array();
|
||||
|
||||
$cont = 0;
|
||||
for ($i = 0; $i < $interval; $i++) {
|
||||
$bottom = $datelimit + ($periodtime * $i);
|
||||
if (! $graphic_type) {
|
||||
if ($config['flash_charts']) {
|
||||
$name = date('H:i', $bottom);
|
||||
$name = date('H:i:s', $bottom);
|
||||
}
|
||||
else {
|
||||
$name = date('H\h', $bottom);
|
||||
|
@ -3602,6 +3603,11 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
|||
if ($cont == 0 or $cont % 2)
|
||||
$legend[$cont] = $name;
|
||||
|
||||
if ($from_agent_view) {
|
||||
$full_date = date('Y/m/d', $bottom);
|
||||
$full_legend_date[$cont] = $full_date;
|
||||
}
|
||||
|
||||
$full_legend[$cont] = $name;
|
||||
|
||||
$top = $datelimit + ($periodtime * ($i + 1));
|
||||
|
@ -3630,12 +3636,12 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
|||
}
|
||||
$cont++;
|
||||
}
|
||||
|
||||
|
||||
$colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
|
||||
|
||||
// Draw slicebar graph
|
||||
if ($config['flash_charts']) {
|
||||
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent);
|
||||
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date);
|
||||
}
|
||||
else {
|
||||
$out = slicesbar_graph($data, $period, $width, $height, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
|
||||
|
|
|
@ -608,13 +608,16 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors,
|
|||
}
|
||||
}
|
||||
|
||||
function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumulate_data, intervaltick, water_mark, maxvalue, separator, separator2, graph_javascript, id_agent) {
|
||||
function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumulate_data, intervaltick, water_mark, maxvalue, separator, separator2, graph_javascript, id_agent, full_legend) {
|
||||
values = values.split(separator2);
|
||||
labels = labels.split(separator);
|
||||
legend = legend.split(separator);
|
||||
acumulate_data = acumulate_data.split(separator);
|
||||
datacolor = datacolor.split(separator);
|
||||
|
||||
if (full_legend != "") {
|
||||
full_legend = full_legend.split(separator);
|
||||
}
|
||||
console.log(full_legend);
|
||||
// Check possible adapt_keys on classes
|
||||
check_adaptions(graph_id);
|
||||
|
||||
|
@ -692,15 +695,28 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
|||
var to = legend[item.seriesIndex+1];
|
||||
//current date
|
||||
var dateObj = new Date();
|
||||
var month = dateObj.getUTCMonth() + 1; //months from 1-12
|
||||
var day = dateObj.getUTCDate();
|
||||
var year = dateObj.getUTCFullYear();
|
||||
newdate = year + "/" + month + "/" + day;
|
||||
|
||||
if (full_legend != "") {
|
||||
newdate = full_legend[item.seriesIndex];
|
||||
newdate2 = full_legend[item.seriesIndex+1];
|
||||
}
|
||||
else {
|
||||
var month = dateObj.getUTCMonth() + 1; //months from 1-12
|
||||
var day = dateObj.getUTCDate();
|
||||
var year = dateObj.getUTCFullYear();
|
||||
newdate = year + "/" + month + "/" + day;
|
||||
}
|
||||
|
||||
if(!to){
|
||||
to= '23:59';
|
||||
}
|
||||
window.location='index.php?sec=eventos&sec2=operation/events/events&id_agent='+id_agent+'&date_from='+newdate+'&time_from='+from+'&date_to='+newdate+'&time_to='+to+'&status=-1';
|
||||
|
||||
if (full_legend != "") {
|
||||
window.location='index.php?sec=eventos&sec2=operation/events/events&id_agent='+id_agent+'&date_from='+newdate+'&time_from='+from+'&date_to='+newdate2+'&time_to='+to+'&status=-1';
|
||||
}
|
||||
else {
|
||||
window.location='index.php?sec=eventos&sec2=operation/events/events&id_agent='+id_agent+'&date_from='+newdate+'&time_from='+from+'&date_to='+newdate+'&time_to='+to+'&status=-1';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -846,7 +846,7 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
|
|||
return $return;
|
||||
}
|
||||
|
||||
function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $colors, $fontpath, $round_corner, $homeurl, $watermark = '', $adapt_key = '', $stat_win = false, $id_agent = 0) {
|
||||
function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $colors, $fontpath, $round_corner, $homeurl, $watermark = '', $adapt_key = '', $stat_win = false, $id_agent = 0, $full_legend_date = array()) {
|
||||
global $config;
|
||||
|
||||
include_javascript_dependencies_flot_graph();
|
||||
|
@ -943,6 +943,9 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
|
|||
$labels = implode($separator,$labels);
|
||||
$datacolor = implode($separator,$datacolor);
|
||||
$legend = io_safe_output(implode($separator,$legend));
|
||||
if (!empty($full_legend_date)) {
|
||||
$full_legend_date = io_safe_output(implode($separator,$full_legend_date));
|
||||
}
|
||||
$acumulate_data = io_safe_output(implode($separator,$acumulate_data));
|
||||
|
||||
// Store data series in javascript format
|
||||
|
@ -966,7 +969,7 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
|
|||
// Javascript code
|
||||
$return .= "<script type='text/javascript'>";
|
||||
$return .= "//<![CDATA[\n";
|
||||
$return .= "pandoraFlotSlicebar('$graph_id', '$values', '$datacolor', '$labels', '$legend', '$acumulate_data', $intervaltick, false, $max, '$separator', '$separator2', '', $id_agent)";
|
||||
$return .= "pandoraFlotSlicebar('$graph_id', '$values', '$datacolor', '$labels', '$legend', '$acumulate_data', $intervaltick, false, $max, '$separator', '$separator2', '', $id_agent, '$full_legend_date')";
|
||||
$return .= "\n//]]>";
|
||||
$return .= "</script>";
|
||||
|
||||
|
|
|
@ -602,7 +602,7 @@ $data[0][0] .=
|
|||
__('Events (24h)') .
|
||||
'</th></tr>' .
|
||||
'<tr><td style="text-align:center;"><br />' .
|
||||
graph_graphic_agentevents ($id_agente, 450, 15, SECONDS_1DAY, '', true) .
|
||||
graph_graphic_agentevents ($id_agente, 450, 15, SECONDS_1DAY, '', true, true) .
|
||||
'<br /></td></tr>' .
|
||||
'</table>';
|
||||
|
||||
|
|
|
@ -543,8 +543,6 @@ $table_advanced->rowclass[] = '';
|
|||
$data = array();
|
||||
$data[0] = __('Date from') . $jump;
|
||||
|
||||
//~ $user_users = users_get_user_users($config['id_user'], "ER", users_can_manage_group_all());
|
||||
|
||||
$data[0] .= html_print_input_text ('date_from', $date_from, '', 15, 10, true);
|
||||
|
||||
$data[1] = __('Date to') . $jump;
|
||||
|
|
Loading…
Reference in New Issue