Changed source filter in event list

This commit is contained in:
danielmaya 2018-10-10 16:57:04 +02:00
parent f952d5c70e
commit 4558c909ef
4 changed files with 8 additions and 34 deletions

View File

@ -399,9 +399,8 @@ if (!is_metaconsole()) {
$text_module, false, true, '', array(), true, $id_agent_module); $text_module, false, true, '', array(), true, $id_agent_module);
} }
$sources = events_get_all_source();
$table ->data[22][0] = '<b>' . __('Source') . '</b>'; $table ->data[22][0] = '<b>' . __('Source') . '</b>';
$table ->data[22][1] = html_print_select ($sources, 'source', $source, '', '', '', true); $table ->data[22][1] = html_print_input_text ('source', $source, '', 35, 255, true);
$table ->data[23][0] = '<b>' . __('Extra ID') . '</b>'; $table ->data[23][0] = '<b>' . __('Extra ID') . '</b>';
$table ->data[23][1] = html_print_input_text ('id_extra', $id_extra, '', 11, 255, true); $table ->data[23][1] = html_print_input_text ('id_extra', $id_extra, '', 11, 255, true);

View File

@ -1531,30 +1531,6 @@ function events_get_all_status ($report = false) {
return $fields; return $fields;
} }
/**
* Return all event source.
*
* @return array event source array.
*/
function events_get_all_source () {
$event_table = events_get_events_table(is_metaconsole(),false);
$fields = array ();
$fields[''] = __('All');
if (users_is_admin()) {
$sources = db_get_all_rows_sql("SELECT DISTINCT(source) FROM ". $event_table);
} else {
$groups_user = users_get_groups ($config['id_user'], "ER", true);
$sources = db_get_all_rows_sql("SELECT DISTINCT(source) FROM ". $event_table. " WHERE id_grupo IN (" .implode(",",array_keys($groups_user)) .")");
}
foreach ($sources as $key => $source) {
$fields[$source['source']] = $source['source'];
}
return $fields;
}
/** /**
* Decode a numeric status into status description. * Decode a numeric status into status description.
* *

View File

@ -158,7 +158,7 @@ if ($user_comment != '') {
} }
if ($source != '') { if ($source != '') {
$sql_post .= " AND source LIKE '$source'"; $sql_post .= " AND source LIKE '%$source%'";
} }
// In metaconsole mode the agent search is performed by name // In metaconsole mode the agent search is performed by name

View File

@ -666,9 +666,8 @@ $table->data[] = $data;
$table->rowclass[] = ''; $table->rowclass[] = '';
$data = array(); $data = array();
$sources = events_get_all_source();
$data[0] = __('Source') . $jump; $data[0] = __('Source') . $jump;
$data[0] .= html_print_select ($sources, 'source', $source, '', '', '', true); $data[0] .= html_print_input_text ('source', $source, '', 35, 255, true);
$data[1] = __('Extra ID') . $jump; $data[1] = __('Extra ID') . $jump;
$data[1] .= html_print_input_text ('id_extra', $id_extra, '', 11, 255, true); $data[1] .= html_print_input_text ('id_extra', $id_extra, '', 11, 255, true);
$data[2] = __("Comment") . $jump; $data[2] = __("Comment") . $jump;
@ -975,7 +974,7 @@ $(document).ready( function() {
if (i == 'id_group_filter') if (i == 'id_group_filter')
$("#id_group_filter").val(val); $("#id_group_filter").val(val);
if (i == 'source') if (i == 'source')
$("#source").val(val); $("#text-source").val(val);
if (i == 'id_extra') if (i == 'id_extra')
$("#text-id_extra").val(val); $("#text-id_extra").val(val);
if (i == 'user_comment') if (i == 'user_comment')
@ -1018,7 +1017,7 @@ $(document).ready( function() {
$("#pagination").val(20); $("#pagination").val(20);
$("#update_from_filter_table").val(1); $("#update_from_filter_table").val(1);
$("#text_id_agent").val(""); $("#text_id_agent").val("");
$("#source").val(''); $("#text-source").val('');
$("#text-id_extra").val(''); $("#text-id_extra").val('');
$("#text-user_comment").val(''); $("#text-user_comment").val('');
@ -1090,7 +1089,7 @@ $(document).ready( function() {
} }
} }
if (i == 'source') if (i == 'source')
$("#source").val(val); $("#text-source").val(val);
if (i == 'id_extra') if (i == 'id_extra')
$("#text-id_extra").val(val); $("#text-id_extra").val(val);
if (i == 'user_comment') if (i == 'user_comment')
@ -1161,7 +1160,7 @@ $(document).ready( function() {
"id_group_filter": $("#id_group_filter").val(), "id_group_filter": $("#id_group_filter").val(),
"date_from": $("#text-date_from").val(), "date_from": $("#text-date_from").val(),
"date_to": $("#text-date_to").val(), "date_to": $("#text-date_to").val(),
"source": $("#source").val(), "source": $("#text-source").val(),
"id_extra": $("#text-id_extra").val(), "id_extra": $("#text-id_extra").val(),
"user_comment": $("#text-user_comment").val() "user_comment": $("#text-user_comment").val()
}, },
@ -1261,7 +1260,7 @@ $(document).ready( function() {
"id_group_filter": $("#id_group_filter").val(), "id_group_filter": $("#id_group_filter").val(),
"date_from": $("#text-date_from").val(), "date_from": $("#text-date_from").val(),
"date_to": $("#text-date_to").val(), "date_to": $("#text-date_to").val(),
"source": $("#source").val(), "source": $("#text-source").val(),
"id_extra": $("#text-id_extra").val(), "id_extra": $("#text-id_extra").val(),
"user_comment": $("#text-user_comment").val() "user_comment": $("#text-user_comment").val()
}, },