From 1362bbc555030ba715f01b9cf8c31dc712867865 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Thu, 1 Jun 2017 13:50:35 +0200 Subject: [PATCH] Added styles to sound events window --- pandora_console/operation/events/events.php | 24 +++++-- .../operation/events/sound_events.php | 71 +++++++++---------- 2 files changed, 52 insertions(+), 43 deletions(-) diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 625d1ed3c9..15da1cf221 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -161,29 +161,45 @@ if (is_ajax ()) { $return = array('fired' => $resultAlert, 'sound' => $config['sound_alert']); $event = events_get_event($resultAlert); + $module_name = modules_get_agentmodule_name($event['id_agentmodule']); - $return['message'] = __('Alert fired in module ') . io_safe_output($module_name); + $agent_name = agents_get_alias($event['id_agente']); + + $return['message'] = $agent_name . " - " . __('Alert fired in module ') . io_safe_output($module_name) . + " - " . $event['timestamp']; } else if ($resultCritical) { $return = array('fired' => $resultCritical, 'sound' => $config['sound_critical']); $event = events_get_event($resultCritical); + $module_name = modules_get_agentmodule_name($event['id_agentmodule']); - $return['message'] = __('Module ') . io_safe_output($module_name) . __(' is going to critical'); + $agent_name = agents_get_alias($event['id_agente']); + + $return['message'] = $agent_name . " - " . __('Module ') . io_safe_output($module_name) . __(' is going to critical') . + " - " . $event['timestamp']; } else if ($resultWarning) { $return = array('fired' => $resultWarning, 'sound' => $config['sound_warning']); $event = events_get_event($resultWarning); + $module_name = modules_get_agentmodule_name($event['id_agentmodule']); - $return['message'] = __('Module ') . io_safe_output($module_name) . __(' is going to warning'); + $agent_name = agents_get_alias($event['id_agente']); + + $return['message'] = $agent_name . " - " . __('Module ') . io_safe_output($module_name) . __(' is going to warning') . + " - " . $event['timestamp']; } else if ($resultUnknown) { $return = array('fired' => $resultUnknown, 'sound' => $config['sound_alert']); $event = events_get_event($resultUnknown); + $module_name = modules_get_agentmodule_name($event['id_agentmodule']); - $return['message'] = __('Module ') . io_safe_output($module_name) . __(' is going to unknown'); + $agent_name = agents_get_alias($event['id_agente']); + + $return['message'] = $agent_name . " - " . __('Module ') . io_safe_output($module_name) . __(' is going to unknown') . + " - " . $event['timestamp']; } else { $return = array('fired' => 0); diff --git a/pandora_console/operation/events/sound_events.php b/pandora_console/operation/events/sound_events.php index 3633b40437..173de7c339 100644 --- a/pandora_console/operation/events/sound_events.php +++ b/pandora_console/operation/events/sound_events.php @@ -77,7 +77,7 @@ $table->style[1] = 'font-weight: bold; vertical-align: top;'; $table->style[2] = 'font-weight: bold; vertical-align: top;'; $table->data[0][0] = __('Group'); -$table->data[0][1] = html_print_select_groups(false, $access, true, 'group', '', 'changeGroup();', '', 0, true) . '
' . '
'; +$table->data[0][1] = html_print_select_groups(false, $access, true, 'group', '', 'changeGroup();', '', 0, true, false, true, '', false, 'width:120px;') . '
' . '
'; $table->data[0][2] = __('Type'); $table->data[0][3] = html_print_checkbox('alert_fired', 'alert_fired', true, true, false, 'changeType();') . __('Alert fired') . '
' . @@ -86,10 +86,10 @@ $table->data[0][3] = html_print_checkbox('alert_fired', 'alert_fired', true, tru html_print_checkbox('warning', 'warning', true, true, false, 'changeType();') . __('Monitor warning') . '
'; $table->data[1][0] = __('Agent'); -$table->data[1][1] = html_print_select($agents, 'id_agents[]', true, false, '', '', true, true,'','','','width:104px; height:60px','',false,'','',true); +$table->data[1][1] = html_print_select($agents, 'id_agents[]', true, false, '', '', true, true,'','','','width:120px; height:100px','',false,'','',true); $table->data[1][2] = __('Event'); -$table->data[1][3] = html_print_textarea ("events_fired", 1, 20, '', 'readonly="readonly" style="background: #ddd; resize:none;"', true); +$table->data[1][3] = html_print_textarea ("events_fired", 200, 20, '', 'readonly="readonly" style="max-height:100px; background: #ddd; resize:none;"', true); html_print_table($table); @@ -128,12 +128,9 @@ var warning = true; var unknown = true; var running = false; -var fired = false; var id_row = 0; -var redBackground = false; - var button_play_status = "play"; var test_sound = false; @@ -196,7 +193,6 @@ function toggleButton() { } function ok() { - fired = false; $('#button_status').attr('src','../../images/tick_sound_events.png'); $('audio').remove(); $('#textarea_events_fired').val(""); @@ -206,10 +202,8 @@ function stopSound() { $('audio').remove(); $('body').css('background', '#494949'); - redBackground = false; running = false; - fired = false; } function startSound() { @@ -245,37 +239,36 @@ function check_event() { var agents = $("#id_agents").val(); if (running) { - if (!fired) { - jQuery.post ("../../ajax.php", - {"page" : "operation/events/events", - "get_events_fired": 1, - "id_group": group, - "agents[]" : agents, - "alert_fired": alert_fired, - "critical": critical, - "warning": warning, - "unknown": unknown, - "id_row": id_row - }, - function (data) { - firedId = parseInt(data['fired']); - if (firedId != 0) { - id_row = firedId; - fired = true; - var actual_text = $('#textarea_events_fired').val(); - if (actual_text == "") { - $('#textarea_events_fired').val(data['message']); - } - else { - $('#textarea_events_fired').val(actual_text + "\n" + data['message']); - } - $('#button_status').attr('src','../../images/sound_events_console_alert.gif'); - $('body').append("