9664 Exclude pendingdelete modules from scheduled downtime

This commit is contained in:
Pablo Aragon 2022-12-27 15:22:39 +01:00
parent 46a924c4f4
commit bbdc5b3e93
3 changed files with 12 additions and 1 deletions

View File

@ -1842,6 +1842,10 @@ function insert_downtime_agent($id_downtime, $user_groups_ad)
$(document).ready (function () { $(document).ready (function () {
populate_agents_selector(); populate_agents_selector();
// Add data-pendingdelete attribute to exclude delete_pending modules
document.querySelector("#id_agents").dataset.pendingdelete = true
document.querySelector("#modules_selection_mode").dataset.pendingdelete = true
$("#id_agents").change(agent_changed_by_multiple_agents); $("#id_agents").change(agent_changed_by_multiple_agents);
$("#modules_selection_mode").change(agent_changed_by_multiple_agents); $("#modules_selection_mode").change(agent_changed_by_multiple_agents);

View File

@ -246,7 +246,8 @@ function agent_changed_by_multiple_agents(event, id_agent, selected) {
serialized: serialized, serialized: serialized,
id_server: id_server, id_server: id_server,
status_module: module_status, status_module: module_status,
id_group: id_group id_group: id_group,
pendingdelete: event.target.dataset.pendingdelete // Get pendingdelete attribute from target
}, },
function(data) { function(data) {
$("#module").empty(); $("#module").empty();

View File

@ -66,6 +66,7 @@ if (is_ajax()) {
$agent_alias = get_parameter('alias', ''); $agent_alias = get_parameter('alias', '');
$agents_inserted = get_parameter('agents_inserted', []); $agents_inserted = get_parameter('agents_inserted', []);
$id_group = (int) get_parameter('id_group'); $id_group = (int) get_parameter('id_group');
$pendingdelete = (bool) get_parameter('pendingdelete');
$refresh_contact = get_parameter('refresh_contact', 0); $refresh_contact = get_parameter('refresh_contact', 0);
@ -735,6 +736,11 @@ if (is_ajax()) {
($sql_tags_join === '') ? 'INNER JOIN tagente ON tagente.id_agente = t1.id_agente' : '', ($sql_tags_join === '') ? 'INNER JOIN tagente ON tagente.id_agente = t1.id_agente' : '',
(empty($where_tags)) ? '' : " WHERE 1=1 $where_tags" (empty($where_tags)) ? '' : " WHERE 1=1 $where_tags"
); );
if ($pendingdelete == true) {
$sql .= sprintf(
' AND delete_pending=0'
);
}
} }
} else { } else {
$sql = sprintf( $sql = sprintf(