Added events active filter view (open side)
This commit is contained in:
parent
3106b55fbd
commit
4ae8963e2e
|
@ -3747,4 +3747,26 @@ function ui_print_module_string_value($value, $id_agente_module,
|
||||||
|
|
||||||
return $salida;
|
return $salida;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a tag list
|
||||||
|
*/
|
||||||
|
function ui_print_tags_view($title = '', $tags = array()) {
|
||||||
|
$tv = '';
|
||||||
|
$tv .= '<div class="tag-wrapper">';
|
||||||
|
if ($title !== '') $tv .= '<h3>' . $title . '</h3>';
|
||||||
|
foreach ($tags as $tag) {
|
||||||
|
$tv .= '<div class=pandora-tag>';
|
||||||
|
$tv .= '<span class=pandora-tag-title>';
|
||||||
|
$tv .= $tag['title'];
|
||||||
|
$tv .= '</span>';
|
||||||
|
|
||||||
|
$tv .= '<span class=pandora-tag-value>';
|
||||||
|
$tv .= $tag['value'];
|
||||||
|
$tv .= '</span>';
|
||||||
|
$tv .= '</div>';
|
||||||
|
}
|
||||||
|
$tv .= '</div>';
|
||||||
|
echo $tv;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -3806,3 +3806,40 @@ color:#82b92e;font-family:Nunito;font-size:10pt;position:relative;top:6px;
|
||||||
.checkselected{
|
.checkselected{
|
||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
}
|
}
|
||||||
|
.tag-wrapper{
|
||||||
|
padding: 0 10px 0 0;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pandora-tag{
|
||||||
|
float:left;
|
||||||
|
margin-bottom:18px;
|
||||||
|
padding:1px 6px 1px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pandora-tag-title{
|
||||||
|
color: white;
|
||||||
|
background-color: #373737;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 6px 6px 6px 10px;
|
||||||
|
border: #373737;
|
||||||
|
border-width: 1px;
|
||||||
|
border-top-style: solid;
|
||||||
|
border-top-left-radius: 12px;
|
||||||
|
border-left-style: solid;
|
||||||
|
border-bottom-left-radius: 12px;
|
||||||
|
border-bottom-style: solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pandora-tag-value{
|
||||||
|
color: #373737;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 6px 10px 6px 6px;
|
||||||
|
border: #373737;
|
||||||
|
border-width: 1px;
|
||||||
|
border-top-style: solid;
|
||||||
|
border-top-right-radius: 12px;
|
||||||
|
border-right-style: solid;
|
||||||
|
border-bottom-right-radius: 12px;
|
||||||
|
border-bottom-style: solid;
|
||||||
|
}
|
|
@ -24,6 +24,7 @@ elseif (check_acl ($id_user, 0, "EM"))
|
||||||
$propagate = db_get_value('propagate','tgrupo','id_grupo',$id_group);
|
$propagate = db_get_value('propagate','tgrupo','id_grupo',$id_group);
|
||||||
|
|
||||||
if ($id_group > 0) {
|
if ($id_group > 0) {
|
||||||
|
$filter_resume['groups'] = $id_group;
|
||||||
if ($propagate) {
|
if ($propagate) {
|
||||||
$childrens_ids = array($id_group);
|
$childrens_ids = array($id_group);
|
||||||
|
|
||||||
|
@ -66,18 +67,22 @@ switch ($status) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
|
$filter_resume['status'] = $status;
|
||||||
$sql_post .= " AND estado = " . $status;
|
$sql_post .= " AND estado = " . $status;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
$filter_resume['status'] = $status;
|
||||||
$sql_post .= " AND (estado = 0 OR estado = 2)";
|
$sql_post .= " AND (estado = 0 OR estado = 2)";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($search != "") {
|
if ($search != "") {
|
||||||
|
$filter_resume['free_search'] = $search;
|
||||||
$sql_post .= " AND (evento LIKE '%". io_safe_input($search) . "%' OR id_evento LIKE '%$search%')";
|
$sql_post .= " AND (evento LIKE '%". io_safe_input($search) . "%' OR id_evento LIKE '%$search%')";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($event_type != "") {
|
if ($event_type != "") {
|
||||||
|
$filter_resume['event_type'] = $event_type;
|
||||||
// If normal, warning, could be several (going_up_warning, going_down_warning... too complex
|
// If normal, warning, could be several (going_up_warning, going_down_warning... too complex
|
||||||
// for the user so for him is presented only "warning, critical and normal"
|
// for the user so for him is presented only "warning, critical and normal"
|
||||||
if ($event_type == "warning" || $event_type == "critical" || $event_type == "normal") {
|
if ($event_type == "warning" || $event_type == "critical" || $event_type == "normal") {
|
||||||
|
@ -93,6 +98,7 @@ if ($event_type != "") {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($severity != -1) {
|
if ($severity != -1) {
|
||||||
|
$filter_resume['severity'] = $severity;
|
||||||
switch ($severity) {
|
switch ($severity) {
|
||||||
case EVENT_CRIT_WARNING_OR_CRITICAL:
|
case EVENT_CRIT_WARNING_OR_CRITICAL:
|
||||||
$sql_post .= "
|
$sql_post .= "
|
||||||
|
@ -115,6 +121,7 @@ if ($severity != -1) {
|
||||||
|
|
||||||
// In metaconsole mode the agent search is performed by name
|
// In metaconsole mode the agent search is performed by name
|
||||||
if ($meta) {
|
if ($meta) {
|
||||||
|
$filter_resume['agent'] = $text_agent;
|
||||||
if ($text_agent != __('All')) {
|
if ($text_agent != __('All')) {
|
||||||
$sql_post .= " AND agent_name LIKE '%$text_agent%'";
|
$sql_post .= " AND agent_name LIKE '%$text_agent%'";
|
||||||
}
|
}
|
||||||
|
@ -128,6 +135,7 @@ else {
|
||||||
$sql_post .= " AND 1 = 0";
|
$sql_post .= " AND 1 = 0";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
$filter_resume['agent'] = $id_agent;
|
||||||
$sql_post .= " AND id_agente = " . $id_agent;
|
$sql_post .= " AND id_agente = " . $id_agent;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -140,6 +148,7 @@ if ($meta) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!empty($text_module)) {
|
if (!empty($text_module)) {
|
||||||
|
$filter_resume['module'] = $text_module;
|
||||||
$sql_post .= " AND id_agentmodule IN (
|
$sql_post .= " AND id_agentmodule IN (
|
||||||
SELECT id_agente_modulo
|
SELECT id_agente_modulo
|
||||||
FROM tagente_modulo
|
FROM tagente_modulo
|
||||||
|
@ -148,8 +157,10 @@ else {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id_user_ack != "0")
|
if ($id_user_ack != "0") {
|
||||||
|
$filter_resume['user_ack'] = $id_user_ack;
|
||||||
$sql_post .= " AND id_usuario = '" . $id_user_ack . "'";
|
$sql_post .= " AND id_usuario = '" . $id_user_ack . "'";
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($date_from)) {
|
if (!isset($date_from)) {
|
||||||
$date_from = "";
|
$date_from = "";
|
||||||
|
@ -160,6 +171,7 @@ if (!isset($date_to)) {
|
||||||
|
|
||||||
if (($date_from == '') && ($date_to == '')) {
|
if (($date_from == '') && ($date_to == '')) {
|
||||||
if ($event_view_hr > 0) {
|
if ($event_view_hr > 0) {
|
||||||
|
$filter_resume['hours_max'] = $event_view_hr;
|
||||||
$unixtime = get_system_time () - ($event_view_hr * SECONDS_1HOUR);
|
$unixtime = get_system_time () - ($event_view_hr * SECONDS_1HOUR);
|
||||||
$sql_post .= " AND (utimestamp > " . $unixtime . ")";
|
$sql_post .= " AND (utimestamp > " . $unixtime . ")";
|
||||||
}
|
}
|
||||||
|
@ -167,18 +179,22 @@ if (($date_from == '') && ($date_to == '')) {
|
||||||
else {
|
else {
|
||||||
if ($date_from != '') {
|
if ($date_from != '') {
|
||||||
if($time_from != '') {
|
if($time_from != '') {
|
||||||
|
$filter_resume['time_from'] = $date_from . " " . $time_from;
|
||||||
$udate_from = strtotime($date_from . " " . $time_from);
|
$udate_from = strtotime($date_from . " " . $time_from);
|
||||||
$sql_post .= " AND (utimestamp >= " . $udate_from . ")";
|
$sql_post .= " AND (utimestamp >= " . $udate_from . ")";
|
||||||
} else {
|
} else {
|
||||||
|
$filter_resume['time_from'] = $date_from;
|
||||||
$udate_from = strtotime($date_from . " 00:00:00");
|
$udate_from = strtotime($date_from . " 00:00:00");
|
||||||
$sql_post .= " AND (utimestamp >= " . $udate_from . ")";
|
$sql_post .= " AND (utimestamp >= " . $udate_from . ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($date_to != '') {
|
if ($date_to != '') {
|
||||||
if($time_to != '') {
|
if($time_to != '') {
|
||||||
|
$filter_resume['time_to'] = $date_to . " " . $time_to;
|
||||||
$udate_to = strtotime($date_to . " " . $time_to);
|
$udate_to = strtotime($date_to . " " . $time_to);
|
||||||
$sql_post .= " AND (utimestamp <= " . $udate_to . ")";
|
$sql_post .= " AND (utimestamp <= " . $udate_to . ")";
|
||||||
} else {
|
} else {
|
||||||
|
$filter_resume['time_to'] = $date_to;
|
||||||
$udate_to = strtotime($date_to . " 23:59:59");
|
$udate_to = strtotime($date_to . " 23:59:59");
|
||||||
$sql_post .= " AND (utimestamp <= " . $udate_to . ")";
|
$sql_post .= " AND (utimestamp <= " . $udate_to . ")";
|
||||||
}
|
}
|
||||||
|
@ -189,6 +205,7 @@ else {
|
||||||
if (!empty($tag_with)) {
|
if (!empty($tag_with)) {
|
||||||
$sql_post .= ' AND ( ';
|
$sql_post .= ' AND ( ';
|
||||||
$first = true;
|
$first = true;
|
||||||
|
$filter_resume['tag_inc'] = $tag_with;
|
||||||
foreach ($tag_with as $id_tag) {
|
foreach ($tag_with as $id_tag) {
|
||||||
if ($first) $first = false;
|
if ($first) $first = false;
|
||||||
else $sql_post .= " AND ";
|
else $sql_post .= " AND ";
|
||||||
|
@ -205,6 +222,7 @@ if (!empty($tag_with)) {
|
||||||
if (!empty($tag_without)) {
|
if (!empty($tag_without)) {
|
||||||
$sql_post .= ' AND ( ';
|
$sql_post .= ' AND ( ';
|
||||||
$first = true;
|
$first = true;
|
||||||
|
$filter_resume['tag_no_inc'] = $tag_without;
|
||||||
foreach ($tag_without as $id_tag) {
|
foreach ($tag_without as $id_tag) {
|
||||||
if ($first) $first = false;
|
if ($first) $first = false;
|
||||||
else $sql_post .= " AND ";
|
else $sql_post .= " AND ";
|
||||||
|
@ -216,11 +234,15 @@ if (!empty($tag_without)) {
|
||||||
|
|
||||||
// Filter/Only alerts
|
// Filter/Only alerts
|
||||||
if (isset($filter_only_alert)) {
|
if (isset($filter_only_alert)) {
|
||||||
if ($filter_only_alert == 0)
|
if ($filter_only_alert == 0) {
|
||||||
|
$filter_resume['alerts'] = $filter_only_alert;
|
||||||
$sql_post .= " AND event_type NOT LIKE '%alert%'";
|
$sql_post .= " AND event_type NOT LIKE '%alert%'";
|
||||||
else if ($filter_only_alert == 1)
|
}
|
||||||
|
else if ($filter_only_alert == 1) {
|
||||||
|
$filter_resume['alerts'] = $filter_only_alert;
|
||||||
$sql_post .= " AND event_type LIKE '%alert%'";
|
$sql_post .= " AND event_type LIKE '%alert%'";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Tags ACLS
|
// Tags ACLS
|
||||||
if ($id_group > 0 && in_array ($id_group, array_keys ($groups))) {
|
if ($id_group > 0 && in_array ($id_group, array_keys ($groups))) {
|
||||||
|
@ -247,6 +269,7 @@ if (($tags_acls_condition != ERR_WRONG_PARAMETERS) && ($tags_acls_condition != E
|
||||||
if ($meta) {
|
if ($meta) {
|
||||||
|
|
||||||
if ($server_id) {
|
if ($server_id) {
|
||||||
|
$filter_resume['server'] = $server_id;
|
||||||
$sql_post .= " AND server_id = " . $server_id;
|
$sql_post .= " AND server_id = " . $server_id;
|
||||||
} else {
|
} else {
|
||||||
$enabled_nodes = db_get_all_rows_sql('
|
$enabled_nodes = db_get_all_rows_sql('
|
||||||
|
|
|
@ -25,6 +25,7 @@ require_once ($config['homedir'] . "/include/functions_users.php"); //Users func
|
||||||
require_once ($config['homedir'] . "/include/functions_groups.php");
|
require_once ($config['homedir'] . "/include/functions_groups.php");
|
||||||
require_once ($config["homedir"] . "/include/functions_graph.php");
|
require_once ($config["homedir"] . "/include/functions_graph.php");
|
||||||
require_once ($config["homedir"] . "/include/functions_tags.php");
|
require_once ($config["homedir"] . "/include/functions_tags.php");
|
||||||
|
enterprise_include_once('include/functions_events.php');
|
||||||
|
|
||||||
check_login ();
|
check_login ();
|
||||||
|
|
||||||
|
@ -163,6 +164,7 @@ $sql_post = "";
|
||||||
|
|
||||||
$id_user = $config['id_user'];
|
$id_user = $config['id_user'];
|
||||||
|
|
||||||
|
$filter_resume = array();
|
||||||
require('events.build_query.php');
|
require('events.build_query.php');
|
||||||
|
|
||||||
// Now $sql_post have all the where condition
|
// Now $sql_post have all the where condition
|
||||||
|
@ -459,7 +461,12 @@ $table_advanced->rowclass[] = '';
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = __("Alert events") . $jump;
|
$data[0] = __("Alert events") . $jump;
|
||||||
$data[0] .= html_print_select (array('-1' => __('All'), '0' => __('Filter alert events'), '1' => __('Only alert events')), "filter_only_alert", $filter_only_alert, '', '', '', true);
|
$alert_events_titles = array(
|
||||||
|
'-1' => __('All'),
|
||||||
|
'0' => __('Filter alert events'),
|
||||||
|
'1' => __('Only alert events')
|
||||||
|
);
|
||||||
|
$data[0] .= html_print_select ($alert_events_titles, "filter_only_alert", $filter_only_alert, '', '', '', true);
|
||||||
$data[1] = __('Block size for pagination') . $jump;
|
$data[1] = __('Block size for pagination') . $jump;
|
||||||
$lpagination[25] = 25;
|
$lpagination[25] = 25;
|
||||||
$lpagination[50] = 50;
|
$lpagination[50] = 50;
|
||||||
|
@ -561,7 +568,8 @@ $types["not_normal"] = __("Not normal");
|
||||||
$data[1] .= html_print_select ($types, 'event_type', $event_type, '', __('All'), '', true);
|
$data[1] .= html_print_select ($types, 'event_type', $event_type, '', __('All'), '', true);
|
||||||
|
|
||||||
$data[2] = __('Severity') . $jump;
|
$data[2] = __('Severity') . $jump;
|
||||||
$data[2] .= html_print_select (get_priorities (), "severity", $severity, '', __('All'), '-1', true, false, false);
|
$severities = get_priorities ();
|
||||||
|
$data[2] .= html_print_select ($severities, "severity", $severity, '', __('All'), '-1', true, false, false);
|
||||||
$table->data[] = $data;
|
$table->data[] = $data;
|
||||||
$table->rowclass[] = '';
|
$table->rowclass[] = '';
|
||||||
|
|
||||||
|
@ -641,7 +649,7 @@ $events_filter .= "</form>"; //This is the filter div
|
||||||
if (is_metaconsole())
|
if (is_metaconsole())
|
||||||
ui_toggle($events_filter, __("Show Options"));
|
ui_toggle($events_filter, __("Show Options"));
|
||||||
else
|
else
|
||||||
ui_toggle($events_filter, __('Event control filter'), '', !$open_filter);
|
ui_toggle($events_filter, __('Event control filter'));
|
||||||
|
|
||||||
// Error div for ajax messages
|
// Error div for ajax messages
|
||||||
echo "<div id='show_filter_error' style='display: none;'>";
|
echo "<div id='show_filter_error' style='display: none;'>";
|
||||||
|
@ -696,6 +704,7 @@ if ($group_rep == 0) {
|
||||||
$result = db_get_all_rows_sql ($sql);
|
$result = db_get_all_rows_sql ($sql);
|
||||||
}
|
}
|
||||||
elseif ($group_rep == 1) {
|
elseif ($group_rep == 1) {
|
||||||
|
$filter_resume['duplicate'] = $group_rep;
|
||||||
$result = events_get_events_grouped(
|
$result = events_get_events_grouped(
|
||||||
$sql_post,
|
$sql_post,
|
||||||
$offset,
|
$offset,
|
||||||
|
@ -707,6 +716,7 @@ elseif ($group_rep == 1) {
|
||||||
'DESC');
|
'DESC');
|
||||||
}
|
}
|
||||||
elseif ($group_rep == 2) {
|
elseif ($group_rep == 2) {
|
||||||
|
$filter_resume['duplicate'] = $group_rep;
|
||||||
$result = events_get_events_grouped_by_agent(
|
$result = events_get_events_grouped_by_agent(
|
||||||
$sql_post,
|
$sql_post,
|
||||||
$offset,
|
$offset,
|
||||||
|
@ -715,6 +725,19 @@ elseif ($group_rep == 2) {
|
||||||
$history);
|
$history);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Active filter tag view call (only enterprise version)
|
||||||
|
// It is required to pass some references to enterprise function
|
||||||
|
// to translate the active filters
|
||||||
|
enterprise_hook('print_event_tags_active_filters',
|
||||||
|
array( $filter_resume, array(
|
||||||
|
'status' => $fields,
|
||||||
|
'event_type' => $types,
|
||||||
|
'severity' => $severities,
|
||||||
|
'duplicate' => $repeated_sel,
|
||||||
|
'alerts' => $alert_events_titles)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (!empty($result)) {
|
if (!empty($result)) {
|
||||||
if ($group_rep == 0) {
|
if ($group_rep == 0) {
|
||||||
$sql = "SELECT COUNT(id_evento)
|
$sql = "SELECT COUNT(id_evento)
|
||||||
|
|
Loading…
Reference in New Issue