bugs events pandora_enterprise#9239

This commit is contained in:
Daniel Barbero Martin 2022-06-30 11:56:25 +02:00
parent fb5dd4d557
commit e009257d2f
4 changed files with 33 additions and 24 deletions

View File

@ -401,15 +401,8 @@ function events_delete($id_evento, $filter=null, $history=false, $force_node=fal
case '1': case '1':
// Group by events. // Group by events.
$event = events_get_event($id_evento, ['estado', 'event_type', 'id_agente', 'id_agentmodule']);
$filter['group_rep'] = 0;
$filter['status'] = $event['estado'];
$filter['event_type'] = $event['event_type'];
$filter['id_agent'] = $event['id_agente'];
$filter['id_agentmodule'] = $event['id_agentmodule'];
$sql = events_get_all( $sql = events_get_all(
['te.id_evento'], ['te.*'],
$filter, $filter,
// Offset. // Offset.
null, null,
@ -425,7 +418,18 @@ function events_delete($id_evento, $filter=null, $history=false, $force_node=fal
true true
); );
$target_ids = db_get_all_rows_sql($sql); $target_ids = db_get_all_rows_sql(
sprintf(
'SELECT tu.id_evento FROM tevento tu INNER JOIN ( %s ) tf
ON tu.estado = tf.estado
AND tu.evento = tf.evento
AND tu.id_agente = tf.id_agente
AND tu.id_agentmodule = tf.id_agentmodule
AND tf.max_id_evento = %d',
$sql,
$id_evento
)
);
// Try to avoid deadlock while updating full set. // Try to avoid deadlock while updating full set.
if ($target_ids !== false && count($target_ids) > 0) { if ($target_ids !== false && count($target_ids) > 0) {
@ -490,15 +494,8 @@ function events_update_status($id_evento, $status, $filter=null)
case '1': case '1':
// Group by events. // Group by events.
$event = events_get_event($id_evento, ['estado', 'event_type', 'id_agente', 'id_agentmodule']);
$filter['group_rep'] = 0;
$filter['status'] = $event['estado'];
$filter['event_type'] = $event['event_type'];
$filter['id_agent'] = $event['id_agente'];
$filter['id_agentmodule'] = $event['id_agentmodule'];
$sql = events_get_all( $sql = events_get_all(
['te.id_evento'], ['te.*'],
$filter, $filter,
// Offset. // Offset.
null, null,
@ -514,7 +511,18 @@ function events_update_status($id_evento, $status, $filter=null)
true true
); );
$target_ids = db_get_all_rows_sql($sql); $target_ids = db_get_all_rows_sql(
sprintf(
'SELECT tu.id_evento FROM tevento tu INNER JOIN ( %s ) tf
ON tu.estado = tf.estado
AND tu.evento = tf.evento
AND tu.id_agente = tf.id_agente
AND tu.id_agentmodule = tf.id_agentmodule
AND tf.max_id_evento = %d',
$sql,
$id_evento
)
);
// Try to avoid deadlock while updating full set. // Try to avoid deadlock while updating full set.
if ($target_ids !== false && count($target_ids) > 0) { if ($target_ids !== false && count($target_ids) > 0) {

View File

@ -4924,7 +4924,7 @@ function reporting_custom_render($report, $content, $type='dinamic', $pdf=0)
$data_macro['server_id'] $data_macro['server_id']
); );
if (metaconsole_connect($server) != NOERR) { if (metaconsole_connect($server) != NOERR) {
continue; continue 2;
} }
} }

View File

@ -3462,7 +3462,8 @@ function ui_print_datatable(array $parameters)
$(document).ready(function(){ $(document).ready(function(){
$.fn.dataTable.ext.errMode = "none"; $.fn.dataTable.ext.errMode = "none";
$.fn.dataTable.ext.classes.sPageButton = "'.$pagination_class.'"; $.fn.dataTable.ext.classes.sPageButton = "'.$pagination_class.'";
dt_'.$table_id.' = $("#'.$table_id.'").DataTable({
var settings_datatable = {
drawCallback: function(settings) {'; drawCallback: function(settings) {';
if (isset($parameters['drawCallback'])) { if (isset($parameters['drawCallback'])) {
$js .= $parameters['drawCallback']; $js .= $parameters['drawCallback'];
@ -3608,7 +3609,9 @@ function ui_print_datatable(array $parameters)
$js .= ' $js .= '
], ],
order: [[ '.$order.' ]] order: [[ '.$order.' ]]
}); };
var dt_'.$table_id.' = $("#'.$table_id.'").DataTable(settings_datatable);
$("#'.$form_id.'_search_bt").click(function (){ $("#'.$form_id.'_search_bt").click(function (){
dt_'.$table_id.'.draw().page(0) dt_'.$table_id.'.draw().page(0)

View File

@ -2213,11 +2213,9 @@ try {
$active_filters_div .= '</div>'; $active_filters_div .= '</div>';
$active_filters_div .= '<div id="events_buffers_display"></div>'; $active_filters_div .= '<div id="events_buffers_display"></div>';
$table_id = 'events'; $table_id = 'table_events';
$form_id = 'events_form'; $form_id = 'events_form';
// Print datatable. // Print datatable.
ui_print_datatable( ui_print_datatable(
[ [