Agent module manager fixed and improve action buttons

This commit is contained in:
Jose Gonzalez 2023-01-17 15:21:07 +01:00
parent 8c852fb3df
commit 8c1bd2c1ee
2 changed files with 440 additions and 437 deletions

View File

@ -757,121 +757,117 @@ $total_modules = db_get_value_sql($sql_total_modules);
$total_modules = (isset($total_modules) === true) ? $total_modules : 0;
if ($modules === false) {
ui_print_empty_data(__('No available data to show'));
return;
}
// Prepare pagination.
$url = sprintf(
if ($modules !== false) {
// Prepare pagination.
$url = sprintf(
'?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente=%s&sort_field=%s&sort=%s&search_string=%s',
$id_agente,
$sortField,
$sort,
urlencode($search_string)
);
);
if ($paginate_module === true) {
if ($paginate_module === true) {
ui_pagination($total_modules, $url);
}
}
$url_name = $url.'&sort_field=name&sort=';
$url_server = $url.'&sort_field=server&sort=';
$url_type = $url.'&sort_field=type&sort=';
$url_interval = $url.'&sort_field=interval&sort=';
$url_name = $url.'&sort_field=name&sort=';
$url_server = $url.'&sort_field=server&sort=';
$url_type = $url.'&sort_field=type&sort=';
$url_interval = $url.'&sort_field=interval&sort=';
$table = new stdClass();
$table->width = '100%';
$table->class = 'tactical_table info_table';
$table->head = [];
$table->head['checkbox'] = html_print_checkbox(
$table = new stdClass();
$table->width = '100%';
$table->class = 'tactical_table info_table';
$table->head = [];
$table->head['checkbox'] = html_print_checkbox(
'all_delete',
0,
false,
true,
false
);
$table->head[0] = '<span>'.__('Name').'</span>'.ui_get_sorting_arrows(
);
$table->head[0] = '<span>'.__('Name').'</span>'.ui_get_sorting_arrows(
$url_name.'up',
$url_name.'down',
$selectNameUp,
$selectNameDown
);
);
// The access to the policy is granted only with AW permission.
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && (bool) check_acl(
// The access to the policy is granted only with AW permission.
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && (bool) check_acl(
$config['id_user'],
$agent['id_grupo'],
'AW'
) === true
) {
) === true
) {
$table->head[1] = "<span title='".__('Policy')."'>".__('P').'</span>';
$table->headstyle[1] = 'width: 4%';
}
}
$table->head[2] = '<span title=\''.__('Server').'\'>'.__('S').'</span>'.ui_get_sorting_arrows(
$table->head[2] = '<span title=\''.__('Server').'\'>'.__('S').'</span>'.ui_get_sorting_arrows(
$url_server.'up',
$url_server.'down',
$selectServerUp,
$selectServerDown
);
$table->headstyle[2] = 'width: 8%';
$table->head[3] = '<span>'.__('Type').'</span>'.ui_get_sorting_arrows(
);
$table->headstyle[2] = 'width: 8%';
$table->head[3] = '<span>'.__('Type').'</span>'.ui_get_sorting_arrows(
$url_type.'up',
$url_type.'down',
$selectTypeUp,
$selectTypeDown
);
$table->headstyle[3] = 'width: 10%';
$table->head[4] = '<span>'.__('Interval').'</span>'.ui_get_sorting_arrows(
);
$table->headstyle[3] = 'width: 10%';
$table->head[4] = '<span>'.__('Interval').'</span>'.ui_get_sorting_arrows(
$url_interval.'up',
$url_interval.'down',
$selectIntervalUp,
$selectIntervalDown
);
$table->headstyle[4] = 'width: 100px';
$table->head[5] = '<span>'.__('Description').'</span>';
$table->head[6] = '<span>'.__('Status').'</span>';
$table->head[7] = '<span>'.__('Warn').'</span>';
$table->head[8] = '<span>'.__('Action').'</span>';
$table->headstyle[8] = 'width: 15%';
);
$table->headstyle[4] = 'width: 100px';
$table->head[5] = '<span>'.__('Description').'</span>';
$table->head[6] = '<span>'.__('Status').'</span>';
$table->head[7] = '<span>'.__('Warn').'</span>';
$table->head[8] = '<span>'.__('Action').'</span>';
$table->headstyle[8] = 'width: 15%';
$table->rowstyle = [];
$table->style = [];
$table->style[0] = 'font-weight: bold';
$table->size = [];
$table->size['checkbox'] = '20px';
$table->size[2] = '70px';
$table->align = [];
$table->align[2] = 'left';
$table->align[8] = 'left';
$table->align[9] = 'left';
$table->data = [];
$table->rowstyle = [];
$table->style = [];
$table->style[0] = 'font-weight: bold';
$table->size = [];
$table->size['checkbox'] = '20px';
$table->size[2] = '70px';
$table->align = [];
$table->align[2] = 'left';
$table->align[8] = 'left';
$table->align[9] = 'left';
$table->data = [];
$agent_interval = agents_get_interval($id_agente);
$last_modulegroup = '0';
$agent_interval = agents_get_interval($id_agente);
$last_modulegroup = '0';
// Extract the ids only numeric modules for after show the normalize link.
$tempRows = db_get_all_rows_sql(
// Extract the ids only numeric modules for after show the normalize link.
$tempRows = db_get_all_rows_sql(
"SELECT *
FROM ttipo_modulo
WHERE nombre NOT LIKE '%string%' AND nombre NOT LIKE '%proc%'"
);
$numericModules = [];
foreach ($tempRows as $row) {
);
$numericModules = [];
foreach ($tempRows as $row) {
$numericModules[$row['id_tipo']] = true;
}
}
if ($checked === true) {
if ($checked === true) {
$modules_hierachy = [];
$modules_hierachy = get_hierachy_modules_tree($modules);
$modules_dt = get_dt_from_modules_tree($modules_hierachy);
$modules = $modules_dt;
}
}
foreach ($modules as $module) {
foreach ($modules as $module) {
if (! check_acl_one_of_groups(
$config['id_user'],
$all_groups,
@ -1196,14 +1192,18 @@ foreach ($modules as $module) {
$table->cellclass[] = [8 => 'table_action_buttons'];
array_push($table->data, $data);
$table->cellclass[] = [8 => 'table_action_buttons'];
}
}
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) {
echo '<form class="datatable_form" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module"
onsubmit="if (! confirm (\''.__('Are you sure?').'\')) return false">';
}
}
html_print_table($table);
// Print module table.
html_print_table($table);
} else {
ui_print_empty_data(__('No available data to show'));
}
if ((bool) check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) {
html_print_input_hidden('submit_modules_action', 1);
@ -1217,6 +1217,7 @@ if ((bool) check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === tr
true
);
if ($modules !== false) {
$actionButtons .= html_print_submit_button(
__('Execute action'),
'submit_modules_action',
@ -1246,6 +1247,7 @@ if ((bool) check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === tr
false,
'width: 260px;',
);
}
html_print_action_buttons(
$actionButtons,

View File

@ -10691,8 +10691,9 @@ tr.bring_next_field {
}
.fixed_action_buttons_size {
/*width: 1064px;*/
width: 1116px;
width: -webkit-fill-available;
width: -moz-fill-available;
margin-right: 20px;
}
.action_buttons_background_mask {