Fixed problems with save event filters and dont save agent and module. Tiquet: #2794

This commit is contained in:
m-lopez-f 2015-09-30 09:26:19 +02:00
parent 9fd7e8d3f1
commit 7d6f03c3c8
10 changed files with 80 additions and 14 deletions

View File

@ -163,3 +163,9 @@ DROP TABLE `tgis_map_has_tgis_map_connection`;
ALTER TABLE `tmodule_relationship` ALTER TABLE `tmodule_relationship`
--ADD COLUMN `id_rt` int(10) unsigned NOT NULL DEFAULT 0, --ADD COLUMN `id_rt` int(10) unsigned NOT NULL DEFAULT 0,
ADD FOREIGN KEY (`id_rt`) REFERENCES trecon_task(`id_rt`) ON DELETE CASCADE; ADD FOREIGN KEY (`id_rt`) REFERENCES trecon_task(`id_rt`) ON DELETE CASCADE;
-- ---------------------------------------------------------------------
-- Table `tevent_filter`
-- ---------------------------------------------------------------------
ALTER TABLE tevent_filter ADD COLUMN `id_agent_module` int(25) DEFAULT 0;
ALTER TABLE tevent_filter ADD COLUMN `id_agent` int(25) DEFAULT 0;

View File

@ -117,4 +117,10 @@ WHERE id_recon_script = 2 AND name = 'IPMI Recon';
UPDATE tnetwork_component SET snmp_oid ='SELECT DNSHostName FROM Win32_ComputerSystem' WHERE id_nc = 204 AND name = 'Hostname'; UPDATE tnetwork_component SET snmp_oid ='SELECT DNSHostName FROM Win32_ComputerSystem' WHERE id_nc = 204 AND name = 'Hostname';
UPDATE `tnetwork_component` set `tcp_port`=0 WHERE id_nc=207; UPDATE `tnetwork_component` set `tcp_port`=0 WHERE id_nc=207;
UPDATE `tnetwork_component` set `tcp_port`=0 WHERE id_nc=219; UPDATE `tnetwork_component` set `tcp_port`=0 WHERE id_nc=219;
-- ---------------------------------------------------------------------
-- Table `tevent_filter`
-- ---------------------------------------------------------------------
ALTER TABLE tevent_filter ADD COLUMN id_agent_module int(25) DEFAULT 0;
ALTER TABLE tevent_filter ADD COLUMN id_agent int(25) DEFAULT 0;

View File

@ -114,4 +114,10 @@ WHERE "id_recon_script" = 2 AND "name" = 'IPMI Recon';
UPDATE tnetwork_component SET snmp_oid ='SELECT DNSHostName FROM Win32_ComputerSystem' WHERE id_nc = 204 AND name = 'Hostname'; UPDATE tnetwork_component SET snmp_oid ='SELECT DNSHostName FROM Win32_ComputerSystem' WHERE id_nc = 204 AND name = 'Hostname';
UPDATE `tnetwork_component` set `tcp_port`=0 WHERE id_nc=207; UPDATE `tnetwork_component` set `tcp_port`=0 WHERE id_nc=207;
UPDATE `tnetwork_component` set `tcp_port`=0 WHERE id_nc=219; UPDATE `tnetwork_component` set `tcp_port`=0 WHERE id_nc=219;
-- ---------------------------------------------------------------------
-- Table `tnetwork_component`
-- ---------------------------------------------------------------------
ALTER TABLE tevent_filter ADD COLUMN id_agent_module int(25) DEFAULT 0;
ALTER TABLE tevent_filter ADD COLUMN id_agent int(25) DEFAULT 0;

View File

