diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 1a7ce20d5d..b9e3db84a4 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -171,7 +171,7 @@ if (!$new_agent && $alias != '') { $table_agent_name = '

'.__('Agent name').': '.ui_print_help_tip(__("The agent's name must be the same as the one defined at the console"), true).'

'; $table_agent_name .= '
'; $table_agent_name .= '
'.html_print_input_text('agente', $nombre_agente, '', 50, 100, true).'
'; - $table_agent_name .= '
'; + $table_agent_name .= '
'; $table_qr_code = '

'.__('QR Code Agent view').':

'; @@ -188,8 +188,8 @@ if (!$new_agent && $alias != '') { ); $table_agent_name .= ''; } -} else { - $agent_info_new = 'agent_info_new'; + + $agent_options_update = 'agent_options_update'; } // Delete link from here. @@ -365,9 +365,9 @@ $table_description .= html_print_input_text( echo '
-
-
'.$table_agent_name.$table_alias.$table_ip.$table_primary_group.'
-
'.$table_interval.$table_os.$table_server.$table_description.'
+
+
'.$table_agent_name.$table_alias.$table_ip.$table_primary_group.'
+
'.$table_interval.$table_os.$table_server.$table_description.'
'; if (!$new_agent) { echo $table_qr_code; @@ -375,20 +375,10 @@ if (!$new_agent) { echo '
'; -$table = new stdClass(); -$table->width = '100%'; -$table->class = 'databox filters'; - -$table->head = []; -$table->style = []; -$table->style[0] = 'font-weight: bold; '; -$table->style[4] = 'font-weight: bold;'; -$table->data = []; - if (enterprise_installed()) { $secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$id_agente]); - $table->data['secondary_groups'][0] = __('Secondary groups').ui_print_help_icon('secondary_groups', true); - $table->data['secondary_groups'][1] = html_print_select_groups( + $table_adv_secondary_groups = '

'.__('Secondary groups').ui_print_help_icon('secondary_groups', true).'

'; + $table_adv_secondary_groups_left = html_print_select_groups( false, // Use the current user to select the groups 'AR', @@ -415,7 +405,7 @@ if (enterprise_installed()) { // CSS classnames (default) false, // Not disabled (default) - false, + 'width:50%; min-width:170px; text-align:center', // Inline styles (default) false, // Option style select (default) @@ -429,29 +419,31 @@ if (enterprise_installed()) { // Do not show the primary group in this selection ); - $table->data['secondary_groups'][2] = html_print_input_image( + $table_adv_secondary_groups_arrows = html_print_input_image( 'add_secondary', - 'images/darrowright.png', + 'images/darrowright_green.png', 1, '', true, [ + 'id' => 'right_autorefreshlist', 'title' => __('Add secondary groups'), 'onclick' => 'agent_manager_add_secondary_groups(event, '.$id_agente.');', ] - ).'



'.html_print_input_image( + ).html_print_input_image( 'remove_secondary', - 'images/darrowleft.png', + 'images/darrowleft_green.png', 1, '', true, [ + 'id' => 'left_autorefreshlist', 'title' => __('Remove secondary groups'), 'onclick' => 'agent_manager_remove_secondary_groups(event, '.$id_agente.');', ] ); - $table->data['secondary_groups'][3] = html_print_select( + $table_adv_secondary_groups_right .= html_print_select( $secondary_groups_selected['for_select'], // Values 'secondary_groups_selected', @@ -466,8 +458,16 @@ if (enterprise_installed()) { // Nothing selected true, // Return HTML (not echo) - true + true, // Multiple selection + true, + // Sort + '', + // Class + false, + // Disabled + 'width:50%; min-width:170px; text-align:center' + // Style ); // safe operation mode @@ -482,29 +482,29 @@ if (enterprise_installed()) { $safe_mode_modules[$m['id_module']] = $m['name']; } - $table->data[2][0] = __('Safe operation mode').ui_print_help_tip( + $table_adv_safe = '

'.__('Safe operation mode').ui_print_help_tip( __( 'This mode allow %s to disable all modules of this agent while the selected module is on CRITICAL status', get_product_name() ), true - ); - $table->data[2][1] = html_print_checkbox('safe_mode', 1, $safe_mode, true); - $table->data[2][1] .= '  '.__('Module').' '.html_print_select($safe_mode_modules, 'safe_mode_module', $safe_mode_module, '', '', 0, true); + ).'

'; + $table_adv_safe .= html_print_checkbox_switch('safe_mode', 1, $safe_mode, true); + $table_adv_safe .= __('Module').' '.html_print_select($safe_mode_modules, 'safe_mode_module', $safe_mode_module, '', '', 0, true).'
'; } // Remote configuration - $table->data[5][0] = __('Remote configuration'); + $table_adv_remote = '

'.__('Remote configuration').'

'; if (!$new_agent) { - $table->data[5][1] = ''.__('Not available').''; + $table_adv_remote .= ''.__('Not available').''; if (isset($filename)) { if (file_exists($filename['md5'])) { - $table->data[5][1] = date('F d Y H:i:s', fileatime($filename['md5'])); + $table_adv_remote .= date('F d Y H:i:s', fileatime($filename['md5'])); // Delete remote configuration - $table->data[5][1] .= ''; - $table->data[5][1] .= html_print_image( + $table_adv_remote .= ''; + $table_adv_remote .= html_print_image( 'images/cross.png', true, [ @@ -512,17 +512,17 @@ if (enterprise_installed()) { 'style' => 'vertical-align: middle;', ] ).''; - $table->data[5][1] .= ''.ui_print_help_tip( + $table_adv_remote .= ''.ui_print_help_tip( __('Delete this conf file implies that for restore you must reactive remote config in the local agent.'), true ); } } } else { - $table->data[5][1] = ''.__('Not available').''; + $table_adv_remote .= ''.__('Not available').''; } - + $table_adv_remote .= '
'; $cps_array[-1] = __('Disabled'); if ($cps > 0) { @@ -536,16 +536,16 @@ if (enterprise_installed()) { $cps_array[$cps_inc] = __('Enabled'); } - $table->data[6][0] = __('Cascade protection services'); - $table->data[6][0] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true); - $table->data[6][1] = html_print_select($cps_array, 'cps', $cps, '', '', 0, true); + $table_adv_cascade = '

'.__('Cascade protection services'); + $table_adv_cascade .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true).'

'; + $table_adv_cascade .= html_print_select($cps_array, 'cps', $cps, '', '', 0, true).'
'; } // Custom ID -$table->data[0][0] = __('Custom ID'); -$table->data[0][1] = html_print_input_text('custom_id', $custom_id, '', 16, 255, true); +$table_adv_custom_id = '

'.__('Custom ID').'

'; +$table_adv_custom_id .= html_print_input_text('custom_id', $custom_id, '', 16, 255, true).'
'; -$table->data[1][0] = __('Parent'); +$table_adv_parent = '

'.__('Parent').'

'; $params = []; $params['return'] = true; $params['show_helptip'] = true; @@ -557,75 +557,79 @@ $params['value'] = db_get_value('alias', 'tagente', 'id_agente', $id_parent); $params['selectbox_id'] = 'cascade_protection_module'; $params['javascript_is_function_select'] = true; $params['cascade_protection'] = true; - -$table->data[1][1] = ui_print_agent_autocomplete_input($params); +$table_adv_parent .= '
'; +$table_adv_parent .= ui_print_agent_autocomplete_input($params); if (enterprise_installed()) { - $table->data[1][1] .= html_print_checkbox('cascade_protection', 1, $cascade_protection, true).__('Cascade protection').' '.ui_print_help_icon('cascade_protection', true); + $table_adv_parent .= html_print_checkbox_switch('cascade_protection', 1, $cascade_protection, true).__('Cascade protection').' '.ui_print_help_icon('cascade_protection', true); } -$table->data[1][1] .= '  '.__('Module').' '.html_print_select($modules_values, 'cascade_protection_module', $cascade_protection_module, '', '', 0, true); +$table_adv_parent .= __('Module').' '.html_print_select($modules_values, 'cascade_protection_module', $cascade_protection_module, '', '', 0, true).'
'; + // Learn mode / Normal mode -$table->data[3][0] = __('Module definition').ui_print_help_icon('module_definition', true); -$table->data[3][1] = __('Learning mode').' '.html_print_radio_button_extended( +$table_adv_module_mode = '

'.__('Module definition').ui_print_help_icon('module_definition', true).'

'; +$table_adv_module_mode .= '
'; +$table_adv_module_mode .= html_print_radio_button_extended( 'modo', 1, - '', + __('Learning mode'), $modo, false, 'show_modules_not_learning_mode_context_help();', - 'style="margin-right: 40px;"', + '', true ); -$table->data[3][1] .= __('Normal mode').' '.html_print_radio_button_extended( +$table_adv_module_mode .= html_print_radio_button_extended( 'modo', 0, - '', + __('Normal mode'), $modo, false, 'show_modules_not_learning_mode_context_help();', - 'style="margin-right: 40px;"', + '', true ); -$table->data[3][1] .= __('Autodisable mode').' '.html_print_radio_button_extended( +$table_adv_module_mode .= html_print_radio_button_extended( 'modo', 2, - '', + __('Autodisable mode'), $modo, false, 'show_modules_not_learning_mode_context_help();', - 'style="margin-right: 40px;"', + '', true ); +$table_adv_module_mode .= '
'; // Status (Disabled / Enabled) -$table->data[4][0] = __('Status'); -$table->data[4][1] = __('Disabled').' '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).' '.html_print_radio_button_extended('disabled', 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true); -$table->data[4][1] .= __('Enabled').' '.html_print_radio_button_extended('disabled', 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true); +$table_adv_status = '

'.__('Disabled').ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).'

'; +$table_adv_status .= html_print_checkbox_switch('disabled', 1, $disabled, true).'
'; + +// Url address. if (enterprise_installed()) { - $table->data[4][2] = __('Url address').ui_print_help_tip(__('URL address must be complete, for example: https://pandorafms.com/'), true); - $table->data[4][3] = html_print_input_text( + $table_adv_url = '

'.__('Url address').ui_print_help_tip(__('URL address must be complete, for example: https://pandorafms.com/'), true).'

'; + $table_adv_url .= html_print_input_text( 'url_description', $url_description, '', 45, 255, true - ); + ).'
'; } else { - $table->data[5][0] = __('Url address'); - $table->data[5][1] = html_print_input_text( + $table_adv_url = '

'.__('Url address').'

'; + $table_adv_url .= html_print_input_text( 'url_description', $url_description, '', 45, 255, true - ); + ).'
'; } -$table->data[5][2] = __('Quiet'); -$table->data[5][3] .= ui_print_help_tip(__('The agent still runs but the alerts and events will be stop'), true); -$table->data[5][3] = html_print_checkbox('quiet', 1, $quiet, true); +$table_adv_quiet = '

'.__('Quiet'); +$table_adv_quiet .= ui_print_help_tip(__('The agent still runs but the alerts and events will be stop'), true).'

'; +$table_adv_quiet .= html_print_checkbox_switch('quiet', 1, $quiet, true).'
'; $listIcons = gis_get_array_list_icons(); @@ -636,7 +640,7 @@ foreach ($listIcons as $index => $value) { $path = 'images/gis_map/icons/'; // TODO set better method the path -$table->data[0][2] = __('Agent icon').ui_print_help_tip(__('Agent icon for GIS Maps.'), true); +$table_adv_agent_icon = '

'.__('Agent icon').ui_print_help_tip(__('Agent icon for GIS Maps.'), true).'

'; if ($icon_path == '') { $display_icons = 'none'; // Hack to show no icon. Use any given image to fix not found image errors @@ -654,7 +658,7 @@ if ($icon_path == '') { $path_warning = $path.$icon_path.'.warning.png'; } -$table->data[0][3] = html_print_select( +$table_adv_agent_icon .= html_print_select( $arraySelectIcon, 'icon_path', $icon_path, @@ -662,57 +666,60 @@ $table->data[0][3] = html_print_select( __('None'), '', true -).' '.html_print_image( +).html_print_image( $path_ok, true, [ 'id' => 'icon_ok', 'style' => 'display:'.$display_icons.';', ] -).' '.html_print_image( +).html_print_image( $path_bad, true, [ 'id' => 'icon_bad', 'style' => 'display:'.$display_icons.';', ] -).' '.html_print_image( +).html_print_image( $path_warning, true, [ 'id' => 'icon_warning', 'style' => 'display:'.$display_icons.';', ] -); +).'
'; if ($config['activate_gis']) { - $table->data[3][2] = __('Ignore new GIS data:'); - $table->data[3][3] = __('Yes').' '.html_print_radio_button_extended( - 'update_gis_data', - 0, - '', - $update_gis_data, - false, - '', - 'style="margin-right: 40px;"', - true - ); - $table->data[3][3] .= __('No').' '.html_print_radio_button_extended( - 'update_gis_data', - 1, - '', - $update_gis_data, - false, - '', - 'style="margin-right: 40px;"', - true - ); + $table_adv_gis = '

'.__('Ignore new GIS data:').'

'; + if ($new_agent) { + $update_gis_data = true; + } + + $table_adv_gis .= html_print_checkbox_switch('update_gis_data', 1, $update_gis_data, true).'No / Yes
'; } + + +$table_adv_options = $table_adv_secondary_groups.'
+
+ '.$table_adv_secondary_groups_left.' +
+
+ '.$table_adv_secondary_groups_arrows.' +
+
+ '.$table_adv_secondary_groups_right.' +
+
+
+
'.$table_adv_parent.$table_adv_custom_id.$table_adv_module_mode.$table_adv_cascade.$table_adv_gis.'
+
'.$table_adv_agent_icon.$table_adv_url.$table_adv_quiet.$table_adv_status.$table_adv_remote.$table_adv_safe.'
+
'; + echo '
'; -ui_toggle(html_print_table($table, true), __('Advanced options'), '', true, false, 'white_box white_box_opened'); + ui_toggle($table_adv_options, __('Advanced options'), '', true, false, 'white_box white_box_opened'); echo '
'; -unset($table); + $table = new stdClass(); $table->width = '100%'; @@ -816,16 +823,16 @@ foreach ($fields as $field) { if (!empty($fields)) { echo '
'; - ui_toggle(html_print_table($table, true), __('Custom fields'), '', true, false, 'white_box white_box_opened'); + ui_toggle(html_print_table($table, true), __('Custom fields'), '', true, false, 'white_box white_box_opened'); echo '
'; } -echo '
'; +echo '
'; // The context help about the learning mode. if ($modo == 0) { - echo ""; + echo ""; } else { echo "'; if ($id_agente) { - echo '
'; + echo '
'; html_print_submit_button( __('Update'), 'updbutton', @@ -913,7 +920,7 @@ ui_require_jquery_file('bgiframe'); function show_modules_not_learning_mode_context_help() { if ($("input[name='modo'][value=0]").is(':checked')) { - $("#modules_not_learning_mode_context_help").show(); + $("#modules_not_learning_mode_context_help").show().css('padding-right','8px'); } else { $("#modules_not_learning_mode_context_help").hide(); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index c646562ccf..c058422599 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -266,6 +266,38 @@ th { letter-spacing: 0.3pt; } +/* Remove background when autocomplete */ +input:-webkit-autofill, +input:-webkit-autofill:hover, +input:-webkit-autofill:focus textarea:-webkit-autofill, +textarea:-webkit-autofill:hover textarea:-webkit-autofill:focus, +select:-webkit-autofill, +select:-webkit-autofill:hover, +select:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0px 1000px #ffffff inset !important; +} + +/* All select type multiple */ +select[multiple] option:checked, +select[multiple] option:checked { + background: #82b92e linear-gradient(0deg, #82b92e 0%, #82b92e 100%); + color: #fff !important; +} + +select option:checked, +select option:checked { + background-color: #82b92e; + color: #fff !important; +} + +select > option:hover { + background-color: #cbcbcb; +} + +select:-internal-list-box { + border: none; +} + /* --- Font ttf --- */ @font-face { font-family: "DejaVuSerif-BoldFont"; @@ -4939,28 +4971,6 @@ input:checked + .p-slider:before { text-align: center; } -select#autorefresh_list_out[multiple] option:checked, -select#autorefresh_list[multiple] option:checked { - background: #82b92e linear-gradient(0deg, #82b92e 0%, #82b92e 100%); - color: #fff !important; -} - -select#autorefresh_list_out option:checked, -select#autorefresh_list option:checked { - background-color: #82b92e; - color: #fff !important; -} - -select#autorefresh_list_out > option:hover, -select#autorefresh_list > option:hover { - background-color: #cbcbcb; -} - -select#autorefresh_list_out:-internal-list-box, -select#autorefresh_list:-internal-list-box { - border: none; -} - .autorefresh_select .autorefresh_select_list_out, .autorefresh_select .autorefresh_select_list { width: 45%; @@ -5441,7 +5451,7 @@ table.info_table.policy_sub_table { /* * --------------------------------------------------------------------- - * - Create/Update Agent - agent_manager.php + * - Layout for the new forms * --------------------------------------------------------------------- */ .first_row { @@ -5449,44 +5459,21 @@ table.info_table.policy_sub_table { display: flex; } -.agent_info { - width: 85%; - margin-right: 20px; +.label_simple_one_item { display: flex; - flex-flow: row wrap; - flex-direction: row; - justify-content: space-between; - box-sizing: border-box; + align-items: flex-end; } -.agent_info_new { - width: 100%; - margin-right: 0; +.label_simple_items { + display: flex; + align-items: center; + flex-wrap: wrap; } -.agent_info_left { - width: 50%; - padding-right: 50px; - box-sizing: border-box; +.label_simple_items > * { + margin-right: 5px; } -.agent_info_right { - width: 50%; - box-sizing: border-box; -} - -.agent_qr { - width: 15%; - text-align: center; - box-sizing: border-box; - padding: 20px 0px; -} -/* -.agent_qr p { - text-align: left; -} -*/ - .input_label { color: #343434 !important; font-weight: bold; @@ -5494,28 +5481,10 @@ table.info_table.policy_sub_table { margin: 0px 0px 5px 0px; } -.agent_info_right select, -.agent_info_right input, -.agent_info_left select#grupo { - width: 95%; - box-sizing: border-box; -} - -.agent_info_left .p-switch { - margin-right: 5px; - margin-left: 10px; -} - -.agent_info_left input#text-direccion, -.agent_info_left select#address_list, -.agent_info_left input#text-agente, -.agent_info_left input#text-alias { - width: 100%; - box-sizing: border-box; -} - -.agent_info_agent_name > * { - margin-left: 5px; +.input_label_simple { + margin-bottom: 0; + margin-top: 0; + display: inline; } .label_select_parent { @@ -5526,11 +5495,12 @@ table.info_table.policy_sub_table { .label_select_child_left { width: 80%; + min-width: 100px; } .label_select_child_right { width: 20%; - min-width: 150px; + min-width: 140px; align-items: center; display: flex; } @@ -5541,6 +5511,88 @@ table.info_table.policy_sub_table { min-width: 30px; } +/* Inputs type text shown as a black line */ +.agent_options input[type="text"] { + background-color: transparent !important; + border: none; + border-radius: 0 !important; + border-bottom: 1px solid #343434; + padding: 2px 5px; + box-sizing: border-box; + background-repeat: no-repeat; + background-position: left bottom 2px; + margin-bottom: 4px; +} + +/* + * --------------------------------------------------------------------- + * - Create/Update Agent - agent_manager.php + * --------------------------------------------------------------------- + */ +.agent_options { + width: 100%; + margin-right: 0px; + display: flex; + flex-flow: row wrap; + flex-direction: row; + justify-content: space-between; + box-sizing: border-box; +} + +.agent_options_update { + width: 85%; + margin-right: 20px; +} + +.agent_options_column_left, +.agent_options_column_right { + width: 50%; + box-sizing: border-box; +} + +.agent_options_column_left { + padding-right: 50px; +} + +.agent_qr { + width: 15%; + text-align: center; + box-sizing: border-box; + padding: 20px 0px; + display: flex; + justify-content: center; + flex-direction: column; + min-width: 150px; +} + +a#qr_code_agent_view { + margin-top: 5px; +} + +.first_row .agent_options_column_right select, +.first_row .agent_options_column_right input, +.first_row .agent_options_column_left select#grupo { + width: 95%; + box-sizing: border-box; +} + +.first_row .agent_options_column_left .p-switch { + margin-right: 5px; + margin-left: 10px; +} + +.agent_options_column_left input#text-direccion, +.agent_options_column_left select#address_list, +.agent_options_column_left input#text-agente, +.agent_options_column_left input#text-alias { + width: 100%; + box-sizing: border-box; +} + +.agent_options_agent_name > * { + margin-left: 5px; +} + .custom_fields_table { border-spacing: 0px; } @@ -5578,6 +5630,53 @@ table.info_table.policy_sub_table { border-bottom-right-radius: 0px !important; } +.secondary_groups_select { + display: flex; + align-items: center; + justify-content: center; + margin-bottom: 15px; +} + +.secondary_groups_select .secondary_groups_select_arrows input { + display: grid; + margin: 0 auto; +} + +.secondary_groups_select .secondary_groups_list_left { + text-align: right; + width: 50%; +} + +.secondary_groups_select .secondary_groups_list_right { + text-align: left; + width: 50%; +} + +.secondary_groups_select .secondary_groups_select_arrows { + padding: 0 50px; +} + +.secondary_groups_select_arrows a { + display: block; +} + +.agent_options_adv .agent_options_column_right .label_select select, +.agent_options_adv .agent_options_column_right .label_select input[type="text"], +.agent_options_adv #text-custom_id, +.agent_options_adv #cps { + width: 100%; + box-sizing: border-box; +} + +.agent_options_adv .label_select_simple.label_simple_one_item .p-switch { + margin-right: 5px; +} + +/* + * --------------------------------------------------------------------- + * - CLASSES FOR THE NEW TOGGLES - + * --------------------------------------------------------------------- + */ .ui_toggle { margin-bottom: 20px; } @@ -5595,3 +5694,48 @@ table.info_table.policy_sub_table { border-top-left-radius: 0px; border-top-right-radius: 0px; } + +/* + * --------------------------------------------------------------------- + * - SWITCH RADIO BUTTONS - + * --------------------------------------------------------------------- + */ +.switch_radio_button { + display: flex; + overflow: hidden; +} + +.switch_radio_button input { + position: absolute !important; + clip: rect(0, 0, 0, 0); + height: 1px; + width: 1px; + border: 0; + overflow: hidden; +} + +.switch_radio_button label { + background-color: #fff; + color: rgba(0, 0, 0, 0.6); + line-height: 1; + text-align: center; + padding: 7px 14px; + margin-right: -1px; + border: 1px solid #cbcbcb; + border-radius: 4px; + transition: all 0.1s ease-in-out; +} + +.switch_radio_button label:hover { + cursor: pointer; +} + +.switch_radio_button input:checked + label { + background-color: #82b92e; + box-shadow: none; + color: #fff; +} + +.switch_radio_button label:last-child { + margin-right: 0px; +}