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 string homeurl
|
||||||
* @param bool return or echo the result
|
* @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 $config;
|
||||||
global $graphic_type;
|
global $graphic_type;
|
||||||
|
|
||||||
|
@ -3582,13 +3582,14 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
||||||
$data = array ();
|
$data = array ();
|
||||||
$legend = array();
|
$legend = array();
|
||||||
$full_legend = array();
|
$full_legend = array();
|
||||||
|
$full_legend_date = array();
|
||||||
|
|
||||||
$cont = 0;
|
$cont = 0;
|
||||||
for ($i = 0; $i < $interval; $i++) {
|
for ($i = 0; $i < $interval; $i++) {
|
||||||
$bottom = $datelimit + ($periodtime * $i);
|
$bottom = $datelimit + ($periodtime * $i);
|
||||||
if (! $graphic_type) {
|
if (! $graphic_type) {
|
||||||
if ($config['flash_charts']) {
|
if ($config['flash_charts']) {
|
||||||
$name = date('H:i', $bottom);
|
$name = date('H:i:s', $bottom);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$name = date('H\h', $bottom);
|
$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)
|
if ($cont == 0 or $cont % 2)
|
||||||
$legend[$cont] = $name;
|
$legend[$cont] = $name;
|
||||||
|
|
||||||
|
if ($from_agent_view) {
|
||||||
|
$full_date = date('Y/m/d', $bottom);
|
||||||
|
$full_legend_date[$cont] = $full_date;
|
||||||
|
}
|
||||||
|
|
||||||
$full_legend[$cont] = $name;
|
$full_legend[$cont] = $name;
|
||||||
|
|
||||||
$top = $datelimit + ($periodtime * ($i + 1));
|
$top = $datelimit + ($periodtime * ($i + 1));
|
||||||
|
@ -3630,12 +3636,12 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
||||||
}
|
}
|
||||||
$cont++;
|
$cont++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
|
$colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
|
||||||
|
|
||||||
// Draw slicebar graph
|
// Draw slicebar graph
|
||||||
if ($config['flash_charts']) {
|
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 {
|
else {
|
||||||
$out = slicesbar_graph($data, $period, $width, $height, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
|
$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);
|
values = values.split(separator2);
|
||||||
labels = labels.split(separator);
|
labels = labels.split(separator);
|
||||||
legend = legend.split(separator);
|
legend = legend.split(separator);
|
||||||
acumulate_data = acumulate_data.split(separator);
|
acumulate_data = acumulate_data.split(separator);
|
||||||
datacolor = datacolor.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 possible adapt_keys on classes
|
||||||
check_adaptions(graph_id);
|
check_adaptions(graph_id);
|
||||||
|
|
||||||
|
@ -692,15 +695,28 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
||||||
var to = legend[item.seriesIndex+1];
|
var to = legend[item.seriesIndex+1];
|
||||||
//current date
|
//current date
|
||||||
var dateObj = new 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){
|
if(!to){
|
||||||
to= '23:59';
|
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;
|
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;
|
global $config;
|
||||||
|
|
||||||
include_javascript_dependencies_flot_graph();
|
include_javascript_dependencies_flot_graph();
|
||||||
|
@ -943,6 +943,9 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
|
||||||
$labels = implode($separator,$labels);
|
$labels = implode($separator,$labels);
|
||||||
$datacolor = implode($separator,$datacolor);
|
$datacolor = implode($separator,$datacolor);
|
||||||
$legend = io_safe_output(implode($separator,$legend));
|
$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));
|
$acumulate_data = io_safe_output(implode($separator,$acumulate_data));
|
||||||
|
|
||||||
// Store data series in javascript format
|
// Store data series in javascript format
|
||||||
|
@ -966,7 +969,7 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
|
||||||
// Javascript code
|
// Javascript code
|
||||||
$return .= "<script type='text/javascript'>";
|
$return .= "<script type='text/javascript'>";
|
||||||
$return .= "//<![CDATA[\n";
|
$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 .= "\n//]]>";
|
||||||
$return .= "</script>";
|
$return .= "</script>";
|
||||||
|
|
||||||
|
|
|
@ -602,7 +602,7 @@ $data[0][0] .=
|
||||||
__('Events (24h)') .
|
__('Events (24h)') .
|
||||||
'</th></tr>' .
|
'</th></tr>' .
|
||||||
'<tr><td style="text-align:center;"><br />' .
|
'<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>' .
|
'<br /></td></tr>' .
|
||||||
'</table>';
|
'</table>';
|
||||||
|
|
||||||
|
|
|
@ -543,8 +543,6 @@ $table_advanced->rowclass[] = '';
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = __('Date from') . $jump;
|
$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[0] .= html_print_input_text ('date_from', $date_from, '', 15, 10, true);
|
||||||
|
|
||||||
$data[1] = __('Date to') . $jump;
|
$data[1] = __('Date to') . $jump;
|
||||||
|
|
Loading…
Reference in New Issue