Merge branch 'ent-9610-filtrar-por-os-en-bulk-operations' into 'develop'

Ent 9610 filtrar por os en bulk operations

See merge request artica/pandorafms!5863
This commit is contained in:
Gorka Sanchez 2023-06-30 11:43:50 +00:00
commit aa7186512c
4 changed files with 64 additions and 9 deletions

View File

@ -107,6 +107,8 @@ if (is_ajax() === true) {
// Ids of agents to be include in the SQL clause as id_agent IN ().
$filter_agents_json = (string) get_parameter('filter_agents_json', '');
$status_agents = (int) get_parameter('status_agents', AGENT_STATUS_ALL);
$os_agent = (int) get_parameter('os_agent', 0);
$os_agent_version = (string) get_parameter('os_agent_version', '');
// Juanma (22/05/2014) Fix: If setted remove void agents from result
// (by default and for compatibility show void agents).
$show_void_agents = (int) get_parameter('show_void_agents', 1);
@ -152,6 +154,14 @@ if (is_ajax() === true) {
$filter['status'] = $status_agents;
}
if ($os_agent !== 0) {
$filter['id_os'] = $os_agent;
}
if ($os_agent_version !== '') {
$filter['os_version'] = $os_agent_version;
}
if ($id_os !== 0) {
$filter['id_os'] = $id_os;
}

View File

@ -214,10 +214,33 @@ function get_table_inputs_masive_agents($params)
);
}
$table->data[3][0] = __('Agents');
$table->data[3][0] .= '<span id="agent_loading" class="invisible">';
$table->data[3][0] .= html_print_image('images/spinner.png', true);
$table->data[3][0] .= '</span>';
$os_list = os_get_os(true);
$table->data[3][0] = __('OS');
$table->data[3][1] = html_print_select(
$os_list,
'os_agent',
'selected',
'',
__('All'),
'',
true
);
$table->data[3][2] = __('OS Version');
$table->data[3][3] = html_print_input_text(
'os_agent_version',
'',
__('Select OS version'),
35,
255,
true
);
$table->data[4][0] = __('Agents');
$table->data[4][0] .= '<span id="agent_loading" class="invisible">';
$table->data[4][0] .= html_print_image('images/spinner.png', true);
$table->data[4][0] .= '</span>';
$agents = [];
if (is_metaconsole() === false) {
@ -228,7 +251,7 @@ function get_table_inputs_masive_agents($params)
);
}
$table->data[3][1] = html_print_select(
$table->data[4][1] = html_print_select(
$agents,
'id_agents[]',
0,

View File

@ -22,7 +22,9 @@
privilege: "",
serialized: false,
serialized_separator: "",
nodes: []
nodes: [],
id_os: -1,
os_agent_version: ""
};
/* public methods */
@ -53,7 +55,7 @@
} else {
recursion_value = config.recursion;
}
var opts = {
page: "godmode/groups/group_list",
get_group_agents: 1,
@ -74,7 +76,9 @@
nodes:
typeof config.nodes === "function"
? config.nodes()
: config.disabled
: config.disabled,
os_agent: config.os_agent,
os_agent_version: config.os_agent_version
};
jQuery.post(
@ -319,7 +323,6 @@
let href = $("a", config.spanPreview).attr("href");
let hrefPosition = href.search("group_id=");
let hrefNew = href.slice(0, hrefPosition) + "group_id=" + id_group;
jQuery.post(
"ajax.php",
{

View File

@ -110,6 +110,18 @@ function form_controls_massive_operations_agents(metaconsole) {
$("#id_group").trigger("change");
});
var os_agent;
$("#os_agent").change(function() {
os_agent = this.value;
$("#id_group").trigger("change");
});
var os_agent_version;
$("#text-os_agent_version").keyup(function() {
os_agent_version = this.value;
$("#id_group").trigger("change");
});
if (metaconsole == 1) {
$("#nodes").change(function() {
disabled = $("#disabled").val();
@ -142,6 +154,13 @@ function form_controls_massive_operations_agents(metaconsole) {
},
disabled: function() {
return disabled;
},
os_agent: function() {
return os_agent;
},
os_agent_version: function() {
console.log(os_agent_version);
return os_agent_version;
}
};