Merge branch 'ent-13182-fallo-de-interface-en-operaciones-masivas-agentes' into 'develop'

Ent 13182 fallo de interface en operaciones masivas agentes

See merge request artica/pandorafms!7072
This commit is contained in:
Rafael Ameijeiras 2024-03-27 08:41:17 +00:00
commit f95abfd722
3 changed files with 496 additions and 402 deletions

View File

@ -628,7 +628,7 @@ if (is_metaconsole() === true) {
$url = 'index.php?sec=advanced&sec2=advanced/massive_operations&tab=massive_agents&pure=0&option=edit_agents'; $url = 'index.php?sec=advanced&sec2=advanced/massive_operations&tab=massive_agents&pure=0&option=edit_agents';
} }
echo '<form method="post" autocomplete="off" id="form_agent" action="'.$url.'">'; echo '<form method="post" autocomplete="off" id="form_agent" class="form-agent-bulk-operation" action="'.$url.'">';
echo html_print_avoid_autocomplete(); echo html_print_avoid_autocomplete();
$params = [ $params = [
'id_group' => ($id_group ?? ''), 'id_group' => ($id_group ?? ''),
@ -651,14 +651,11 @@ echo '<div id="form_agents" style="display:none">';
$table = new StdClass(); $table = new StdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
$table->head = []; $table->head = [];
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bold; width: 150px;'; $table->size[0] = '50%';
$table->size[0] = '15%'; $table->size[1] = '50%';
$table->size[1] = '35%';
$table->size[2] = '15%';
$table->size[3] = '35%';
$table->data = []; $table->data = [];
@ -683,7 +680,6 @@ if (is_metaconsole() === false) {
$modules_values[$m['id_module']] = $m['name']; $modules_values[$m['id_module']] = $m['name'];
} }
$table->data[0][0] = __('Parent');
$params = []; $params = [];
$params['return'] = true; $params['return'] = true;
$params['show_helptip'] = true; $params['show_helptip'] = true;
@ -694,90 +690,107 @@ if (is_metaconsole() === false) {
$params['value'] = db_get_value('alias', 'tagente', 'id_agente', $id_parent); $params['value'] = db_get_value('alias', 'tagente', 'id_agente', $id_parent);
$params['selectbox_id'] = 'cascade_protection_module'; $params['selectbox_id'] = 'cascade_protection_module';
$params['javascript_is_function_select'] = true; $params['javascript_is_function_select'] = true;
$table->data[0][1] = ui_print_agent_autocomplete_input($params);
$table->data[0][1] .= '<b>'.__('Cascade protection').'</b>'; $table->data[0][0] = html_print_label_input_block(
$table->data[0][1] .= html_print_select( __('Parent'),
[ ui_print_agent_autocomplete_input($params)
1 => __('Yes'),
0 => __('No'),
],
'cascade_protection',
-1,
'',
__('No change'),
-1,
true
); );
$table->data[0][1] .= '&nbsp;&nbsp;'.__('Module').'&nbsp;';
$table->data[0][1] .= html_print_select( $table->data[0][1] = html_print_label_input_block(
($modules ?? ''), __('Cascade protection'),
'cascade_protection_module', '<div class="flex-row-center">'.html_print_select(
($cascade_protection_module ?? ''), [
'', 1 => __('Yes'),
'', 0 => __('No'),
0, ],
true 'cascade_protection',
-1,
'',
__('No change'),
-1,
true,
false,
true,
'w50p',
false,
'width: 48%;'
).'<div class="flex-row-center mrgn_lft_20px">'.__('Module').'&nbsp;&nbsp;&nbsp;'.html_print_select(
($modules ?? ''),
'cascade_protection_module',
($cascade_protection_module ?? ''),
'',
'',
0,
true,
false,
true,
'',
false,
'width: 100%;'
).'</div></div>'
); );
} }
$table->data[1][0] = __('Group'); $table->data[1][0] = html_print_label_input_block(
$table->data[1][1] = '<div class="w290px inline">'; __('Group'),
$table->data[1][1] .= html_print_select_groups( html_print_select_groups(
false, false,
'AR', 'AR',
false, false,
'group', 'group',
$group, $group,
'', '',
__('No change'), __('No change'),
-1, -1,
true, true,
false, false,
true, true,
'', '',
false, false
'width: 150px;' )
);
$table->data[1][1] .= '</div>';
$table->data[2][0] = __('Interval');
$table->data[2][1] = html_print_extended_select_for_time(
'interval',
-2,
'',
'',
'0',
10,
true,
'width: 150px',
false,
'',
false,
false,
'',
true
); );
$table->data[3][0] = __('OS'); $table->data[1][1] = html_print_label_input_block(
$table->data[3][1] = html_print_select_from_sql( __('Interval'),
'SELECT id_os, name FROM tconfig_os', html_print_extended_select_for_time(
'id_os', 'interval',
$id_os, -2,
'', '',
__('No change'), '',
-1, '0',
true, 10,
false, true,
true, false,
false, false,
'width: 105px;' '',
false,
false,
'',
true
)
);
$os_preview = ' <span id="os_preview" class="mrgn_lft_10px">';
$os_preview .= ui_print_os_icon($id_os, false, true);
$os_preview .= '</span>';
$table->data[2][0] = html_print_label_input_block(
__('OS'),
'<div class="flex-row-center">'.html_print_select_from_sql(
'SELECT id_os, name FROM tconfig_os',
'id_os',
$id_os,
'',
__('No change'),
-1,
true,
false,
true,
false,
'width: 100%;'
).$os_preview.'</div>'
); );
$table->data[3][1] .= ' <span id="os_preview">';
$table->data[3][1] .= ui_print_os_icon($id_os, false, true);
$table->data[3][1] .= '</span>';
// Network server. // Network server.
$none = ''; $none = '';
@ -785,31 +798,34 @@ if ($server_name == '' && $id_agente) {
$none = __('None'); $none = __('None');
} }
$table->data[4][0] = __('Server'); $table->data[2][1] = html_print_label_input_block(
$table->data[4][1] = html_print_select( __('Server'),
servers_get_names(), html_print_select(
'server_name', servers_get_names(),
$server_name, 'server_name',
'', $server_name,
__('No change'), '',
-1, __('No change'),
true, -1,
false, true,
true, false,
'', true,
false, '',
'width: 150px;' false
)
); );
// Description. // Description.
$table->data[5][0] = __('Description'); $table->data[3][0] = html_print_label_input_block(
$table->data[5][1] = html_print_input_text( __('Description'),
'description', html_print_input_text(
$description, 'description',
'', $description,
45, '',
255, 45,
true 255,
true
)
); );
html_print_table($table); html_print_table($table);
@ -827,12 +843,10 @@ $quiet_select = -1;
$table = new StdClass(); $table = new StdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
$table->size[0] = '15%'; $table->size[0] = '50%';
$table->size[1] = '35%'; $table->size[1] = '50%';
$table->size[2] = '15%';
$table->size[3] = '35%';
$table->head = []; $table->head = [];
$table->style = []; $table->style = [];
@ -840,76 +854,81 @@ $table->style[0] = 'font-weight: bold; width: 150px;';
$table->data = []; $table->data = [];
// Custom ID. // Custom ID.
$table->data[0][0] = __('Custom ID'); $table->data[0][0] = html_print_label_input_block(
$table->data[0][1] = html_print_input_text( __('Custom ID'),
'custom_id', html_print_input_text(
$custom_id, 'custom_id',
'', $custom_id,
16, '',
255, 16,
true 255,
true
)
); );
// Secondary Groups. // Secondary Groups.
if (enterprise_installed() === true) { if (enterprise_installed() === true) {
$groups = users_get_groups($config['id_user'], 'AW', false); $groups = users_get_groups($config['id_user'], 'AW', false);
$table->data['secondary_groups_added'][0] = __('Add secondary groups'); $table->data[1][0] = html_print_label_input_block(
$table->data['secondary_groups_added'][1] = html_print_select( __('Add secondary groups'),
$groups, html_print_select(
'secondary_groups_added[]', $groups,
0, 'secondary_groups_added[]',
false, 0,
'', false,
'', '',
true, '',
true, true,
true, true,
'', true,
false, '',
'min-width: 500px; max-width: 500px; max-height: 100px', false,
false, 'min-width: 500px; max-width: 500px; max-height: 100px',
false, false,
false, false,
'', false,
false, '',
false, false,
false, false,
false, false,
true, false,
true true,
true
)
); );
$table->data['secondary_groups_removed'][0] = __('Remove secondary groups'); $table->data[1][1] = html_print_label_input_block(
$table->data['secondary_groups_removed'][1] = html_print_select( __('Remove secondary groups'),
$groups, html_print_select(
'secondary_groups_removed[]', $groups,
0, 'secondary_groups_removed[]',
false, 0,
'', false,
'', '',
true, '',
true, true,
true, true,
'', true,
false, '',
'min-width: 500px; max-width: 500px; max-height: 100px', false,
false, 'min-width: 500px; max-width: 500px; max-height: 100px',
false, false,
false, false,
'', false,
false, '',
false, false,
false, false,
false, false,
true, false,
true true,
true
)
); );
} }
// Learn mode / Normal mode. // Learn mode / Normal mode.
$table->data[1][0] = __('Module definition'); $module_definition = __('No change').' ';
$table->data[1][1] = __('No change').' '; $module_definition .= html_print_radio_button_extended(
$table->data[1][1] .= html_print_radio_button_extended(
'mode', 'mode',
-1, -1,
'', '',
@ -919,8 +938,8 @@ $table->data[1][1] .= html_print_radio_button_extended(
'class="mrgn_right_40px"', 'class="mrgn_right_40px"',
true true
); );
$table->data[1][1] .= __('Learning mode').' '; $module_definition .= __('Learning mode').' ';
$table->data[1][1] .= html_print_radio_button_extended( $module_definition .= html_print_radio_button_extended(
'mode', 'mode',
1, 1,
'', '',
@ -930,8 +949,8 @@ $table->data[1][1] .= html_print_radio_button_extended(
'class="mrgn_right_40px"', 'class="mrgn_right_40px"',
true true
); );
$table->data[1][1] .= __('Normal mode').' '; $module_definition .= __('Normal mode').' ';
$table->data[1][1] .= html_print_radio_button_extended( $module_definition .= html_print_radio_button_extended(
'mode', 'mode',
0, 0,
'', '',
@ -941,8 +960,8 @@ $table->data[1][1] .= html_print_radio_button_extended(
'class="mrgn_right_40px"', 'class="mrgn_right_40px"',
true true
); );
$table->data[1][1] .= __('Autodisable mode').' '; $module_definition .= __('Autodisable mode').' ';
$table->data[1][1] .= html_print_radio_button_extended( $module_definition .= html_print_radio_button_extended(
'mode', 'mode',
2, 2,
'', '',
@ -953,10 +972,14 @@ $table->data[1][1] .= html_print_radio_button_extended(
true true
); );
$table->data[2][0] = html_print_label_input_block(
__('Module definition'),
'<div class="flex-row-center">'.$module_definition.'</div>'
);
// Status (Disabled / Enabled). // Status (Disabled / Enabled).
$table->data[2][0] = __('Status'); $status_item = __('No change').' ';
$table->data[2][1] = __('No change').' '; $status_item .= html_print_radio_button_extended(
$table->data[2][1] .= html_print_radio_button_extended(
'disabled', 'disabled',
-1, -1,
'', '',
@ -966,12 +989,12 @@ $table->data[2][1] .= html_print_radio_button_extended(
'class="mrgn_right_40px"', 'class="mrgn_right_40px"',
true true
); );
$table->data[2][1] .= __('Disabled').' '; $status_item .= __('Disabled').' ';
$table->data[2][1] .= ui_print_help_tip( $status_item .= ui_print_help_tip(
__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), __('If the remote configuration is enabled, it will also go into standby mode when disabling it.'),
true true
).' '; ).' ';
$table->data[2][1] .= html_print_radio_button_extended( $status_item .= html_print_radio_button_extended(
'disabled', 'disabled',
1, 1,
'', '',
@ -981,8 +1004,8 @@ $table->data[2][1] .= html_print_radio_button_extended(
'class="mrgn_right_40px"', 'class="mrgn_right_40px"',
true true
); );
$table->data[2][1] .= __('Active').' '; $status_item .= __('Active').' ';
$table->data[2][1] .= html_print_radio_button_extended( $status_item .= html_print_radio_button_extended(
'disabled', 'disabled',
0, 0,
'', '',
@ -993,15 +1016,19 @@ $table->data[2][1] .= html_print_radio_button_extended(
true true
); );
$table->data[2][1] = html_print_label_input_block(
__('Status'),
'<div class="flex-row-center">'.$status_item.'</div>'
);
// Remote configuration. // Remote configuration.
$table->data[3][0] = __('Remote configuration');
// Delete remote configuration. // Delete remote configuration.
$table->data[3][1] = '<div id="delete_configurations" class="invisible">'; $remote_config = '<div id="delete_configurations" class="invisible">';
$table->data[3][1] .= __('Delete available remote configurations'); $remote_config .= __('Delete available remote configurations');
$table->data[3][1] .= ' ('; $remote_config .= ' (';
$table->data[3][1] .= '<span id="n_configurations"></span>'; $remote_config .= '<span id="n_configurations"></span>';
$table->data[3][1] .= ') '; $remote_config .= ') ';
$table->data[3][1] .= html_print_checkbox_extended( $remote_config .= html_print_checkbox_extended(
'delete_conf', 'delete_conf',
1, 1,
0, 0,
@ -1010,11 +1037,16 @@ $table->data[3][1] .= html_print_checkbox_extended(
'class="mrgn_right_40px"', 'class="mrgn_right_40px"',
true true
); );
$table->data[3][1] .= '</div>'; $remote_config .= '</div>';
$table->data[3][1] .= '<div id="not_available_configurations" class="invisible"><em>'; $remote_config .= '<div id="not_available_configurations" class="invisible"><em>';
$table->data[3][1] .= __('Not available'); $remote_config .= __('Not available');
$table->data[3][1] .= '</em></div>'; $remote_config .= '</em></div>';
$table->data[3][0] = html_print_label_input_block(
__('Remote configuration'),
'<div class="flex-row-center">'.$remote_config.'</div>'
);
$listIcons = gis_get_array_list_icons(); $listIcons = gis_get_array_list_icons();
@ -1042,8 +1074,7 @@ if ($icon_path == '') {
$path_warning = $path.$icon_path.'.warning.png'; $path_warning = $path.$icon_path.'.warning.png';
} }
$table->data[4][0] = __('Agent icon'); $agent_icon = html_print_select(
$table->data[4][1] = html_print_select(
$arraySelectIcon, $arraySelectIcon,
'icon_path', 'icon_path',
$icon_path, $icon_path,
@ -1052,9 +1083,9 @@ $table->data[4][1] = html_print_select(
'', '',
true true
); );
$table->data[4][1] .= '&nbsp;'; $agent_icon .= '&nbsp;';
$table->data[4][1] .= __('Without status').': '; $agent_icon .= __('Without status').': ';
$table->data[4][1] .= html_print_image( $agent_icon .= html_print_image(
$path_without, $path_without,
true, true,
[ [
@ -1062,8 +1093,8 @@ $table->data[4][1] .= html_print_image(
'style' => 'display:'.$display_icons.';', 'style' => 'display:'.$display_icons.';',
] ]
); );
$table->data[4][1] .= '&nbsp;'.__('Default').': '; $agent_icon .= '&nbsp;'.__('Default').': ';
$table->data[4][1] .= html_print_image( $agent_icon .= html_print_image(
$path_default, $path_default,
true, true,
[ [
@ -1071,8 +1102,8 @@ $table->data[4][1] .= html_print_image(
'style' => 'display:'.$display_icons.';', 'style' => 'display:'.$display_icons.';',
] ]
); );
$table->data[4][1] .= '&nbsp;'.__('Ok').': '; $agent_icon .= '&nbsp;'.__('Ok').': ';
$table->data[4][1] .= html_print_image( $agent_icon .= html_print_image(
$path_ok, $path_ok,
true, true,
[ [
@ -1080,8 +1111,8 @@ $table->data[4][1] .= html_print_image(
'style' => 'display:'.$display_icons.';', 'style' => 'display:'.$display_icons.';',
] ]
); );
$table->data[4][1] .= '&nbsp;'.__('Bad').': '; $agent_icon .= '&nbsp;'.__('Bad').': ';
$table->data[4][1] .= html_print_image( $agent_icon .= html_print_image(
$path_bad, $path_bad,
true, true,
[ [
@ -1089,8 +1120,8 @@ $table->data[4][1] .= html_print_image(
'style' => 'display:'.$display_icons.';', 'style' => 'display:'.$display_icons.';',
] ]
); );
$table->data[4][1] .= '&nbsp;'.__('Warning').': '; $agent_icon .= '&nbsp;'.__('Warning').': ';
$table->data[4][1] .= html_print_image( $agent_icon .= html_print_image(
$path_warning, $path_warning,
true, true,
[ [
@ -1099,10 +1130,14 @@ $table->data[4][1] .= html_print_image(
] ]
); );
$table->data[3][1] = html_print_label_input_block(
__('Agent icon'),
'<div class="flex-row-center">'.$agent_icon.'</div>'
);
if ($config['activate_gis']) { if ($config['activate_gis']) {
$table->data[5][0] = __('Ignore new GIS data:'); $ignore_gis = __('No change').' ';
$table->data[5][1] = __('No change').' '; $ignore_gis .= html_print_radio_button_extended(
$table->data[5][1] .= html_print_radio_button_extended(
'update_gis_data', 'update_gis_data',
-1, -1,
'', '',
@ -1112,8 +1147,8 @@ if ($config['activate_gis']) {
'class="mrgn_right_40px"', 'class="mrgn_right_40px"',
true true
); );
$table->data[5][1] .= __('Yes').' '; $ignore_gis .= __('Yes').' ';
$table->data[5][1] .= html_print_radio_button_extended( $ignore_gis .= html_print_radio_button_extended(
'update_gis_data', 'update_gis_data',
0, 0,
'', '',
@ -1123,8 +1158,8 @@ if ($config['activate_gis']) {
'class="mrgn_right_40px"', 'class="mrgn_right_40px"',
true true
); );
$table->data[5][1] .= __('No').' '; $ignore_gis .= __('No').' ';
$table->data[5][1] .= html_print_radio_button_extended( $ignore_gis .= html_print_radio_button_extended(
'update_gis_data', 'update_gis_data',
1, 1,
'', '',
@ -1134,74 +1169,82 @@ if ($config['activate_gis']) {
'class="mrgn_right_40px"', 'class="mrgn_right_40px"',
true true
); );
$table->data[4][0] = html_print_label_input_block(
__('Ignore new GIS data:'),
'<div class="flex-row-center">'.$ignore_gis.'</div>'
);
} }
$table->data[6][0] = __('Quiet');
$table->data[6][0] .= ui_print_help_tip(
__('The agent still runs but the alerts and events will be stop'),
true
);
$table->data[6][1] = html_print_select(
[
-1 => __('No change'),
1 => __('Yes'),
0 => __('No'),
],
'quiet_select',
$quiet_select,
'',
'',
0,
true
);
$table->data[7][0] = __('Safe operation mode').': '.ui_print_help_tip( $table->data[5][0] = html_print_label_input_block(
__( __('Quiet:').ui_print_help_tip(
'This mode allow %s to disable all modules of this agent while the selected module is on CRITICAL status', __('The agent still runs but the alerts and events will be stop'),
get_product_name() true
), ),
true html_print_select(
); [
$table->data[7][1] = html_print_select( -1 => __('No change'),
[ 1 => __('Yes'),
1 => __('Enabled'), 0 => __('No'),
0 => __('Disabled'), ],
], 'quiet_select',
'safe_mode_change', $quiet_select,
-1, '',
'', '',
__('No change'), 0,
-1, true
true )
).'&nbsp;';
$table->data[7][1] .= __('Module').'&nbsp;';
$table->data[7][1] .= html_print_select(
'',
'safe_mode_module',
'',
'',
__('Any'),
-1,
true
); );
$table->data[8][0] = __('Ignore unknown').ui_print_help_tip(_('This disables the calculation of the unknown state in the agent and any of its modules, so it will never transition to unknown. The state it reflects is the last known status.'), true); $table->data[5][1] = html_print_label_input_block(
$table->data[8][1] = html_print_select( __('Safe operation mode').': '.ui_print_help_tip(
[ __(
'' => __('No change'), 'This mode allow %s to disable all modules of this agent while the selected module is on CRITICAL status',
'1' => __('Yes'), get_product_name()
'0' => __('No'), ),
], true
'ignore_unknown', ),
'', '<div class="flex-row-center">'.html_print_select(
'', [
'', 1 => __('Enabled'),
'', 0 => __('Disabled'),
true, ],
false, 'safe_mode_change',
false, -1,
'w100p' '',
__('No change'),
-1,
true
).'<div class="flex-row-center mrgn_lft_20px">'.__('Module').'&nbsp;&nbsp;&nbsp;'.html_print_select(
'',
'safe_mode_module',
'',
'',
__('Any'),
-1,
true
).'</div></div>'
);
$table->data[6][0] = html_print_label_input_block(
__('Ignore unknown').ui_print_help_tip(_('This disables the calculation of the unknown state in the agent and any of its modules, so it will never transition to unknown. The state it reflects is the last known status.'), true),
html_print_select(
[
'' => __('No change'),
'1' => __('Yes'),
'0' => __('No'),
],
'ignore_unknown',
'',
'',
'',
'',
true,
false,
false,
'w100p'
)
); );
ui_toggle(html_print_table($table, true), __('Advanced options')); ui_toggle(html_print_table($table, true), __('Advanced options'));
@ -1209,16 +1252,13 @@ unset($table);
$table = new StdClass(); $table = new StdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
$table->head = []; $table->head = [];
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bold; width: 150px;';
$table->data = []; $table->data = [];
$table->size[0] = '15%'; $table->size[0] = '50%';
$table->size[1] = '35%'; $table->size[1] = '50%';
$table->size[2] = '15%';
$table->size[3] = '35%';
$fields = db_get_all_fields_in_table('tagent_custom_fields'); $fields = db_get_all_fields_in_table('tagent_custom_fields');
@ -1226,6 +1266,8 @@ if ($fields === false) {
$fields = []; $fields = [];
} }
$row = 0;
$col = 0;
foreach ($fields as $field) { foreach ($fields as $field) {
$data[0] = '<b>'.$field['name'].'</b>'; $data[0] = '<b>'.$field['name'].'</b>';
$combo = []; $combo = [];
@ -1270,7 +1312,7 @@ foreach ($fields as $field) {
2, 2,
65, 65,
$custom_value, $custom_value,
'class="mrgn_right_30px"', 'class=""',
true true
); );
} }
@ -1290,7 +1332,20 @@ foreach ($fields as $field) {
); );
}; };
array_push($table->data, $data); $output = html_print_label_input_block(
$data[0],
$data[1]
);
// array_push($table->data, $output);
$table->data[$row][$col] = $output;
if ($col === 1) {
$col = 0;
$row++;
} else {
$col++;
}
} }
if (empty($fields) === false) { if (empty($fields) === false) {

View File

@ -1010,6 +1010,10 @@ function html_print_select(
ui_require_javascript_file('select2.min'); ui_require_javascript_file('select2.min');
} }
if ($placeholder === '' && $select2_multiple_enable === true) {
$placeholder = __('Select one or more elements');
}
$output .= '<script type="text/javascript">'; $output .= '<script type="text/javascript">';
$output .= '$("#'.$id.'").select2({ $output .= '$("#'.$id.'").select2({
closeOnSelect: '.(($select2_multiple_enable === true) ? 'false' : 'true').', closeOnSelect: '.(($select2_multiple_enable === true) ? 'false' : 'true').',

View File

@ -108,38 +108,46 @@ function get_table_inputs_masive_agents($params)
$table = new stdClass; $table = new stdClass;
$table->id = 'delete_table'; $table->id = 'delete_table';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
$table->width = '100%'; $table->width = '100%';
$table->data = []; $table->data = [];
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bold;'; $table->style[0] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold'; $table->style[2] = 'font-weight: bold';
$table->size = []; $table->size = [];
$table->size[0] = '15%'; $table->size[0] = '50%';
$table->size[1] = '35%'; $table->size[1] = '50%';
$table->size[2] = '15%';
$table->size[3] = '35%';
$table->data = []; $table->data = [];
$table->data[0][0] = __('Group'); $table->data[0][0] = html_print_label_input_block(
$table->data[0][1] = html_print_select_groups( __('Group'),
false, html_print_select_groups(
'AW', false,
true, 'AW',
'id_group', true,
$params['id_group'], 'id_group',
false, $params['id_group'],
'', false,
'', '',
true '',
true,
false,
false,
'',
false,
'width:100%; max-width: 420px;'
)
); );
$table->data[0][2] = __('Group recursion');
$table->data[0][3] = html_print_checkbox( $table->data[0][1] = html_print_label_input_block(
'recursion', __('Group recursion'),
1, html_print_checkbox(
$params['recursion'], 'recursion',
true, 1,
false $params['recursion'],
true,
false
)
); );
$status_list = []; $status_list = [];
@ -149,34 +157,43 @@ function get_table_inputs_masive_agents($params)
$status_list[AGENT_STATUS_UNKNOWN] = __('Unknown'); $status_list[AGENT_STATUS_UNKNOWN] = __('Unknown');
$status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal'); $status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
$status_list[AGENT_STATUS_NOT_INIT] = __('Not init'); $status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
$table->data[1][0] = __('Status'); $table->data[1][0] = html_print_label_input_block(
$table->data[1][1] = html_print_select( __('Status'),
$status_list, html_print_select(
'status_agents', $status_list,
'selected', 'status_agents',
'', 'selected',
__('All'), '',
AGENT_STATUS_ALL, __('All'),
true AGENT_STATUS_ALL,
true,
false,
true,
'',
false,
'width:100%; max-width: 420px;'
)
); );
$table->data[1][2] = __('Show agents'); $table->data[1][1] = html_print_label_input_block(
$table->data[1][3] = html_print_select( __('Show agents'),
[ html_print_select(
0 => 'Only enabled', [
1 => 'Only disabled', 0 => 'Only enabled',
], 1 => 'Only disabled',
'disabled', ],
2, 'disabled',
'', 2,
__('All'), '',
2, __('All'),
true, 2,
false, true,
true, false,
'', true,
false, '',
'width:30%;' false,
'width:100%; max-width: 420px;'
)
); );
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
@ -186,10 +203,91 @@ function get_table_inputs_masive_agents($params)
$server_fields[$key] = $server['server_name']; $server_fields[$key] = $server['server_name'];
} }
$table->data[2][2] = __('Node'); $table->data[2][0] = html_print_label_input_block(
$table->data[2][3] = html_print_select( __('Node'),
$server_fields, html_print_select(
'nodes[]', $server_fields,
'nodes[]',
0,
false,
'',
'',
true,
true,
true,
'',
false,
'width:100%; max-width: 420px; max-height: 100px',
false,
false,
false,
'',
false,
false,
false,
false,
true,
true,
true
)
);
}
$os_list = os_get_os(true);
$table->data[3][0] = html_print_label_input_block(
__('OS'),
html_print_select(
$os_list,
'os_agent',
'selected',
'',
__('All'),
'',
true,
false,
true,
'',
false,
'width:100%; max-width: 420px;'
)
);
$table->data[3][1] = html_print_label_input_block(
__('OS Version'),
html_print_input_text(
'os_agent_version',
'',
__('Select OS version'),
35,
255,
true,
false,
false,
'',
'w100p'
)
);
$label_agents = __('Agents');
$label_agents .= '<span id="agent_loading" class="invisible">';
$label_agents .= html_print_image('images/spinner.png', true);
$label_agents .= '</span>';
$agents = [];
if (is_metaconsole() === false) {
$agents = agents_get_group_agents(
array_keys(users_get_groups($config['id_user'], 'AW', false)),
['disabled' => 2],
'none'
);
}
$table->data[4][0] = html_print_label_input_block(
$label_agents,
html_print_select(
$agents,
'id_agents[]',
0, 0,
false, false,
'', '',
@ -199,7 +297,7 @@ function get_table_inputs_masive_agents($params)
true, true,
'', '',
false, false,
'min-width: 500px; max-width: 500px; max-height: 100px', 'width: 100%; max-height: 100px',
false, false,
false, false,
false, false,
@ -211,70 +309,7 @@ function get_table_inputs_masive_agents($params)
true, true,
true, true,
true true
); )
}
$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) {
$agents = agents_get_group_agents(
array_keys(users_get_groups($config['id_user'], 'AW', false)),
['disabled' => 2],
'none'
);
}
$table->data[4][1] = html_print_select(
$agents,
'id_agents[]',
0,
false,
'',
'',
true,
true,
true,
'',
false,
'min-width: 500px; max-width: 500px; max-height: 100px',
false,
false,
false,
'',
false,
false,
false,
false,
true,
true,
true
); );
$output = html_print_table($table, true); $output = html_print_table($table, true);