minor changes

This commit is contained in:
alejandro.campos@artica.es 2023-10-02 16:42:32 +02:00
parent 70ad1ea986
commit 0771094e85
3 changed files with 12 additions and 2 deletions

View File

@ -108,7 +108,7 @@ html_print_action_buttons(
echo '</form>';
echo '<form id="redirect-form" method="post" action="index.php?sec=view&sec2=operation/agentes/estado_agente">';
html_print_input_hidden('os_type_regex', '');
html_print_input_hidden('os_version_regex', '');
echo '</form>';
@ -129,6 +129,8 @@ echo '</form>';
item.options += '" ><?php echo html_print_image('images/edit.svg', true, ['title' => __('Edit'), 'class' => 'main_menu_icon invert_filter']); ?></a>';
item.options += '<a href="javascript:" onclick="redirect_to_agents_by_version(\'';
item.options += item.product;
item.options += '\',\'';
item.options += item.version;
item.options += '\')" ><?php echo html_print_image('images/agents.svg', true, ['title' => __('Show agents'), 'class' => 'main_menu_icon invert_filter']); ?></a>';
@ -140,7 +142,8 @@ echo '</form>';
item.options += '<form method="post" action="?sec=view&sec2=operation/agentes/estado_agente"></form>';
}
function redirect_to_agents_by_version(version) {
function redirect_to_agents_by_version(product, version) {
$('#hidden-os_type_regex').val(product);
$('#hidden-os_version_regex').val(version);
$('#redirect-form').submit();
}

View File

@ -1528,6 +1528,7 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3)
$learningMode = $other['data'][10];
$disabled = $other['data'][11];
$description = $other['data'][12];
$osVersion = $other['data'][13];
// Check parameters.
if ($idGroup == 0) {
@ -1623,6 +1624,7 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3)
'server_name' => $nameServer,
'id_parent' => $idParent,
'custom_id' => $customId,
'os_version' => $osVersion,
],
['id_agente' => $id_agent]
);

View File

@ -170,6 +170,7 @@ $recursion = get_parameter('recursion', 0);
$status = (int) get_parameter('status', -1);
$os = (int) get_parameter('os', 0);
$os_version_regex = trim(get_parameter('os_version_regex', ''));
$os_type_regex = trim(get_parameter('os_type_regex', ''));
$policies = (array) get_parameter('policies', []);
$ag_custom_fields = (array) get_parameter('ag_custom_fields', []);
@ -182,6 +183,10 @@ $onheader = [];
$load_filter_id = (int) get_parameter('filter_id', 0);
if (empty($os_type_regex) !== true) {
$os = (int) db_get_value_sql('SELECT id_os FROM tconfig_os WHERE `name` REGEXP "'.$os_type_regex.'"');
}
if ($load_filter_id > 0) {
$user_groups_fl = users_get_groups(
$config['id_user'],