@ -52,6 +52,8 @@ if ($id) {
$status = $filter['status']; $status = $filter['status'];
$search = $filter['search']; $search = $filter['search'];
$text_agent = $filter['text_agent']; $text_agent = $filter['text_agent'];
$id_agent = $filter['id_agent'];
$id_agent_module = $filter['id_agent_module'];
$pagination = $filter['pagination']; $pagination = $filter['pagination'];
$event_view_hr = $filter['event_view_hr']; $event_view_hr = $filter['event_view_hr'];
$id_user_ack = $filter['id_user_ack']; $id_user_ack = $filter['id_user_ack'];
@ -66,6 +68,19 @@ if ($id) {
$tag_without_base64 = base64_encode($tag_without_json_clean) ; $tag_without_base64 = base64_encode($tag_without_json_clean) ;
$filter_only_alert = $filter['filter_only_alert']; $filter_only_alert = $filter['filter_only_alert'];
if ($id_agent_module != 0) {
$text_module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_agent_module);
if ($text_module == false) {
$text_module = '';
}
}
if ($id_agent != 0) {
$text_agent = db_get_value('nombre', 'tagente', 'id_agente', $id_agent);
if ($text_agent == false) {
$text_agent = '';
}
}
} }
else { else {
$id_group = ''; $id_group = '';
@ -96,6 +111,8 @@ if($update || $create) {
$status = get_parameter('status', ''); $status = get_parameter('status', '');
$search = get_parameter('search', ''); $search = get_parameter('search', '');
$text_agent = get_parameter('text_agent', ''); $text_agent = get_parameter('text_agent', '');
$id_agent_module = get_parameter('module_search_hidden', '');
$id_agent = get_parameter('id_agent', '');
$pagination = get_parameter('pagination', ''); $pagination = get_parameter('pagination', '');
$event_view_hr = get_parameter('event_view_hr', ''); $event_view_hr = get_parameter('event_view_hr', '');
$id_user_ack = get_parameter('id_user_ack', ''); $id_user_ack = get_parameter('id_user_ack', '');
@ -118,6 +135,8 @@ if($update || $create) {
'status' => $status, 'status' => $status,
'search' => $search, 'search' => $search,
'text_agent' => $text_agent, 'text_agent' => $text_agent,
'id_agent_module' => $id_agent_module,
'id_agent' => $id_agent,
'pagination' => $pagination, 'pagination' => $pagination,
'event_view_hr' => $event_view_hr, 'event_view_hr' => $event_view_hr,
'id_user_ack' => $id_user_ack, 'id_user_ack' => $id_user_ack,
@ -220,17 +239,19 @@ $table->data[6][1] = html_print_input_text(
$table->data[7][0] = '<b>' . __('Agent search') . '</b>'; $table->data[7][0] = '<b>' . __('Agent search') . '</b>';
$params = array(); $params = array();
$params['return'] = true;
$params['show_helptip'] = true; $params['show_helptip'] = true;
$params['input_name'] = 'text_agent'; $params['input_name'] = 'text_agent';
$params['value'] = $text_agent; $params['value'] = $text_agent;
$params['selectbox_group'] = 'id_group'; $params['return'] = true;
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
$params['javascript_page'] = 'enterprise/meta/include/ajax/events.ajax'; $params['javascript_page'] = 'enterprise/meta/include/ajax/events.ajax';
} }
else {
ui_print_agent_autocomplete_input($params); $params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent';
$params['hidden_input_idagent_value'] = $id_agent;
}
$table->data[7][1] = ui_print_agent_autocomplete_input($params); $table->data[7][1] = ui_print_agent_autocomplete_input($params);
@ -345,6 +366,13 @@ $table->data[19][1] = html_print_select(
'1' => __('Only alert events')), '1' => __('Only alert events')),
"filter_only_alert", $filter_only_alert, '', '', '', true); "filter_only_alert", $filter_only_alert, '', '', '', true);
if (!$meta) {
echo $id_agent_module;
$table->data[20][0] = '<b>' . __('Module search') . '</b>';
$table->data[20][1] .= html_print_autocomplete_modules('module_search',
$text_module, false, $id_agent_module, true, '', array(), true);
}
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=edit_filter&pure='.$config['pure'].'">'; echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=edit_filter&pure='.$config['pure'].'">';
html_print_table ($table); html_print_table ($table);

View File

