mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
Merge branch 'ent-312-filtros-activos-en-vista-de-eventos' into 'develop'
Ent 312 filtros activos en vista de eventos See merge request !219
This commit is contained in:
commit
62bdfbf4f8
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 425 B |
BIN
pandora_console/images/search_agent.png
Normal file
BIN
pandora_console/images/search_agent.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 341 B |
BIN
pandora_console/images/search_module.png
Normal file
BIN
pandora_console/images/search_module.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 390 B |
@ -2162,7 +2162,7 @@ function html_print_autocomplete_modules($name = 'module',
|
||||
ob_start();
|
||||
|
||||
html_print_input_text_extended ($name, $default, 'text-' . $name, '', 30, 100, false, '',
|
||||
array('style' => 'background: url(images/input_module.png) no-repeat right;'));
|
||||
array('style' => 'background: url(images/search_module.png) no-repeat right;'));
|
||||
html_print_input_hidden($name . "_hidden", $id_agent_module);
|
||||
ui_print_help_tip(__('Type at least two characters to search the module.'), false);
|
||||
|
||||
|
@ -2760,7 +2760,7 @@ function ui_print_agent_autocomplete_input($parameters) {
|
||||
|
||||
|
||||
//Default value
|
||||
$icon_image = html_print_image('images/input_agent.png', true, false, true);
|
||||
$icon_image = html_print_image('images/search_agent.png', true, false, true);
|
||||
if (isset($parameters['icon_image'])) {
|
||||
$icon_image = $parameters['icon_image'];
|
||||
}
|
||||
@ -3747,4 +3747,26 @@ function ui_print_module_string_value($value, $id_agente_module,
|
||||
|
||||
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;
|
||||
}
|
||||
?>
|
||||
|
@ -3805,4 +3805,41 @@ color:#82b92e;font-family:Nunito;font-size:10pt;position:relative;top:6px;
|
||||
}
|
||||
.checkselected{
|
||||
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);
|
||||
|
||||
if ($id_group > 0) {
|
||||
$filter_resume['groups'] = $id_group;
|
||||
if ($propagate) {
|
||||
$childrens_ids = array($id_group);
|
||||
|
||||
@ -66,18 +67,22 @@ switch ($status) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
$filter_resume['status'] = $status;
|
||||
$sql_post .= " AND estado = " . $status;
|
||||
break;
|
||||
case 3:
|
||||
$filter_resume['status'] = $status;
|
||||
$sql_post .= " AND (estado = 0 OR estado = 2)";
|
||||
break;
|
||||
}
|
||||
|
||||
if ($search != "") {
|
||||
$filter_resume['free_search'] = $search;
|
||||
$sql_post .= " AND (evento LIKE '%". io_safe_input($search) . "%' OR id_evento LIKE '%$search%')";
|
||||
}
|
||||
|
||||
if ($event_type != "") {
|
||||
$filter_resume['event_type'] = $event_type;
|
||||
// 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"
|
||||
if ($event_type == "warning" || $event_type == "critical" || $event_type == "normal") {
|
||||
@ -93,6 +98,7 @@ if ($event_type != "") {
|
||||
}
|
||||
|
||||
if ($severity != -1) {
|
||||
$filter_resume['severity'] = $severity;
|
||||
switch ($severity) {
|
||||
case EVENT_CRIT_WARNING_OR_CRITICAL:
|
||||
$sql_post .= "
|
||||
@ -115,7 +121,8 @@ if ($severity != -1) {
|
||||
|
||||
// In metaconsole mode the agent search is performed by name
|
||||
if ($meta) {
|
||||
if ($text_agent != __('All')) {
|
||||
if (($text_agent != __('All')) && ($text_agent !== '')) {
|
||||
$filter_resume['agent'] = $text_agent;
|
||||
$sql_post .= " AND agent_name LIKE '%$text_agent%'";
|
||||
}
|
||||
}
|
||||
@ -128,6 +135,7 @@ else {
|
||||
$sql_post .= " AND 1 = 0";
|
||||
break;
|
||||
default:
|
||||
$filter_resume['agent'] = $id_agent;
|
||||
$sql_post .= " AND id_agente = " . $id_agent;
|
||||
break;
|
||||
}
|
||||
@ -140,6 +148,7 @@ if ($meta) {
|
||||
}
|
||||
else {
|
||||
if (!empty($text_module)) {
|
||||
$filter_resume['module'] = $text_module;
|
||||
$sql_post .= " AND id_agentmodule IN (
|
||||
SELECT id_agente_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 . "'";
|
||||
}
|
||||
|
||||
if (!isset($date_from)) {
|
||||
$date_from = "";
|
||||
@ -160,6 +171,7 @@ if (!isset($date_to)) {
|
||||
|
||||
if (($date_from == '') && ($date_to == '')) {
|
||||
if ($event_view_hr > 0) {
|
||||
$filter_resume['hours_max'] = $event_view_hr;
|
||||
$unixtime = get_system_time () - ($event_view_hr * SECONDS_1HOUR);
|
||||
$sql_post .= " AND (utimestamp > " . $unixtime . ")";
|
||||
}
|
||||
@ -167,18 +179,22 @@ if (($date_from == '') && ($date_to == '')) {
|
||||
else {
|
||||
if ($date_from != '') {
|
||||
if($time_from != '') {
|
||||
$filter_resume['time_from'] = $date_from . " " . $time_from;
|
||||
$udate_from = strtotime($date_from . " " . $time_from);
|
||||
$sql_post .= " AND (utimestamp >= " . $udate_from . ")";
|
||||
} else {
|
||||
$filter_resume['time_from'] = $date_from;
|
||||
$udate_from = strtotime($date_from . " 00:00:00");
|
||||
$sql_post .= " AND (utimestamp >= " . $udate_from . ")";
|
||||
}
|
||||
}
|
||||
if ($date_to != '') {
|
||||
if($time_to != '') {
|
||||
$filter_resume['time_to'] = $date_to . " " . $time_to;
|
||||
$udate_to = strtotime($date_to . " " . $time_to);
|
||||
$sql_post .= " AND (utimestamp <= " . $udate_to . ")";
|
||||
} else {
|
||||
$filter_resume['time_to'] = $date_to;
|
||||
$udate_to = strtotime($date_to . " 23:59:59");
|
||||
$sql_post .= " AND (utimestamp <= " . $udate_to . ")";
|
||||
}
|
||||
@ -189,6 +205,7 @@ else {
|
||||
if (!empty($tag_with)) {
|
||||
$sql_post .= ' AND ( ';
|
||||
$first = true;
|
||||
$filter_resume['tag_inc'] = $tag_with;
|
||||
foreach ($tag_with as $id_tag) {
|
||||
if ($first) $first = false;
|
||||
else $sql_post .= " AND ";
|
||||
@ -205,6 +222,7 @@ if (!empty($tag_with)) {
|
||||
if (!empty($tag_without)) {
|
||||
$sql_post .= ' AND ( ';
|
||||
$first = true;
|
||||
$filter_resume['tag_no_inc'] = $tag_without;
|
||||
foreach ($tag_without as $id_tag) {
|
||||
if ($first) $first = false;
|
||||
else $sql_post .= " AND ";
|
||||
@ -216,10 +234,14 @@ if (!empty($tag_without)) {
|
||||
|
||||
// Filter/Only alerts
|
||||
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%'";
|
||||
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%'";
|
||||
}
|
||||
}
|
||||
|
||||
// Tags ACLS
|
||||
@ -247,6 +269,7 @@ if (($tags_acls_condition != ERR_WRONG_PARAMETERS) && ($tags_acls_condition != E
|
||||
if ($meta) {
|
||||
|
||||
if ($server_id) {
|
||||
$filter_resume['server'] = $server_id;
|
||||
$sql_post .= " AND server_id = " . $server_id;
|
||||
} else {
|
||||
$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_graph.php");
|
||||
require_once ($config["homedir"] . "/include/functions_tags.php");
|
||||
enterprise_include_once('include/functions_events.php');
|
||||
|
||||
check_login ();
|
||||
|
||||
@ -163,6 +164,7 @@ $sql_post = "";
|
||||
|
||||
$id_user = $config['id_user'];
|
||||
|
||||
$filter_resume = array();
|
||||
require('events.build_query.php');
|
||||
|
||||
// Now $sql_post have all the where condition
|
||||
@ -459,7 +461,12 @@ $table_advanced->rowclass[] = '';
|
||||
|
||||
$data = array();
|
||||
$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;
|
||||
$lpagination[25] = 25;
|
||||
$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[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->rowclass[] = '';
|
||||
|
||||
@ -605,19 +613,6 @@ $data[0] .= '<a href="javascript:" onclick="show_load_filter_dialog();">' .
|
||||
html_print_image("images/load.png", true, array("border" => '0', "title" => __('Load filter'), "alt" => __('Load filter'))) . '</a> ';
|
||||
$data[0] .= '<a id="events_graph_link" href="javascript: show_events_graph_dialog()">' .
|
||||
html_print_image('images/chart_curve.png', true, array('title' => __('Show events graph'))) . '</a> <br />';
|
||||
|
||||
|
||||
if (empty($id_name)) {
|
||||
$data[0] .= '<div id="filter_loaded_span" style="font-weight: normal">[' .
|
||||
__('No filter loaded') .
|
||||
']</div>';
|
||||
}
|
||||
else {
|
||||
$data[0] .= '<div id="filter_loaded_span" style="font-weight: normal">[' .
|
||||
__('Filter loaded') . ': ' . $id_name .
|
||||
']</div>';
|
||||
}
|
||||
|
||||
$data[0] .= '</div>';
|
||||
|
||||
|
||||
@ -641,7 +636,7 @@ $events_filter .= "</form>"; //This is the filter div
|
||||
if (is_metaconsole())
|
||||
ui_toggle($events_filter, __("Show Options"));
|
||||
else
|
||||
ui_toggle($events_filter, __('Event control filter'), '', !$open_filter);
|
||||
ui_toggle($events_filter, __('Event control filter'));
|
||||
|
||||
// Error div for ajax messages
|
||||
echo "<div id='show_filter_error' style='display: none;'>";
|
||||
@ -696,6 +691,7 @@ if ($group_rep == 0) {
|
||||
$result = db_get_all_rows_sql ($sql);
|
||||
}
|
||||
elseif ($group_rep == 1) {
|
||||
$filter_resume['duplicate'] = $group_rep;
|
||||
$result = events_get_events_grouped(
|
||||
$sql_post,
|
||||
$offset,
|
||||
@ -707,6 +703,7 @@ elseif ($group_rep == 1) {
|
||||
'DESC');
|
||||
}
|
||||
elseif ($group_rep == 2) {
|
||||
$filter_resume['duplicate'] = $group_rep;
|
||||
$result = events_get_events_grouped_by_agent(
|
||||
$sql_post,
|
||||
$offset,
|
||||
@ -715,6 +712,23 @@ elseif ($group_rep == 2) {
|
||||
$history);
|
||||
}
|
||||
|
||||
$filter_resume['title'] = empty($id_name)
|
||||
? __('No filter loaded')
|
||||
: __('Filter loaded') . ': ' . $id_name;
|
||||
// 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,
|
||||
'groups' => users_get_groups_for_select($config["id_user"], $access, true, true, false))
|
||||
)
|
||||
);
|
||||
|
||||
if (!empty($result)) {
|
||||
if ($group_rep == 0) {
|
||||
$sql = "SELECT COUNT(id_evento)
|
||||
|
Loading…
x
Reference in New Issue
Block a user