Events agent grouped

This commit is contained in:
fbsanchez 2019-06-12 18:19:39 +02:00
parent 4bb300889d
commit f3a0f37a1c
6 changed files with 352 additions and 184 deletions

View File

@ -172,7 +172,11 @@ function events_get_column_names($fields)
$names = [];
foreach ($fields as $f) {
$names[] = events_get_column_name($f);
if (is_array($f)) {
$names[] = events_get_column_name($f['text']);
} else {
$names[] = events_get_column_name($f);
}
}
return $names;
@ -199,7 +203,8 @@ function events_get_all(
$offset=null,
$limit=null,
$order=null,
$sort_field=null
$sort_field=null,
$return_sql=false
) {
global $config;
@ -387,8 +392,18 @@ function events_get_all(
case '2':
// Group by agents.
$tagente_join = 'INNER';
$group_by .= 'te.id_agente, te.event_type';
$group_by .= $extra;
// $group_by .= 'te.id_agente, te.event_type';
// $group_by .= $extra;
$group_by = '';
$order_by = events_get_sql_order('id_agente', 'asc');
if (isset($order, $sort_field)) {
$order_by .= ','.events_get_sql_order(
$sort_field,
$order,
0,
true
);
}
break;
}
@ -408,8 +423,10 @@ function events_get_all(
$group_selects = '';
if ($group_by != '') {
$group_selects = ',COUNT(id_evento) AS event_rep,
';
$group_selects = ',COUNT(id_evento) AS event_rep
,GROUP_CONCAT(DISTINCT user_comment SEPARATOR "<br>") AS comments,
MAX(timestamp) as max_timestamp,
MAX(id_evento) as max_id_evento';
if ($count === false) {
unset($fields[array_search('te.user_comment', $fields)]);
@ -450,6 +467,10 @@ function events_get_all(
$sql = 'SELECT count(*) as nitems FROM ('.$sql.') tt';
}
if ($return_sql) {
return $sql;
}
return db_get_all_rows_sql($sql);
}
@ -5633,13 +5654,14 @@ function events_list_events_grouped_agents($sql)
/**
* Retrieves SQL for custom order.
*
* @param string $sort_field Field.
* @param string $sort Order.
* @param integer $group_rep Group field.
* @param string $sort_field Field.
* @param string $sort Order.
* @param integer $group_rep Group field.
* @param boolean $only-fields Return only fields.
*
* @return string SQL.
*/
function events_get_sql_order($sort_field='timestamp', $sort='DESC', $group_rep=0)
function events_get_sql_order($sort_field='timestamp', $sort='DESC', $group_rep=0, $only_fields=false)
{
$sort_field_translated = $sort_field;
switch ($sort_field) {
@ -5698,6 +5720,10 @@ function events_get_sql_order($sort_field='timestamp', $sort='DESC', $group_rep=
$dir = $sort;
}
if ($only_fields) {
return $sort_field_translated.' '.$dir;
}
return 'ORDER BY '.$sort_field_translated.' '.$dir;
}

View File

@ -2832,6 +2832,8 @@ function ui_progress(
* ]
* ],
* 'extra_html' => HTML content to be placed after 'filter' section.
* 'drawCallback' => function to be called after draw. Sample in:
* https://datatables.net/examples/advanced_init/row_grouping.html
* ]
* End.
*
@ -2993,6 +2995,11 @@ function ui_print_datatable(array $parameters)
}
$filter .= '<li>';
// Search button.
$filter .= '<input type="submit" class="'.$search_button_class.'" ';
$filter .= ' id="'.$form_id.'_search_bt" value="'.__('Filter').'"/>';
// Extra buttons.
if (is_array($parameters['form']['extra_buttons'])) {
foreach ($parameters['form']['extra_buttons'] as $button) {
$filter .= '<button id="'.$button['id'].'" ';
@ -3004,9 +3011,6 @@ function ui_print_datatable(array $parameters)
}
}
// Search button.
$filter .= '<input type="submit" class="'.$search_button_class.'" ';
$filter .= ' id="'.$form_id.'_search_bt" value="'.__('Filter').'"/>';
$filter .= '</li>';
$filter .= '</ul></form>';
@ -3071,6 +3075,14 @@ function ui_print_datatable(array $parameters)
$(document).ready(function(){
$.fn.dataTable.ext.errMode = "none";
dt_'.$table_id.' = $("#'.$table_id.'").DataTable({
';
if (isset($parameters['drawCallback'])) {
$js .= 'drawCallback: function(settings) {
'.$parameters['drawCallback'].'
},';
}
$js .= '
processing: true,
serverSide: true,
paging: true,
@ -3144,7 +3156,11 @@ function ui_print_datatable(array $parameters)
columns: [';
foreach ($parameters['datacolumns'] as $data) {
$js .= '{data : "'.$data.'",className: "no-class"},';
if (is_array($data)) {
$js .= '{data : "'.$data['text'].'",className: "'.$data['class'].'"},';
} else {
$js .= '{data : "'.$data.'",className: "no-class"},';
}
}
$js .= '

View File

@ -668,3 +668,13 @@ function show_event_response_command_dialog(id, response, total_checked) {
}
});
}
function validate_event(e, row) {
console.log(row);
}
function delete_event(e, row) {
$(row)
.closest("tr")
.remove();
}

View File

@ -298,3 +298,14 @@ li.ui-tabs-tab.ui-corner-top.ui-state-default.ui-tab.ui-tabs-active.ui-state-act
div.extended_event_pages.ui-tabs-panel.ui-corner-bottom.ui-widget-content {
border-top: 1px solid #a9a9a9;
}
tr.group {
padding: 5px;
border: none;
}
tr.group * {
text-align: left;
color: #222;
text-indent: 3em;
background: #e2e2e2;
}

View File

@ -1,5 +1,5 @@
* {
text-decoration: none;
text-decoration: none !important;
font-size: 12px;
}
@ -15,11 +15,11 @@ body {
}
.small {
font-size: 10px;
font-size: 10px !important;
}
.ui-header .ui-title {
font-size: 14px;
font-size: 14px !important;
}
.ui-btn-inner {
@ -57,8 +57,8 @@ legend {
}
.ui-btn-up-c {
font-weight: normal;
text-shadow: none;
font-weight: normal !important;
text-shadow: none !important;
}
/* For mobiles */
@ -76,7 +76,7 @@ legend {
@media screen and (min-width: 750px) {
#tactical1 a,
#tactical2 a {
font-size: 25px;
font-size: 25px !important;
}
}
/*END-----------Tactical styles-----------------------------------------*/
@ -93,16 +93,16 @@ legend {
/*INIT----------Groups styles-----------------------------------------*/
.group_view tr {
border-bottom: 3px solid white;
border-bottom: 3px solid white !important;
}
tr.group_view_crit,
.group_view_crit {
background-color: #fa3030;
color: #000000;
color: #000000 !important;
}
.group_view_crit * {
color: #000000;
color: #000000 !important;
}
.ui-btn-up-group_view_crit,
.ui-btn-hover-group_view_crit {
@ -118,16 +118,16 @@ tr.group_view_crit,
.group_view_norm,
.group_view_norm * {
background-color: #ffffff;
color: #000000;
color: #000000 !important;
}
.group_view_norm * {
color: #000000;
color: #000000 !important;
}
.group_view_not_init,
.group_view_not_init * {
background-color: #5ab7e5;
color: #fff;
color: #fff !important;
}
.ui-btn-up-group_view_normal,
@ -144,10 +144,10 @@ tr.group_view_crit,
.group_view_ok,
.group_view_ok * {
background-color: #00c000;
color: #000000;
color: #000000 !important;
}
.group_view_ok * {
color: #000000;
color: #000000 !important;
}
.ui-btn-up-group_view_ok,
.ui-btn-hover-group_view_ok {
@ -166,7 +166,7 @@ tr.a.group_view_warn {
background-color: #f5e535;
}
a.group_view_warn {
color: #000000;
color: #000000 !important;
}
.ui-btn-up-group_view_warn,
.ui-btn-hover-group_view_warn {
@ -182,7 +182,7 @@ tr.group_view_alrm,
background-color: #ed8701;
}
.group_view_alrm * {
color: #000000;
color: #000000 !important;
}
.ui-btn-up-group_view_alrm,
.ui-btn-hover-group_view_alrm {
@ -198,7 +198,7 @@ tr.group_view_unk,
background-color: #c4c4c4;
}
.group_view_unk * {
color: #000000;
color: #000000 !important;
}
.ui-btn-up-group_view_unk,
.ui-btn-hover-group_view_unk {
@ -212,37 +212,37 @@ tr.group_view_unk,
.ui-btn-active:visited,
.ui-btn-active:hover,
.ui-btn-active a.ui-link-inherit {
color: #888;
text-shadow: none;
color: #888 !important;
text-shadow: none !important;
}
tr.group_view_data,
.group_view_data {
color: #000000;
color: #000000 !important;
}
.group_view_data_unk * {
color: #303030;
color: #303030 !important;
}
.group_view_data_ok * {
color: #00c000;
color: #00c000 !important;
}
.group_view_data_crit * {
color: #5c0000;
color: #5c0000 !important;
}
.group_view_data_alrm * {
color: #5c1d00;
color: #5c1d00 !important;
}
.group_view_data_warn * {
color: #5c5900;
color: #5c5900 !important;
}
.group_view * {
text-shadow: none;
font-size: 12px;
text-shadow: none !important;
font-size: 12px !important;
}
.list_groups .link_count {
display: inline;
display: inline !important;
}
.list_groups .number_count,
@ -285,16 +285,16 @@ tr.group_view_data,
.datos_green a,
.datos_greenf9 a {
background-color: #52a000;
color: #ffffff;
text-shadow: none;
color: #ffffff !important;
text-shadow: none !important;
}
.datos_red,
.datos_redf9,
.datos_red a,
.datos_redf9 a {
background-color: #ff3e41;
color: #ffffff;
text-shadow: none;
color: #ffffff !important;
text-shadow: none !important;
}
.datos_yellow,
@ -302,50 +302,50 @@ tr.group_view_data,
.datos_yellow a,
.datos_yellowf9 a {
background-color: #f5e535;
color: #000000;
text-shadow: none;
color: #000000 !important;
text-shadow: none !important;
}
.datos_blue,
.datos_bluef9,
.datos_blue a,
.datos_bluef9 a {
background-color: #77e2f2;
color: #000000;
text-shadow: none;
color: #000000 !important;
text-shadow: none !important;
}
.datos_grey,
.datos_greyf9,
.datos_grey a,
.datos_greyf9 a {
background-color: #e4e4e4;
color: #000000;
text-shadow: none;
color: #000000 !important;
text-shadow: none !important;
}
.datos_pink,
.datos_pinkf9,
.datos_pink a,
.datos_pinkf9 a {
background-color: #ff92e9;
color: #000000;
text-shadow: none;
color: #000000 !important;
text-shadow: none !important;
}
.datos_brown,
.datos_brownf9,
.datos_brown a,
.datos_brownf9 a {
background-color: #c97a4a;
color: #000000;
text-shadow: none;
color: #000000 !important;
text-shadow: none !important;
}
tr.events {
border-bottom: 6px solid #f7f7f7;
font-size: 12px;
border-bottom: 6px solid #f7f7f7 !important;
font-size: 12px !important;
}
table#list_events th {
font-size: 12px;
font-weight: bolder;
font-size: 12px !important;
font-weight: bolder !important;
border: 0px;
}
@ -527,23 +527,23 @@ table.event_details td.cell_event_name {
.redb,
.redi,
.error {
background: #f85858;
background: #f85858 !important;
}
.green {
background: #6eb432;
background: #6eb432 !important;
}
.orange {
background: #ff8800;
background: #ff8800 !important;
}
.yellow {
background: #ffea59;
background: #ffea59 !important;
}
.grey {
background: #aaaaaa;
background: #aaaaaa !important;
font-weight: bold;
}
@ -554,7 +554,7 @@ table.event_details td.cell_event_name {
.grey,
.agents_tiny_stats span {
text-shadow: none;
color: white;
color: white !important;
padding: 1px 3px;
border-radius: 2px;
}
@ -630,9 +630,9 @@ table.event_details td.cell_event_name {
display: table-cell;
clear: none;
float: none;
padding-left: 0px;
padding-right: 0px;
width: auto;
padding-left: 0px !important;
padding-right: 0px !important;
width: auto !important;
}
#list_agents td.cell_0 {
@ -651,7 +651,7 @@ table.event_details td.cell_event_name {
#list_agents .cell_4 .ui-table-cell-label,
#list_agents .cell_5 .ui-table-cell-label,
#list_agents .cell_8 .ui-table-cell-label {
min-width: auto;
min-width: auto !important;
}
#list_agents .cell_3 .ui-table-cell-label,
@ -663,19 +663,19 @@ table.event_details td.cell_event_name {
#list_agents .cell_2,
#list_agents .cell_3,
#list_agents .cell_7 {
display: inline;
float: none;
display: inline !important;
float: none !important;
}
#list_agents .cell_4,
#list_agents .cell_8 {
display: inline;
float: none;
display: inline !important;
float: none !important;
}
#list_agents .cell_8 {
display: inline;
float: none;
display: inline !important;
float: none !important;
}
#list_agents b.ui-table-cell-label {
@ -683,14 +683,14 @@ table.event_details td.cell_event_name {
}
#list_agents .show_collapside {
display: none;
display: none !important;
}
#list_agents .cell_1,
#list_agents .cell_2,
#list_agents .cell_3,
#list_agents .cell_4 {
display: none;
display: none !important;
}
#list_agents .cell_0 .ui-link {
@ -698,15 +698,15 @@ table.event_details td.cell_event_name {
}
#list_agents .cell_6 .show_collapside {
display: none;
display: none !important;
}
.agents_tiny_stats * {
font-size: 12px;
font-size: 12px !important;
}
#list_agent_Modules td {
padding-top: 7px;
padding-top: 7px !important;
}
.agents_tiny_stats {
@ -717,13 +717,13 @@ table.event_details td.cell_event_name {
/* For mobiles */
@media screen and (max-width: 750px) {
.agents_tiny_stats * {
font-size: 12px;
font-size: 12px !important;
}
}
/* For tablets */
@media screen and (min-width: 750px) {
.agents_tiny_stats * {
font-size: 17px;
font-size: 17px !important;
}
}
/*END-----------Agents styles-----------------------------------------*/
@ -755,7 +755,7 @@ table.event_details td.cell_event_name {
#rendered_visual_map div {
color: #003a3a;
text-shadow: none;
text-shadow: none !important;
}
#rendered_visual_map {
@ -765,62 +765,62 @@ table.event_details td.cell_event_name {
/* For mobiles */
@media screen and (max-width: 750px) {
#rendered_visual_map div {
font-size: 6pt;
font-size: 6pt !important;
}
}
/* For tablets */
@media screen and (min-width: 750px) {
#rendered_visual_map div {
font-size: 8pt;
font-size: 8pt !important;
}
}
/* For mobiles */
@media screen and (max-width: 750px) {
.resize_visual_font_size_4pt * {
font-size: 2pt;
font-size: 2pt !important;
}
.resize_visual_font_size_6pt * {
font-size: 3pt;
font-size: 3pt !important;
}
.resize_visual_font_size_8pt * {
font-size: 4pt;
font-size: 4pt !important;
}
.resize_visual_font_size_14pt * {
font-size: 6pt;
font-size: 6pt !important;
}
.resize_visual_font_size_24pt * {
font-size: 10pt;
font-size: 10pt !important;
}
.resize_visual_font_size_36pt * {
font-size: 14pt;
font-size: 14pt !important;
}
.resize_visual_font_size_72pt * {
font-size: 27pt;
font-size: 27pt !important;
}
}
/* For tablets */
@media screen and (min-width: 750px) {
.resize_visual_font_size_4pt * {
font-size: 2pt;
font-size: 2pt !important;
}
.resize_visual_font_size_6pt * {
font-size: 3pt;
font-size: 3pt !important;
}
.resize_visual_font_size_8pt * {
font-size: 4pt;
font-size: 4pt !important;
}
.resize_visual_font_size_14pt * {
font-size: 7pt;
font-size: 7pt !important;
}
.resize_visual_font_size_24pt * {
font-size: 12pt;
font-size: 12pt !important;
}
.resize_visual_font_size_36pt * {
font-size: 18pt;
font-size: 18pt !important;
}
.resize_visual_font_size_72pt * {
font-size: 36pt;
font-size: 36pt !important;
}
}
@ -831,7 +831,7 @@ table.event_details td.cell_event_name {
#list_Modules .cell_1 .ui-table-cell-label,
#list_Modules .cell_5 .ui-table-cell-label,
#list_Modules .cell_6 .ui-table-cell-label {
min-width: auto;
min-width: auto !important;
}
#list_Modules .cell_5 .ui-table-cell-label,
@ -844,7 +844,7 @@ table.event_details td.cell_event_name {
#list_Modules .cell_3 .ui-table-cell-label,
#list_Modules .cell_4 .ui-table-cell-label,
#list_Modules .cell_5 .ui-table-cell-label {
display: none;
display: none !important;
}
#list_Modules td {
@ -853,12 +853,12 @@ table.event_details td.cell_event_name {
display: table-cell;
clear: none;
float: none;
padding-left: 0px;
padding-right: 0px;
padding-left: 0px !important;
padding-right: 0px !important;
}
#list_Modules .show_collapside {
display: inline;
display: inline !important;
}
#list_Modules .data {
@ -868,14 +868,14 @@ table.event_details td.cell_event_name {
#list_Modules .cell_1,
#list_Modules .cell_2,
#list_Modules .cell_3 {
display: none;
display: none !important;
}
#list_Modules .cell_0 .show_collapside,
#list_Modules .cell_1 .show_collapside,
#list_Modules .cell_4 .show_collapside,
#list_Modules .cell_5 .show_collapside {
display: none;
display: none !important;
}
#list_Modules .cell_0 .ui-link {
@ -901,12 +901,12 @@ table.event_details td.cell_event_name {
float: left;
}
#list_Modules .module_name {
font-size: 12px;
font-size: 12px !important;
}
}
#list_Modules .cell_5 a {
color: #000000;
color: #000000 !important;
}
#list_Modules .module_name {
@ -930,7 +930,7 @@ table.event_details td.cell_event_name {
#user_logged {
position: absolute;
font-size: 11px;
font-size: 11px !important;
right: 10px;
top: 8px;
background: url(../../../images/header_user.png) no-repeat right;
@ -950,11 +950,11 @@ table.event_details td.cell_event_name {
/*INIT---------Fix the square border in search input------------------*/
.ui-input-search {
border-radius: 0.6em 0.6em 0.6em 0.6em;
border-radius: 0.6em 0.6em 0.6em 0.6em !important;
}
.ui-select {
width: 100%;
width: 100% !important;
}
/*END----------Fix the square border in search input------------------*/
@ -964,26 +964,26 @@ ul.ui-listview li.ui-btn div.ui-btn-inner div.ui-btn-text a {
}
.ui-btn-inner {
border: 0px solid #000;
border: 0px solid #000 !important;
}
li.ui-btn {
margin-bottom: 4px;
margin-top: 4px;
margin-bottom: 4px !important;
margin-top: 4px !important;
}
/*INIT---------Fix the tons of air between the rows in small table----*/
.head_vertical {
margin-top: 0px;
margin-top: 0px !important;
border-top: 1px solid grey;
}
.head_horizontal {
border-bottom: 1px solid grey;
border-bottom: 1px solid grey !important;
}
#list_events .head_horizontal {
border-bottom: 0px solid white;
border-bottom: 0px solid white !important;
}
.cell_0 {
@ -1003,30 +1003,30 @@ li.ui-btn {
@media screen and (max-width: 34.99em) {
.ui-table th,
.ui-table td {
padding: 8px;
padding: 8px !important;
padding-left: 3px;
}
.head_vertical {
display: none;
display: none !important;
}
}
/*END----------Fix the tons of air between the rows in small table----*/
/*INIT---------Fix to avoid clicks under loading message--------------*/
.ui-loader-background {
width: 100%;
height: 100%;
top: 0;
margin: 0;
background: rgba(0, 0, 0, 0.3);
display: none;
position: fixed;
z-index: 100;
width: 100% !important;
height: 100% !important;
top: 0 !important;
margin: 0 !important;
background: rgba(0, 0, 0, 0.3) !important;
display: none !important;
position: fixed !important;
z-index: 100 !important;
}
.ui-loading .ui-loader-background {
display: block;
display: block !important;
}
/*END----------Fix to avoid clicks under loading message--------------*/
@ -1038,8 +1038,8 @@ li.ui-btn {
}
.ui-icon-big {
width: 28px;
height: 28px;
width: 28px !important;
height: 28px !important;
}
@media screen and (max-width: 35em) {
@ -1097,12 +1097,12 @@ li.ui-btn {
label,
input,
.ui-btn-inner {
font-size: 12px;
font-size: 12px !important;
}
.list_groups .ui-btn-inner {
padding-top: 15px;
height: 20px;
padding-top: 15px !important;
height: 20px !important;
}
.login_logo img {
@ -1128,25 +1128,25 @@ li.ui-btn {
label,
input,
.ui-btn-inner {
font-size: 16px;
padding-top: 6px;
font-size: 16px !important;
padding-top: 6px !important;
}
.list_groups .ui-btn-inner {
padding-top: 20px;
height: 35px;
padding-top: 20px !important;
height: 35px !important;
}
.ui-header .ui-title {
font-size: 18px;
font-size: 18px !important;
}
* {
font-size: 18px;
font-size: 18px !important;
}
.event_name {
font-size: 15px;
font-size: 15px !important;
}
.login_logo img {
@ -1178,7 +1178,7 @@ li.ui-btn {
#login_container input,
#login_container .ui-btn-text {
font-size: 16px;
font-size: 16px !important;
}
table.tactical_bars {
@ -1211,39 +1211,39 @@ table.tactical_bars {
/*INIT-----------Icons styles---------------------------------------*/
.ui-icon-tactical_view {
background-image: url(../../../images/op_monitoring.menu.png);
background-image: url(../../../images/op_monitoring.menu.png) !important;
}
.ui-icon-events {
background-image: url(../../../images/op_events.menu.png);
background-image: url(../../../images/op_events.menu.png) !important;
}
.ui-icon-groups {
background-image: url(../../../images/group.menu.png);
background-image: url(../../../images/group.menu.png) !important;
}
.ui-icon-alerts {
background-image: url(../../../images/op_alerts.menu.png);
background-image: url(../../../images/op_alerts.menu.png) !important;
}
.ui-icon-agents {
background-image: url(../../../images/agent_mc.menu.png);
background-image: url(../../../images/agent_mc.menu.png) !important;
}
.ui-icon-modules {
background-image: url(../../../images/brick.menu.png);
background-image: url(../../../images/brick.menu.png) !important;
}
.ui-icon-network_maps {
background-image: url(../../../images/op_network.menu.png);
background-image: url(../../../images/op_network.menu.png) !important;
}
.ui-icon-visual_console {
background-image: url(../../../images/visual_console.menu.png);
background-image: url(../../../images/visual_console.menu.png) !important;
}
.ui-icon-dashboard {
background-image: url(../../../images/dashboard.menu.png);
background-image: url(../../../images/dashboard.menu.png) !important;
}
.ui-icon-tactical_view,
@ -1255,16 +1255,16 @@ table.tactical_bars {
.ui-icon-network_maps,
.ui-icon-visual_console,
.ui-icon-dashboard {
background-color: #333;
background-color: #333 !important;
background-position: center;
border-radius: 15px;
-webkit-border-radius: 15px;
border-radius: 15px !important;
-webkit-border-radius: 15px !important;
}
#login_btn-container .ui-icon {
background-color: #333;
border-radius: 15px;
-webkit-border-radius: 15px;
background-color: #333 !important;
border-radius: 15px !important;
-webkit-border-radius: 15px !important;
}
/* For mobiles */
@ -1278,9 +1278,9 @@ table.tactical_bars {
.ui-icon-network_maps,
.ui-icon-visual_console,
.ui-icon-dashboard {
width: 22px;
height: 22px;
margin-top: -13px;
width: 22px !important;
height: 22px !important;
margin-top: -13px !important;
background-size: 16px 16px;
}
}
@ -1295,9 +1295,9 @@ table.tactical_bars {
.ui-icon-network_maps,
.ui-icon-visual_console,
.ui-icon-dashboard {
width: 32px;
height: 32px;
margin-top: -17px;
width: 32px !important;
height: 32px !important;
margin-top: -17px !important;
}
}
@ -1310,11 +1310,11 @@ table.tactical_bars {
}
.ui-btn-active * {
color: #fff;
color: #fff !important;
}
.ui-btn-active {
background: #82b92e;
background: #82b92e !important;
}
span.nobold * {
@ -1338,7 +1338,7 @@ span.nobold * {
}
.events_agent b.ui-table-cell-label {
display: block;
display: block !important;
}
#list_Modules *,
@ -1351,8 +1351,8 @@ span.nobold * {
}
div.legend > div {
width: 100%;
opacity: 0.65;
width: 100% !important;
opacity: 0.65 !important;
}
div.nodata_text {
@ -1363,7 +1363,7 @@ div.nodata_text {
display: table-cell;
vertical-align: middle;
text-align: left;
font-size: 14px;
font-size: 14px !important;
}
div.nodata_container {
@ -1385,17 +1385,17 @@ div.nodata_container {
}
.ui-icon-delete {
margin-top: -3px;
margin-top: -3px !important;
}
.empty_advice {
color: #ff0000;
margin-top: 5px;
margin-top: 5px !important;
}
/* JQuery Mobile responsive hack to tables with */
.ui-table-reflow.ui-responsive {
display: table;
display: table !important;
}
.widget_agent_module > th {
@ -1411,10 +1411,10 @@ div.nodata_container {
}
.legend_graph td.legendLabel > div {
font-size: 12px;
font-size: 12px !important;
}
.legend_graph td.legendLabel {
font-size: 12px;
font-size: 12px !important;
}
.ui-popup-hidden {

View File

@ -79,9 +79,9 @@ $text_agent = get_parameter('filter[text_agent]');
$id_agent = get_parameter('filter[id_agent]');
$id_agent_module = get_parameter('filter[id_agent_module]');
$pagination = get_parameter('filter[pagination]');
$event_view_hr = get_parameter('filter[event_view_hr]', 1);
$event_view_hr = get_parameter('filter[event_view_hr]', 8);
$id_user_ack = get_parameter('filter[id_user_ack]');
$group_rep = get_parameter('filter[group_rep]');
$group_rep = get_parameter('filter[group_rep]', 1);
$tag_with = get_parameter('filter[tag_with]', []);
$tag_without = get_parameter('filter[tag_without]', []);
$filter_only_alert = get_parameter('filter[filter_only_alert]');
@ -993,7 +993,10 @@ try {
// 'timestamp_rep',
// 'timestamp_rep_min',
// 'module_name',
'options',
[
'text' => 'options',
'class' => 'action_buttons',
],
];
$fields = explode(',', $config['event_fields']);
@ -1003,7 +1006,14 @@ try {
}
// Always add options column.
$fields = array_merge($fields, ['options']);
$fields = array_merge(
$fields,
[[
'text' => 'options',
'class' => 'action_buttons',
],
]
);
// Get column names.
$column_names = events_get_column_names($fields);
@ -1119,6 +1129,7 @@ try {
'columns' => $fields,
'no_sortable_columns' => [-1],
'ajax_postprocess' => 'process_datatables_item(item)',
'drawCallback' => 'process_datatables_callback(this, settings)',
]
);
} catch (Exception $e) {
@ -1164,9 +1175,83 @@ var origin_select_without_tag_empty = <?php echo (int) $add_without_tag_disabled
var val_none = 0;
var text_none = "<?php echo __('None'); ?>";
var group_agents_id = false;
var test;
/* Datatables auxiliary functions starts */
function process_datatables_callback(table, settings) {
var api = table.api();
var rows = api.rows( {page:'current'} ).nodes();
var last=null;
var last_count=0;
var events_per_group = [];
var j=0;
// Only while grouping by agents.
if($('#group_rep').val() == '2') {
test = api;
target = -1;
for (var i =0 ; i < api.columns()['0'].length; i++) {
var label = $(api.table().column(i).header()).text();
if(label == '<?php echo __('Agent ID'); ?>') {
// Agent id.
target = i;
}
if(label == '<?php echo __('Agent name'); ?>') {
// Agent id.
target = i;
break;
}
}
// Cannot group without agent_id or agent_name.
if (target < 0) {
return;
}
api.column(target, {page:'current'} )
.data()
.each( function ( group, i ) {
$(rows).eq( i ).show();
if ( last !== group ) {
$(rows).eq( i ).before(
'<tr class="group"><td colspan="100%">'
+'<?php echo __('Agent').' '; ?>'
+group+' <?php echo __('has').' '; ?>'
+'<span style="cursor: pointer" id="s'+j+'">'+'</span>'
+'<?php echo ' '.__('events'); ?>'
+'</td></tr>'
);
events_per_group.push(i);
last_count = i;
last = group;
j += 1;
}
});
events_per_group.push(rows.length - last_count);
for( j=0; j<events_per_group.length; j++ ) {
$('#s'+j).text(events_per_group[j+1]);
}
/* Grouped by agent toggle view. */
$("tr.group td span").on('click', function(e){
var id = this.id.substring(1)*1;
var from = events_per_group[id];
var to = events_per_group[id+1] + from;
for (var i = from; i < to; i++) {
$(rows).eq(i).toggle();
}
})
}
}
function process_datatables_item(item) {
// Grouped events.
if(item.max_id_evento) {
item.id_evento = item.max_id_evento
}
/* Event severity prepared */
var color = "<?php echo COL_UNKNOWN; ?>";
var text = "<?php echo __('UNKNOWN'); ?>";
@ -1217,6 +1302,7 @@ function process_datatables_item(item) {
evn = '<div class="event flex-row h100p nowrap">';
evn += '<div><a href="javascript:" onclick="show_event_dialog(';
evn += item.id_evento+','+$("#group_rep").val()+');">';
// Grouped events.
if(item.event_rep) {
evn += '('+item.event_rep+') ';
}
@ -1229,6 +1315,10 @@ function process_datatables_item(item) {
item.criticity = '<div class="criticity" style="background: ';
item.criticity += color + '">' + text + "</div>";
// Grouped events.
if(item.max_timestamp) {
item.timestamp = item.max_timestamp;
}
/* Event type prepared. */
switch (item.event_type) {
@ -1336,11 +1426,28 @@ function process_datatables_item(item) {
item.options += ')" ><?php echo html_print_image('images/eye.png', true, ['title' => __('Show more')]); ?></a>';
// Validate.
item.options += '<a href="javascript:" onclick="show_event_dialog(';
item.options += item.id_evento+','+$("#group_rep").val();
item.options += ')" ><?php echo html_print_image('images/tick.png', true, ['title' => __('Validate event')]); ?></a>';
item.options += '<a href="javascript:" onclick="validate_event(';
item.options += item.id_evento+', this)" >';
if (item.max_id_evento) {
item.options += '<?php echo html_print_image('images/tick.png', true, ['title' => __('Validate events')]); ?></a>';
} else {
item.options += '<?php echo html_print_image('images/tick.png', true, ['title' => __('Validate event')]); ?></a>';
}
// In progress.
item.options += '<a href="javascript:" onclick="inprogress_event(';
item.options += item.id_evento+', this)" >';
item.options += '<?php echo html_print_image('images/hourglass.png', true, ['title' => __('Chnge to in progress status')]); ?></a>';
// Delete.
item.options += '<a href="javascript:" onclick="delete_event(';
item.options += item.id_evento+', this)" >';
if (item.max_id_evento) {
item.options += '<?php echo html_print_image('images/cross.png', true, ['title' => __('Delete events')]); ?></a>';
} else {
item.options += '<?php echo html_print_image('images/cross.png', true, ['title' => __('Delete event')]); ?></a>';
}
/* Event ID dash */
item.id_evento = "#"+item.id_evento;
@ -1594,8 +1701,6 @@ function reorder_tags_inputs() {
}
/* Tag management ends */
$(document).ready( function() {
/* Update summary */
$("#status").on("change",function(){
$('#summary_status').html($("#status option:selected").text());