@ -2046,7 +2046,7 @@ function html_html2rgb($htmlcolor)
* @return mixed If the $return is true, return the output as string. * @return mixed If the $return is true, return the output as string.
*/ */
function html_print_autocomplete_modules($name = 'module', function html_print_autocomplete_modules($name = 'module',
$default = '', $id_agents = false, $ACL = true, $scriptResult = '', $default = '', $id_agents = false, $id_agent_module = 0, $ACL = true, $scriptResult = '',
$filter = array(), $return = false) { $filter = array(), $return = false) {
global $config; global $config;
@ -2103,7 +2103,7 @@ function html_print_autocomplete_modules($name = 'module',
html_print_input_text_extended ($name, $default, 'text-' . $name, '', 30, 100, false, '', 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/input_module.png) no-repeat right;'));
html_print_input_hidden($name . "_hidden", 0); html_print_input_hidden($name . "_hidden", $id_agent_module);
ui_print_help_tip(__('Type at least two characters to search the module.'), false); ui_print_help_tip(__('Type at least two characters to search the module.'), false);
$javascript_ajax_page = $javascript_ajax_page =

View File

@ -237,7 +237,7 @@ if ($id_agent != 0) {
$text_module = (string) get_parameter('module_search', ''); $text_module = (string) get_parameter('module_search', '');
$id_agent_module = get_parameter('id_agent_module', 0); $id_agent_module = get_parameter('module_search_hidden', 0);
if ($id_agent_module != 0) { if ($id_agent_module != 0) {
$text_module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_agent_module); $text_module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_agent_module);
if ($text_module == false) { if ($text_module == false) {
@ -277,6 +277,7 @@ $params = "search=" . rawurlencode(io_safe_input($search)) .
"&amp;recursion=" . $recursion . "&amp;recursion=" . $recursion .
"&amp;refr=" . (int)get_parameter("refr", 0) . "&amp;refr=" . (int)get_parameter("refr", 0) .
"&amp;id_agent=" . $id_agent . "&amp;id_agent=" . $id_agent .
"&amp;id_agent_module=" . $id_agent_module .
"&amp;pagination=" . $pagination . "&amp;pagination=" . $pagination .
"&amp;group_rep=" . $group_rep . "&amp;group_rep=" . $group_rep .
"&amp;event_view_hr=" . $event_view_hr . "&amp;event_view_hr=" . $event_view_hr .

View File

@ -67,6 +67,8 @@ if (is_ajax()) {
$values['status'] = get_parameter('status'); $values['status'] = get_parameter('status');
$values['search'] = get_parameter('search'); $values['search'] = get_parameter('search');
$values['text_agent'] = get_parameter('text_agent'); $values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent');
$values['id_agent_module'] = get_parameter('id_agent_module');
$values['pagination'] = get_parameter('pagination'); $values['pagination'] = get_parameter('pagination');
$values['event_view_hr'] = get_parameter('event_view_hr'); $values['event_view_hr'] = get_parameter('event_view_hr');
$values['id_user_ack'] = get_parameter('id_user_ack'); $values['id_user_ack'] = get_parameter('id_user_ack');
@ -103,6 +105,8 @@ if (is_ajax()) {
$values['status'] = get_parameter('status'); $values['status'] = get_parameter('status');
$values['search'] = get_parameter('search'); $values['search'] = get_parameter('search');
$values['text_agent'] = get_parameter('text_agent'); $values['text_agent'] = get_parameter('text_agent');
$values['id_agent'] = get_parameter('id_agent');
$values['id_agent_module'] = get_parameter('id_agent_module');
$values['pagination'] = get_parameter('pagination'); $values['pagination'] = get_parameter('pagination');
$values['event_view_hr'] = get_parameter('event_view_hr'); $values['event_view_hr'] = get_parameter('event_view_hr');
$values['id_user_ack'] = get_parameter('id_user_ack'); $values['id_user_ack'] = get_parameter('id_user_ack');
@ -431,7 +435,7 @@ $data[0] .= html_print_select($user_users, "id_user_ack", $id_user_ack, '',
if (!$meta) { if (!$meta) {
$data[1] = __('Module search') . $jump; $data[1] = __('Module search') . $jump;
$data[1] .= html_print_autocomplete_modules('module_search', $data[1] .= html_print_autocomplete_modules('module_search',
$text_module, false, true, '', array(), true); $text_module, false, $id_agent_module, true, '', array(), true);
} }
else { else {
$data[1] = __('Server') . $jump; $data[1] = __('Server') . $jump;
@ -869,7 +873,8 @@ $(document).ready( function() {
$("#severity").val(-1); $("#severity").val(-1);
$("#status").val(3); $("#status").val(3);
$("#text-search").val(''); $("#text-search").val('');
$("#text_id_agent").val( <?php echo '"' . __('All') . '"' ?> ); $('input:hidden[name=id_agent]').val();
$('input:hidden[name=module_search_hidden]').val();
$("#pagination").val(25); $("#pagination").val(25);
$("#text-event_view_hr").val(8); $("#text-event_view_hr").val(8);
$("#id_user_ack").val(0); $("#id_user_ack").val(0);
@ -910,6 +915,10 @@ $(document).ready( function() {
$("#text-search").val(val); $("#text-search").val(val);
if (i == 'text_agent') if (i == 'text_agent')
$("#text_id_agent").val(val); $("#text_id_agent").val(val);
if (i == 'id_agent')
$('input:hidden[name=id_agent]').val(val);
if (i == 'id_agent_module')
$('input:hidden[name=module_search_hidden]').val(val);
if (i == 'pagination') if (i == 'pagination')
$("#pagination").val(val); $("#pagination").val(val);
if (i == 'event_view_hr') if (i == 'event_view_hr')
@ -980,6 +989,8 @@ $(document).ready( function() {
"status" : $("#status").val(), "status" : $("#status").val(),
"search" : $("#text-search").val(), "search" : $("#text-search").val(),
"text_agent" : $("#text_id_agent").val(), "text_agent" : $("#text_id_agent").val(),
"id_agent" : $('input:hidden[name=id_agent]').val(),
"id_agent_module" : $('input:hidden[name=module_search_hidden]').val(),
"pagination" : $("#pagination").val(), "pagination" : $("#pagination").val(),
"event_view_hr" : $("#text-event_view_hr").val(), "event_view_hr" : $("#text-event_view_hr").val(),
"id_user_ack" : $("#id_user_ack").val(), "id_user_ack" : $("#id_user_ack").val(),
@ -1073,6 +1084,8 @@ $(document).ready( function() {
"status" : $("#status").val(), "status" : $("#status").val(),
"search" : $("#text-search").val(), "search" : $("#text-search").val(),
"text_agent" : $("#text_id_agent").val(), "text_agent" : $("#text_id_agent").val(),
"id_agent" : $('input:hidden[name=id_agent]').val(),
"id_agent_module" : $('input:hidden[name=module_search_hidden]').val(),
"pagination" : $("#pagination").val(), "pagination" : $("#pagination").val(),
"event_view_hr" : $("#text-event_view_hr").val(), "event_view_hr" : $("#text-event_view_hr").val(),
"id_user_ack" : $("#id_user_ack").val(), "id_user_ack" : $("#id_user_ack").val(),

View File

@ -1898,7 +1898,9 @@ CREATE TABLE tevent_filter (
severity NUMBER(10, 0) DEFAULT -1, severity NUMBER(10, 0) DEFAULT -1,
status NUMBER(10, 0) DEFAULT -1, status NUMBER(10, 0) DEFAULT -1,
search CLOB DEFAULT '', search CLOB DEFAULT '',
text_agent CLOB DEFAULT '', text_agent CLOB DEFAULT '',
id_agent int(10) DEFAULT 0,
id_agent_module int(10) DEFAULT 0,
pagination NUMBER(10, 0) DEFAULT 25, pagination NUMBER(10, 0) DEFAULT 25,
event_view_hr NUMBER(10, 0) DEFAULT 8, event_view_hr NUMBER(10, 0) DEFAULT 8,
id_user_ack CLOB, id_user_ack CLOB,

View File

@ -1595,7 +1595,9 @@ CREATE TABLE "tevent_filter" (
"severity" INTEGER NOT NULL default -1, "severity" INTEGER NOT NULL default -1,
"status" INTEGER NOT NULL default -1, "status" INTEGER NOT NULL default -1,
"search" TEXT default '', "search" TEXT default '',
"text_agent" TEXT default '', "text_agent" TEXT default '',
"id_agent" int(10) default 0,
"id_agent_module" int(10) default 0,
"pagination" INTEGER NOT NULL default 25, "pagination" INTEGER NOT NULL default 25,
"event_view_hr" INTEGER NOT NULL default 8, "event_view_hr" INTEGER NOT NULL default 8,
"id_user_ack" TEXT, "id_user_ack" TEXT,

View File

@ -1692,7 +1692,9 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
`severity` int(10) NOT NULL default -1, `severity` int(10) NOT NULL default -1,
`status` int(10) NOT NULL default -1, `status` int(10) NOT NULL default -1,
`search` TEXT, `search` TEXT,
`text_agent` TEXT, `text_agent` TEXT,
`id_agent` int(10) default 0,
`id_agent_module` int(10) default 0,
`pagination` int(10) NOT NULL default 25, `pagination` int(10) NOT NULL default 25,
`event_view_hr` int(10) NOT NULL default 8, `event_view_hr` int(10) NOT NULL default 8,
`id_user_ack` TEXT, `id_user_ack` TEXT,