Merge branch 'ent-10870-15385-limpiar-eventos-desde-la-vista-detallada-de-evento' into 'develop'

Ent 10870 [#15385] Limpiar eventos desde la vista detallada de evento

See merge request artica/pandorafms!6174
This commit is contained in:
Rafael Ameijeiras 2023-08-21 11:10:35 +00:00
commit 82389ddf2d
4 changed files with 28 additions and 11 deletions

View File

@ -1444,6 +1444,7 @@ if ($add_comment === true) {
if ($change_status === true) { if ($change_status === true) {
$event_ids = get_parameter('event_ids'); $event_ids = get_parameter('event_ids');
$new_status = get_parameter('new_status'); $new_status = get_parameter('new_status');
$group_rep = (int) get_parameter('group_rep', 0);
$server_id = 0; $server_id = 0;
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$server_id = (int) get_parameter('server_id'); $server_id = (int) get_parameter('server_id');
@ -1457,10 +1458,19 @@ if ($change_status === true) {
$node->connect(); $node->connect();
} }
$return = events_change_status( if ($group_rep !== 3) {
explode(',', $event_ids), $return = events_change_status(
$new_status explode(',', $event_ids),
); $new_status
);
} else {
// Update all elements with same extraid.
$return = events_update_status(
$event_ids,
(int) $new_status,
['group_rep' => $group_rep]
);
}
} catch (\Exception $e) { } catch (\Exception $e) {
// Unexistent agent. // Unexistent agent.
if (is_metaconsole() === true if (is_metaconsole() === true

View File

@ -477,7 +477,7 @@ function events_update_status($id_evento, $status, $filter=null)
{ {
global $config; global $config;
if (!$status) { if (!$status && $status !== 0) {
return false; return false;
} }
@ -1762,11 +1762,9 @@ function events_get_all(
} }
} }
$string_metaconsole_connections = implode(',', $metaconsole_connections);
$explode_metaconsole_connections = explode(',', $string_metaconsole_connections);
$result_meta = Promise\wait( $result_meta = Promise\wait(
parallelMap( parallelMap(
$explode_metaconsole_connections, $metaconsole_connections,
function ($node_int) use ($sql, $history) { function ($node_int) use ($sql, $history) {
try { try {
if (is_metaconsole() === true if (is_metaconsole() === true
@ -3540,11 +3538,15 @@ function events_page_responses($event)
); );
if ($status_blocked === false) { if ($status_blocked === false) {
if (isset($event['server_id']) === false) {
$event['server_id'] = '0';
}
$data[2] = html_print_button( $data[2] = html_print_button(
__('Update'), __('Update'),
'status_button', 'status_button',
false, false,
'event_change_status("'.$event['similar_ids'].'",'.$event['server_id'].');', 'event_change_status("'.$event['similar_ids'].'",'.$event['server_id'].', '.$event['group_rep'].');',
[ [
'icon' => 'next', 'icon' => 'next',
'mode' => 'link', 'mode' => 'link',

View File

@ -322,7 +322,7 @@ function perform_response(response, response_id, index = "") {
} }
// Change the status of an event to new, in process or validated. // Change the status of an event to new, in process or validated.
function event_change_status(event_ids, server_id) { function event_change_status(event_ids, server_id, group_rep) {
var new_status = $("#estado").val(); var new_status = $("#estado").val();
$("#button-status_button").attr("disabled", "disabled"); $("#button-status_button").attr("disabled", "disabled");
@ -334,7 +334,8 @@ function event_change_status(event_ids, server_id) {
change_status: 1, change_status: 1,
event_ids: event_ids, event_ids: event_ids,
new_status: new_status, new_status: new_status,
server_id: server_id server_id: server_id,
group_rep: group_rep
}, },
type: "POST", type: "POST",
url: getUrlAjax(), url: getUrlAjax(),

View File

@ -157,6 +157,10 @@ try {
throw new Exception('Invalid filter. ['.$plain_filter.']'); throw new Exception('Invalid filter. ['.$plain_filter.']');
} }
if (key_exists('server_id', $filter) === true && is_array($filter['server_id']) === false) {
$filter['server_id'] = explode(',', $filter['server_id']);
}
$filter['csv_all'] = true; $filter['csv_all'] = true;
$names = events_get_column_names($column_names); $names = events_get_column_names($column_names);