From bf678b55dc9779d47fb8af0f1f119ea79197dece Mon Sep 17 00:00:00 2001 From: "jose.gonzalez@pandorafms.com" Date: Fri, 11 Nov 2022 16:15:17 +0100 Subject: [PATCH] Several views updated --- .../godmode/agentes/agent_manager.php | 363 ++++++++++++------ .../godmode/agentes/configurar_agente.php | 2 +- .../godmode/agentes/modificar_agente.php | 4 +- .../godmode/agentes/module_manager_editor.php | 40 +- .../agentes/module_manager_editor_common.php | 217 ++++++----- .../godmode/alerts/alert_list.builder.php | 32 +- pandora_console/include/functions_ui.php | 26 +- pandora_console/include/styles/dashboards.css | 4 - pandora_console/include/styles/events.css | 6 +- pandora_console/include/styles/pandora.css | 45 +-- .../include/visual-console-client/vc.main.css | 4 - visual_console_client/src/main.css | 4 - 12 files changed, 456 insertions(+), 291 deletions(-) diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index f5a8154908..0872461011 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -151,7 +151,7 @@ if (is_ajax()) { ui_require_javascript_file('openlayers.pandora'); -$new_agent = (empty($id_agente)) ? true : false; +$new_agent = (empty($id_agente) === true) ? true : false; if (! isset($id_agente) && ! $new_agent) { db_pandora_audit( @@ -209,6 +209,189 @@ $custom_id_div .= html_print_input_text( 'agent_custom_id' ).''; +// Get groups. +$groups = users_get_groups($config['id_user'], 'AR', false); + +// Get modules. +$modules = db_get_all_rows_sql( + 'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo + WHERE id_agente = '.$id_parent +); +$modules_values = []; +$modules_values[0] = __('Any'); +if (is_array($modules) === true) { + foreach ($modules as $m) { + $modules_values[$m['id_module']] = $m['name']; + } +} + +// Get Servers. +$servers = servers_get_names(); +// Set the agent have not server. +if (array_key_exists($server_name, $servers) === false) { + $server_name = 0; +} + +if ($new_agent === true) { + // Set first server by default. + $servers_get_names = $servers; + $array_keys_servers_get_names = array_keys($servers_get_names); + $server_name = reset($array_keys_servers_get_names); +} + +$tableAgent = new stdClass(); +$tableAgent->id = 'simple'; +$tableAgent->class = 'w100p mrgn_10px'; +$tableAgent->data = []; +$tableAgent->style = []; +$tableAgent->cellclass = []; +$tableAgent->colspan = []; +$tableAgent->rowspan = []; +/* + $tableAgent->cellpadding = 2; + $tableAgent->cellspacing = 0; + $tableAgent->rowspan[3][2] = 3; + $tableAgent->rowspan[4][2] = 3; +*/ +// Agent name. +if ($new_agent === false) { + $tableAgent->data['name'][0] = __('Agent name'); + $tableAgent->data['name'][1] = html_print_input_text('agente', $nombre_agente, '', 80, 100, true); + $tableAgent->data['name'][1] .= html_print_div( + [ + 'class' => 'moduleIdBox', + 'content' => __('ID').' '.$id_agente.'', + ], + true + ); + // Agent options for QR code. + $agent_options_update = 'agent_options_update'; +} + +// Alias. +$tableAgent->data['alias'][0] = __('Alias'); +$tableAgent->data['alias'][1] = html_print_input_text('alias', $alias, '', 50, 100, true, false, true); + +if ($new_agent === true) { + $tableAgent->data['alias'][2] = __('Use alias as name'); + $tableAgent->data['alias'][3] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true); +} + +// Ip adress. +$tableAgent->data['ip_address'][0] = __('IP Address'); +$tableAgent->data['ip_address'][1] = html_print_input_text('direccion', $direccion_agente, '', 16, 100, true); + +$tableAgent->data['ip_address'][2] = __('Unique IP'); +$tableAgent->data['ip_address'][3] .= html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true); + +$tableAgent->data['ip_address'][4] = __('Fix IP address'); +$tableAgent->data['ip_address'][4] .= ui_print_help_tip(__('Avoid automatic IP address update when agent IP changes.'), true); +$tableAgent->data['ip_address'][5] = html_print_input( + [ + 'type' => 'switch', + 'id' => 'fixed_ip', + 'name' => 'fixed_ip', + 'value' => $fixed_ip, + ] +); + +// IP Address List. +if ($new_agent === false) { + $tableAgent->data['ip_address_list'][0] = __('IP Address list'); + $tableAgent->data['ip_address_list'][1] = html_print_select(agents_get_addresses($id_agente), 'address_list', $direccion_agente, '', '', 0, true); + $tableAgent->data['ip_address_list'][2] = __('Delete selected IPs'); + $tableAgent->data['ip_address_list'][3] = html_print_checkbox_switch('delete_ip', 1, false, true); +} + +// Select primary group. +$tableAgent->data['primary_group'][0] = __('Primary group'); +if (isset($groups[$grupo]) === true || $new_agent === true) { + // Cannot change primary group if user have not permission for that group. + $tableAgent->data['primary_group'][1] = html_print_input( + [ + 'type' => 'select_groups', + 'returnAllGroup' => false, + 'name' => 'grupo', + 'selected' => $grupo, + 'return' => true, + 'required' => true, + 'privilege' => 'AW', + ] + ); +} else { + $tableAgent->data['primary_group'][1] .= groups_get_name($grupo); + $tableAgent->data['primary_group'][1] .= html_print_input_hidden('grupo', $grupo, true); +} + +$tableAgent->data['primary_group'][1] .= '
'; +if ($id_agente === 0) { + $hidden = 'display: none;'; +} else { + $hidden = ''; +} + +$tableAgent->data['primary_group'][1] .= ui_print_group_icon($grupo, true, 'groups_small', $hidden); + +$tableAgent->data['interval'][0] = __('Interval'); +$tableAgent->data['interval'][1] = html_print_extended_select_for_time( + 'intervalo', + $intervalo, + '', + '', + '0', + 10, + true, + false, + true, + 'w40p' +); + +if ($intervalo < SECONDS_5MINUTES) { + $tableAgent->data['interval'][1] .= clippy_context_help('interval_agent_min'); +} + +$tableAgent->data['os'][0] = __('OS'); +$tableAgent->data['os'][1] = html_print_select_from_sql( + 'SELECT id_os, name FROM tconfig_os', + 'id_os', + $id_os, + '', + '', + '0', + true +); +$tableAgent->data['os'][1] .= html_print_div( + [ + 'content' => ''.ui_print_os_icon($id_os, false, true).'', + ], + true +); + +$tableAgent->data['server'][0] = __('Server'); +$tableAgent->data['server'][1] = html_print_select( + $servers, + 'server_name', + $server_name, + '', + __('None'), + 0, + true +); + +// Description. +$tableAgent->data['server'][0] = __('Description'); +$tableAgent->data['server'][1] = html_print_textarea( + 'comentarios', + 3, + 10, + $comentarios, + '', + true, + 'agent_description' +); + +html_print_table($tableAgent); + if (!$new_agent && $alias != '') { $table_agent_name = '

'.__('Agent name').'

'; $table_agent_name .= '
'; @@ -230,20 +413,6 @@ if (!$new_agent && $alias != '') { $table_agent_name .= ''; } - $agent_options_update = 'agent_options_update'; - - // Delete link from here. - if (is_management_allowed() === true) { - $table_agent_name .= "".html_print_image( - 'images/cross.png', - true, - [ - 'title' => __('Delete agent'), - 'class' => 'invert_filter', - ] - ).''; - } - // Remote configuration available. $remote_agent = false; if (isset($filename)) { @@ -284,36 +453,38 @@ if (!$new_agent && $alias != '') { $table_qr_code .= '
'; } -if ($new_agent) { +/* + if ($new_agent) { $label_select_child_left = 'label_select_child_left'; $label_select_parent = 'label_select_parent'; -} + } -$table_alias = '

'.__('Alias').'

'; -$table_alias .= '
'; -$table_alias .= '
'.html_print_input_text('alias', $alias, '', 50, 100, true, false, true).'
'; -if ($new_agent) { + $table_alias = '

'.__('Alias').'

'; + $table_alias .= '
'; + $table_alias .= '
'.html_print_input_text('alias', $alias, '', 50, 100, true, false, true).'
'; + if ($new_agent) { $table_alias .= '
'.html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true).__('Use alias as name').'
'; -} + } -$table_alias .= '
'; - -$table_ip = '

'.__('IP Address').'

'; -$table_ip .= '
'; -$table_ip .= '
'.html_print_input_text('direccion', $direccion_agente, '', 16, 100, true).'
'; -$table_ip .= '
'.html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true).__('Unique IP').'
'; -$table_ip .= '
'.html_print_input( + $table_alias .= '
'; +*/ +/* + $table_ip = '

'.__('IP Address').'

'; + $table_ip .= '
'; + $table_ip .= '
'.html_print_input_text('direccion', $direccion_agente, '', 16, 100, true).'
'; + $table_ip .= '
'.html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true).__('Unique IP').'
'; + $table_ip .= '
'.html_print_input( [ 'type' => 'switch', 'id' => 'fixed_ip', 'name' => 'fixed_ip', 'value' => $fixed_ip, ] -).__('Fix IP address').ui_print_help_tip(__('Avoid automatic IP address update when agent IP changes.'), true).'
'; + ).__('Fix IP address').ui_print_help_tip(__('Avoid automatic IP address update when agent IP changes.'), true).'
'; -$table_ip .= '
'; - -if ($id_agente) { +$table_ip .= '
';*/ +/* + if ($id_agente) { $ip_all = agents_get_addresses($id_agente); $table_ip .= '
'; @@ -321,7 +492,7 @@ if ($id_agente) { $table_ip .= '
'.html_print_select($ip_all, 'address_list', $direccion_agente, '', '', 0, true).'
'; $table_ip .= '
'.html_print_checkbox_switch('delete_ip', 1, false, true).__('Delete selected IPs').'
'; $table_ip .= '
'; -} +}*/ ?>

'.__('Primary group').'

'; -$table_primary_group .= '
'; -// Cannot change primary group if user have not permission for that group. -if (isset($groups[$grupo]) || $new_agent) { +/* + $table_primary_group = '

'.__('Primary group').'

'; + $table_primary_group .= '
'; + // Cannot change primary group if user have not permission for that group. + if (isset($groups[$grupo]) || $new_agent) { $table_primary_group .= html_print_input( [ 'type' => 'select_groups', @@ -359,25 +517,25 @@ if (isset($groups[$grupo]) || $new_agent) { 'privilege' => 'AW', ] ); -} else { + } else { $table_primary_group .= groups_get_name($grupo); $table_primary_group .= html_print_input_hidden('grupo', $grupo, true); -} + } -$table_primary_group .= '
'; -if ($id_agente === 0) { + $table_primary_group .= '
'; + if ($id_agente === 0) { $hidden = 'display: none;'; -} else { + } else { $hidden = ''; -} + } -$table_primary_group .= ui_print_group_icon($grupo, true, 'groups_small', $hidden); + $table_primary_group .= ui_print_group_icon($grupo, true, 'groups_small', $hidden); -$table_primary_group .= '
'; + $table_primary_group .= '
'; -$table_interval = '

'.__('Interval').'

'; -$table_interval .= '
'; -$table_interval .= html_print_extended_select_for_time( + $table_interval = '

'.__('Interval').'

'; + $table_interval .= '
'; + $table_interval .= html_print_extended_select_for_time( 'intervalo', $intervalo, '', @@ -388,19 +546,19 @@ $table_interval .= html_print_extended_select_for_time( false, true, 'w40p' -); + ); -if ($intervalo < SECONDS_5MINUTES) { + if ($intervalo < SECONDS_5MINUTES) { $table_interval .= clippy_context_help('interval_agent_min'); -} + } -$table_interval .= '
'; + $table_interval .= '
'; -$table_os = '

'.__('OS').'

'; -$table_os .= '
'; -$table_os .= html_print_select_from_sql( + $table_os = '

'.__('OS').'

'; + $table_os .= '
'; + $table_os .= html_print_select_from_sql( 'SELECT id_os, name FROM tconfig_os', 'id_os', $id_os, @@ -408,36 +566,11 @@ $table_os .= html_print_select_from_sql( '', '0', true -); -$table_os .= '
'; -$table_os .= ui_print_os_icon($id_os, false, true); -$table_os .= '
'; - -// Network server. -$servers = servers_get_names(); -// Set the agent have not server. -if (array_key_exists($server_name, $servers) === false) { - $server_name = 0; -} - -$table_server = '

'.__('Server').'

'; -$table_server .= '
'; -if ($new_agent) { - // Set first server by default. - $servers_get_names = $servers; - $array_keys_servers_get_names = array_keys($servers_get_names); - $server_name = reset($array_keys_servers_get_names); -} - -$table_server .= html_print_select( - $servers, - 'server_name', - $server_name, - '', - __('None'), - 0, - true -).'
'; + ); + $table_os .= '
'; + $table_os .= ui_print_os_icon($id_os, false, true); + $table_os .= '
'; +*/ $table_satellite = ''; @@ -475,20 +608,10 @@ if ($remote_agent === true) { } } -// Description. -$table_description = '

'.__('Description').'

'; -$table_description .= html_print_textarea( - 'comentarios', - 3, - 10, - $comentarios, - '', - true, - 'agent_description' -).'
'; + // QR code. -echo '
+echo '
'.$table_agent_name.$table_alias.$table_ip.$table_primary_group.'
'.$table_interval.$table_os.$table_server.$table_satellite.$table_description.'
@@ -966,7 +1089,7 @@ echo clippy_context_help('modules_not_learning_mode'); echo ''; -if ($id_agente) { +if ($new_agent === false) { $submitButton = html_print_submit_button( __('Update'), 'updbutton', @@ -976,6 +1099,20 @@ if ($id_agente) { ); $submitButton .= html_print_input_hidden('update_agent', 1); $submitButton .= html_print_input_hidden('id_agente', $id_agente); + + if (is_management_allowed() === true) { + $submitButton .= html_print_button( + __('Delete agent'), + 'deleteAgent', + false, + 'onClick=onClick="if (!confirm(\'"'.__('Are you sure?').'"\')) return false;\" href=\'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=\''.$id_agente, + [ + 'icon' => 'delete', + 'mode' => 'secondary', + ], + true + ); + } } else { $submitButton = html_print_submit_button( __('Create'), diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index ace8b9c106..cffa073369 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -395,7 +395,7 @@ if ($id_agente) { 'class' => 'invert_filter', ] ).''; - if ($tab == 'main') { + if ($tab === 'main') { $maintab['active'] = true; } else { $maintab['active'] = false; diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index df45d9da73..ca1918a16f 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -360,7 +360,7 @@ foreach ($pre_fields as $key => $value) { html_print_select($fields, 'os', $os, 'this.form.submit()', 'All', 0); echo ''; -echo __('Search').' '; +echo __('Free search').' '; html_print_input_text('search', $search, '', 12); echo ui_print_help_tip( @@ -375,7 +375,7 @@ html_print_submit_button( false, [ 'icon' => 'search', - 'mode' => 'secondary mini', + 'mode' => 'mini', ] ); echo ''; diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index 005b1e578f..f5845d7226 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -766,12 +766,32 @@ if ($moduletype != 13) { // Submit. echo '
'; if ($id_agent_module) { - html_print_submit_button( + $actionButtons = html_print_submit_button( __('Update'), 'updbutton', false, - 'class="sub upd"' + [ 'icon' => 'update' ], + true ); + $actionButtons .= html_print_button( + __('Delete'), + 'deleteModule', + false, + 'window.location.action(\'index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$id_agent_module.')', + [ + 'icon' => 'delete', + 'mode' => 'secondary', + ], + true + ); + + html_print_div( + [ + 'class' => 'action-buttons', + 'content' => $actionButtons, + ] + ); + html_print_input_hidden('update_module', 1); html_print_input_hidden('id_agent_module', $id_agent_module); html_print_input_hidden('id_module_type', $id_module_type); @@ -784,11 +804,17 @@ if ($id_agent_module) { 'action-buttons', + 'content' => html_print_submit_button( + __('Create'), + 'crtbutton', + false, + [ 'icon' => 'wand' ], + true + ), + ] ); html_print_input_hidden('id_module', $moduletype); html_print_input_hidden('create_module', 1); diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 984fed5642..c59fc48ccb 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -194,26 +194,34 @@ $update_module_id = (int) get_parameter_get('update_module'); $edit_module = (bool) get_parameter_get('edit_module'); $table_simple = new stdClass(); $table_simple->id = 'simple'; -$table_simple->width = '100%'; -$table_simple->class = 'no-class'; +$table_simple->class = 'w100p mrgn_10px'; $table_simple->data = []; $table_simple->style = []; -$table_simple->style[0] = 'font-weight: bold; width: 25%;'; -$table_simple->style[1] = 'width: 25%'; -$table_simple->style[2] = 'font-weight: bold; width: 25%;'; -$table_simple->style[3] = 'width: 25%'; $table_simple->cellclass = []; - $table_simple->colspan = []; - $table_simple->rowspan = []; +$table_simple->cellpadding = 2; +$table_simple->cellspacing = 0; +$table_simple->rowspan[3][2] = 3; +$table_simple->rowspan[4][2] = 3; -$table_simple->rowspan[2][2] = 3; -$table_simple->colspan[2][2] = 2; -$table_simple->colspan[3][1] = 3; +$dataRow = 0; +$dataCol = 0; -$table_simple->data[0][0] = __('Name'); -$table_simple->data[0][1] = html_print_input_text_extended( +if (empty($id_agent_module) === false && isset($id_agente) === true) { + $moduleIdContent = html_print_div( + [ + 'class' => 'moduleIdBox', + 'content' => __('ID').' '.$id_agent_module.'', + ], + true + ); +} else { + $moduleIdContent = ''; +} + +$table_simple->data[$dataRow][$dataCol++] = __('Name'); +$table_simple->data[$dataRow][$dataCol++] = html_print_input_text_extended( 'name', $name, 'text-name', @@ -224,23 +232,7 @@ $table_simple->data[0][1] = html_print_input_text_extended( '', $largeClassDisabledBecauseInPolicy, true -); - -if (!empty($id_agent_module) && isset($id_agente)) { - $table_simple->data[0][1] .= ' '.__('ID').'  '.$id_agent_module.' '; - - $table_simple->data[0][1] .= ' '; - $table_simple->data[0][1] .= html_print_image( - 'images/cross.png', - true, - [ - 'title' => __('Delete module'), - 'class' => 'invert_filter', - ] - ); - $table_simple->data[0][1] .= ' '; -} +).$moduleIdContent; $disabled_enable = 0; $policy_link = db_get_value( @@ -254,16 +246,26 @@ if ($policy_link != 0) { $disabled_enable = 1; } -$table_simple->data[0][2] = __('Disabled'); -$table_simple->data[0][2] .= html_print_checkbox( +$table_simple->cellclass[$dataRow][$dataCol] = 'flex_center '; +$table_simple->data[$dataRow][$dataCol] = __('Disabled'); +$table_simple->data[$dataRow][$dataCol++] .= html_print_checkbox( 'disabled', 1, $disabled, true, - $disabled_enable + $disabled_enable, + '', + false, + '', + '', + 'style="margin-left: 5px;"' ); -$table_simple->data[0][3] = __('Module group'); -$table_simple->data[0][3] .= html_print_select_from_sql( + +$dataRow++; +$dataCol = 0; +$table_simple->data[$dataRow][$dataCol++] = __('Module group'); +$table_simple->colspan[$dataRow][$dataCol] = '3'; +$table_simple->data[$dataRow][$dataCol++] .= html_print_select_from_sql( 'SELECT id_mg, name FROM tmodule_group ORDER BY name', 'id_module_group', $id_module_group, @@ -274,10 +276,10 @@ $table_simple->data[0][3] .= html_print_select_from_sql( false, true, $disabledBecauseInPolicy, - 'width: 150px' + 'width: 280px' ); -if ((isset($id_agent_module) && $id_agent_module) || $id_policy_module != 0) { +if ((isset($id_agent_module) === true && $id_agent_module) || $id_policy_module != 0) { $edit = false; } else { $edit = true; @@ -285,10 +287,13 @@ if ((isset($id_agent_module) && $id_agent_module) || $id_policy_module != 0) { $in_policy = strstr($page, 'policy_modules'); -$table_simple->data[1][0] = __('Type').' '.ui_print_help_icon($help_type, true, '', 'images/help_green.png', '', 'module_type_help'); -$table_simple->data[1][0] .= html_print_input_hidden('id_module_type_hidden', $id_module_type, true); +$dataRow++; +$dataCol = 0; +$table_simple->data[$dataRow][$dataCol] .= html_print_input_hidden('id_module_type_hidden', $id_module_type, true); +$table_simple->data[$dataRow][$dataCol++] = __('Type').ui_print_help_icon($help_type, true, '', 'images/help_green.png', '', 'module_type_help'); +$table_simple->colspan[$dataRow][$dataCol] = '3'; -if (!$edit) { +if ($edit === false) { $sql = sprintf( 'SELECT id_tipo, nombre FROM ttipo_modulo @@ -304,14 +309,14 @@ if (!$edit) { $type_names_hash[$tn['id_tipo']] = $tn['nombre']; } - $table_simple->data[1][1] = ''.modules_get_moduletype_description($id_module_type).' ('.$type_names_hash[$id_module_type].')'; - $table_simple->data[1][1] .= html_print_input_hidden( + $table_simple->data[$dataRow][$dataCol] = ''.modules_get_moduletype_description($id_module_type).' ('.$type_names_hash[$id_module_type].')'; + $table_simple->data[$dataRow][$dataCol] .= html_print_input_hidden( 'type_names', base64_encode(io_json_mb_encode($type_names_hash)), true ); } else { - if (isset($id_module_type)) { + if (isset($id_module_type) === true) { $idModuleType = $id_module_type; } else { $idModuleType = ''; @@ -319,8 +324,7 @@ if (!$edit) { // Removed web analysis and log4x from select. $tipe_not_in = '24, 25'; - // TODO: FIX credential store for remote command in metaconsole. - if (is_metaconsole()) { + if (is_metaconsole() === true) { $tipe_not_in = '24, 25, 34, 35, 36, 37'; } @@ -347,7 +351,7 @@ if (!$edit) { } } - $table_simple->data[1][1] = html_print_select( + $table_simple->data[$dataRow][$dataCol] = html_print_select( $type_description_hash, 'id_module_type', $idModuleType, @@ -359,13 +363,13 @@ if (!$edit) { false, '', false, - 'width:200px', + 'width: 280px;', false, 100 ); // Store the relation between id and name of the types on a hidden field. - $table_simple->data[1][1] .= html_print_input_hidden( + $table_simple->data[$dataRow][$dataCol] .= html_print_input_hidden( 'type_names', base64_encode(io_json_mb_encode($type_names_hash)), true @@ -397,23 +401,22 @@ if ($edit_module) { if ($id_module_type >= 30 && $id_module_type <= 33) { $help_header = 'webserver_module_tab'; } - - $table_simple->data[1][0] = __('Type').' '; - $table_simple->data[1][0] .= ui_print_help_icon($help_header, true); } if ($disabledBecauseInPolicy) { - $table_simple->data[1][3] .= html_print_input_hidden( + $table_simple->data[$dataRow][3] .= html_print_input_hidden( 'id_module_group', $id_module_group, true ); } -$table_simple->data[2][0] = __('Warning threshold'); -if (!modules_is_string_type($id_module_type) || $edit) { - $table_simple->data[2][1] .= ''.__('Min. ').''; - $table_simple->data[2][1] .= html_print_input_text( +$dataRow++; +$table_simple->data[$dataRow][0] .= __('Warning threshold'); +$table_simple->cellclass[$dataRow][1] = 'module_thresholds_fields'; +if (modules_is_string_type($id_module_type) === false || $edit === true) { + $table_simple->data[$dataRow][1] .= ''.__('Min. ').''; + $table_simple->data[$dataRow][1] .= html_print_input_text( 'min_warning', $min_warning, '', @@ -425,8 +428,8 @@ if (!modules_is_string_type($id_module_type) || $edit) { '', $classdisabledBecauseInPolicy ); - $table_simple->data[2][1] .= '
'.__('Max.').''; - $table_simple->data[2][1] .= html_print_input_text( + $table_simple->data[$dataRow][1] .= ''.__('Max.').''; + $table_simple->data[$dataRow][1] .= html_print_input_text( 'max_warning', $max_warning, '', @@ -440,9 +443,9 @@ if (!modules_is_string_type($id_module_type) || $edit) { ).'
'; } -if (modules_is_string_type($id_module_type) || $edit) { - $table_simple->data[2][1] .= ''.__('Str.').''; - $table_simple->data[2][1] .= html_print_input_text( +if (modules_is_string_type($id_module_type) === true || $edit === true) { + $table_simple->data[$dataRow][1] .= ''.__('Str.').''; + $table_simple->data[$dataRow][1] .= html_print_input_text( 'str_warning', str_replace('"', '', $str_warning), '', @@ -456,25 +459,31 @@ if (modules_is_string_type($id_module_type) || $edit) { ).''; } -$table_simple->data[2][1] .= '
'.__('Inverse interval').''; -$table_simple->data[2][1] .= html_print_checkbox('warning_inverse', 1, $warning_inverse, true, $disabledBecauseInPolicy); -$table_simple->data[2][1] .= '
'; +$table_simple->data[$dataRow][1] .= '
'.__('Inverse interval').''; +$table_simple->data[$dataRow][1] .= html_print_checkbox('warning_inverse', 1, $warning_inverse, true, $disabledBecauseInPolicy); +$table_simple->data[$dataRow][1] .= '
'; if (modules_is_string_type($id_module_type) === false) { - $table_simple->data[2][1] .= '
'.__('Percentage').''; - $table_simple->data[2][1] .= html_print_checkbox('percentage_warning', 1, $percentage_warning, true, $disabledBecauseInPolicy); - $table_simple->data[2][1] .= ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true); - $table_simple->data[2][1] .= '
'; + $table_simple->data[$dataRow][1] .= '
'.__('Percentage').''; + $table_simple->data[$dataRow][1] .= html_print_checkbox('percentage_warning', 1, $percentage_warning, true, $disabledBecauseInPolicy); + $table_simple->data[$dataRow][1] .= ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true); + $table_simple->data[$dataRow][1] .= '
'; } -if (!modules_is_string_type($id_module_type) || $edit) { - $table_simple->data[2][2] = ' '; + + +if (modules_is_string_type($id_module_type) === false || (bool) $edit === true) { + $table_simple->cellstyle[$dataRow][2] = 'top: 160px; left: 700px; position: absolute; width: 280px;'; + $table_simple->colspan[$dataRow][2] = '2'; + $table_simple->data[$dataRow][2] = ' '; } -$table_simple->data[3][0] = __('Critical threshold'); -if (!modules_is_string_type($id_module_type) || $edit) { - $table_simple->data[3][1] .= ''.__('Min. ').''; - $table_simple->data[3][1] .= html_print_input_text( +$dataRow++; +$table_simple->data[$dataRow][0] = __('Critical threshold'); +$table_simple->cellclass[$dataRow][1] = 'module_thresholds_fields'; +if (modules_is_string_type($id_module_type) === false || $edit === true) { + $table_simple->data[$dataRow][1] .= ''.__('Min').''; + $table_simple->data[$dataRow][1] .= html_print_input_text( 'min_critical', $min_critical, '', @@ -486,8 +495,8 @@ if (!modules_is_string_type($id_module_type) || $edit) { '', $classdisabledBecauseInPolicy ); - $table_simple->data[3][1] .= '
'.__('Max.').''; - $table_simple->data[3][1] .= html_print_input_text( + $table_simple->data[$dataRow][1] .= '
'.__('Max').''; + $table_simple->data[$dataRow][1] .= html_print_input_text( 'max_critical', $max_critical, '', @@ -501,9 +510,9 @@ if (!modules_is_string_type($id_module_type) || $edit) { ).'
'; } -if (modules_is_string_type($id_module_type) || $edit) { - $table_simple->data[3][1] .= ''.__('Str.').''; - $table_simple->data[3][1] .= html_print_input_text( +if (modules_is_string_type($id_module_type) === true || $edit === true) { + $table_simple->data[$dataRow][1] .= ''.__('Str.').''; + $table_simple->data[$dataRow][1] .= html_print_input_text( 'str_critical', str_replace('"', '', $str_critical), '', @@ -517,33 +526,34 @@ if (modules_is_string_type($id_module_type) || $edit) { ).''; } -$table_simple->data[3][1] .= '
'.__('Inverse interval').''; -$table_simple->data[3][1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true, $disabledBecauseInPolicy); -$table_simple->data[3][1] .= '
'; +$table_simple->data[$dataRow][1] .= '
'.__('Inverse interval').''; +$table_simple->data[$dataRow][1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true, $disabledBecauseInPolicy); +$table_simple->data[$dataRow][1] .= '
'; if (modules_is_string_type($id_module_type) === false) { - $table_simple->data[3][1] .= '
'.__('Percentage').''; - $table_simple->data[3][1] .= ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true); - $table_simple->data[3][1] .= html_print_checkbox('percentage_critical', 1, $percentage_critical, true, $disabledBecauseInPolicy); - $table_simple->data[3][1] .= '
'; + $table_simple->data[$dataRow][1] .= '
'.__('Percentage').''; + $table_simple->data[$dataRow][1] .= html_print_checkbox('percentage_critical', 1, $percentage_critical, true, $disabledBecauseInPolicy); + $table_simple->data[$dataRow][1] .= ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true); + $table_simple->data[$dataRow][1] .= '
'; } -$table_simple->data[4][0] = __('Historical data'); +$dataRow++; +$table_simple->data[$dataRow][0] = __('Historical data'); if ($disabledBecauseInPolicy) { // If is disabled, we send a hidden in his place and print a false // checkbox because HTML dont send disabled fields // and could be disabled by error. - $table_simple->data[4][1] = html_print_checkbox( + $table_simple->data[$dataRow][1] = html_print_checkbox( 'history_data_fake', 1, $history_data, true, $disabledBecauseInPolicy ); - $table_simple->data[4][1] .= ''; + $table_simple->data[$dataRow][1] .= ''; } else { - $table_simple->data[4][1] = html_print_checkbox( + $table_simple->data[$dataRow][1] = html_print_checkbox( 'history_data', 1, $history_data, @@ -1677,9 +1687,11 @@ $(document).ready (function () { paint_graph_values(); if ($('#checkbox-warning_inverse').prop('checked') === true){ $('#checkbox-percentage_warning').prop('checked', false); - $('#percentage_warning').hide(); + $('#percentage_warning').attr('onClick', 'return false;'); + $('#percentage_warning>em').addClass('color_666'); } else { - $('#percentage_warning').show(); + $('#percentage_warning').removeAttr('onClick'); + $('#percentage_warning>em').removeClass('color_666'); } }); @@ -1688,9 +1700,11 @@ $(document).ready (function () { if ($('#checkbox-critical_inverse').prop('checked') === true){ $('#checkbox-percentage_critical').prop('checked', false); - $('#percentage_critical').hide(); + $('#percentage_critical').attr('onClick', 'return false;'); + $('#percentage_critical>em').addClass('color_666'); } else { - $('#percentage_critical').show(); + $('#percentage_critical').removeAttr('onClick'); + $('#percentage_critical>em').removeClass('color_666'); } }); @@ -1698,9 +1712,11 @@ $(document).ready (function () { paint_graph_values(); if ($('#checkbox-percentage_warning').prop('checked') === true){ $('#checkbox-warning_inverse').prop('checked', false); - $('#warning_inverse').hide(); + $('#warning_inverse').attr('onClick', 'return false;'); + $('#warning_inverse>em').addClass('color_666'); } else { - $('#warning_inverse').show(); + $('#warning_inverse').removeAttr('onClick'); + $('#warning_inverse>em').removeClass('color_666'); } }); @@ -1708,10 +1724,11 @@ $(document).ready (function () { paint_graph_values(); if ($('#checkbox-percentage_critical').prop('checked') === true){ $('#checkbox-critical_inverse').prop('checked', false); - $('#critical_inverse').hide(); - } - else { - $('#critical_inverse').show(); + $('#critical_inverse').attr('onClick', 'return false;'); + $('#critical_inverse>em').addClass('color_666'); + } else { + $('#critical_inverse').removeAttr('onClick'); + $('#critical_inverse>em').removeClass('color_666'); } }); diff --git a/pandora_console/godmode/alerts/alert_list.builder.php b/pandora_console/godmode/alerts/alert_list.builder.php index 37e1d1ed62..bf55c5619b 100644 --- a/pandora_console/godmode/alerts/alert_list.builder.php +++ b/pandora_console/godmode/alerts/alert_list.builder.php @@ -117,11 +117,11 @@ $table->data[1][1] = html_print_select( __('Default action'), '0', true, - '', + false, true, '', false, - 'min-width: 250px;' + 'width: 250px;' ); $table->data[1][1] .= ''; -if (check_acl($config['id_user'], 0, 'LM')) { - $table->data[1][1] .= ''; - $table->data[1][1] .= html_print_image('images/add.png', true, ['class' => 'invert_filter']); - $table->data[1][1] .= ''.__('Create Action').''; - $table->data[1][1] .= ''; +if ((bool) check_acl($config['id_user'], 0, 'LM') === true) { + $table->data[1][1] .= html_print_button( + __('Create Action'), + '', + false, + 'window.location.assign(\'index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'\')', + [ 'mode' => 'link' ], + true + ); } $table->data[2][0] = __('Template'); @@ -163,11 +167,15 @@ if ($own_info['is_admin']) { 'width: 250px;' ); $table->data[2][1] .= ' '; - if (check_acl($config['id_user'], 0, 'LM')) { - $table->data[2][1] .= ''; - $table->data[2][1] .= html_print_image('images/add.png', true, ['class' => 'invert_filter']); - $table->data[2][1] .= ''.__('Create Template').''; - $table->data[2][1] .= ''; + if ((bool) check_acl($config['id_user'], 0, 'LM') === true) { + $table->data[2][1] .= html_print_button( + __('Create Template'), + '', + false, + 'window.location.assign(\'index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'\')', + [ 'mode' => 'link' ], + true + ); } $table->data[3][0] = __('Threshold'); diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index ae329862e3..b425aeaa21 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -338,7 +338,7 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t if (!$no_close_bool) { // Use the no_meta parameter because this image is only in // the base console. - $output .= ''.html_print_image('images/blade.png', true, false, false, false).''; + $output .= ''.html_print_image('images/svg/fail.svg', true, false, false, false).''; } $output .= ' @@ -5592,12 +5592,12 @@ function ui_print_agent_autocomplete_input($parameters) $javascript_function_change .= ' function setInputBackground(inputId, image) { $("#"+inputId) - .css("background","url(\'"+image+"\') 95% center no-repeat"); + .css({"background-image":"url(\'"+image+"\')", "background-repeat":"no-repeat", "backgound-position": "95% center"}); } function set_functions_change_autocomplete_'.$input_name.'() { var cache_'.$input_name.' = {}; - + $("#'.$input_id.'").autocomplete({ minLength: 2, source: function( request, response ) { @@ -5864,8 +5864,7 @@ function ui_print_agent_autocomplete_input($parameters) if (select_item_click) { select_item_click = 0; $("#'.$input_id.'") - .css("background", - "url(\"'.$icon_image.'\") 95% center no-repeat"); + .css({"background-image":"url(\"'.$icon_image.'\")", "background-repeat":"no-repeat", "backgound-position": "95% center"}); return; } else { // Clear selectbox if item is not selected. @@ -5880,11 +5879,7 @@ function ui_print_agent_autocomplete_input($parameters) //Set loading $("#'.$input_id.'") - .css("background", - "url(\"'.$spinner_image.'\") 95% center no-repeat"); - - - + .css({"background-image":"url(\"'.$spinner_image.'\")", "background-repeat":"no-repeat", "backgound-position": "95% center"}); var term = input_value; //Word to search '.$javascript_change_ajax_params_text.' @@ -5901,13 +5896,10 @@ function ui_print_agent_autocomplete_input($parameters) success: function (data) { if (data.length < 2) { //Set icon - $("#'.$input_id.'") - .css("background", - "url(\"'.$icon_image.'\") 95% center no-repeat"); - + $("#'.$input_id.'").css({"background-image":"url(\"'.$icon_image.'\")", "background-repeat":"no-repeat", "backgound-position": "95% center"}); return; } - + var agent_name = data[0].name; var agent_id = data[0].id; var server_name = ""; @@ -5970,12 +5962,12 @@ function ui_print_agent_autocomplete_input($parameters) $html = ''; $text_color = ''; - if ($config['style'] === 'pandora_black' && !is_metaconsole()) { + if ($config['style'] === 'pandora_black' && is_metaconsole() === false) { $text_color = 'color: white'; } $attrs = []; - $attrs['style'] = 'background: url('.$icon_image.') no-repeat 95% center; '.$text_color.''; + $attrs['style'] = 'background-image: url('.$icon_image.'); background-repeat: no-repeat; background-position: 95% center; '.$text_color.''; if (!$disabled_javascript_on_blur_function) { $attrs['onblur'] = $javascript_on_blur_function_name.'()'; diff --git a/pandora_console/include/styles/dashboards.css b/pandora_console/include/styles/dashboards.css index e8ab6204d9..0c53b6974b 100644 --- a/pandora_console/include/styles/dashboards.css +++ b/pandora_console/include/styles/dashboards.css @@ -146,10 +146,6 @@ h1 { cursor: pointer; } -label span.p-slider { - width: 30px; -} - #modal-add-widget .container-list-widgets { display: flex; flex-direction: row; diff --git a/pandora_console/include/styles/events.css b/pandora_console/include/styles/events.css index 250fd8b475..03dc98e83b 100644 --- a/pandora_console/include/styles/events.css +++ b/pandora_console/include/styles/events.css @@ -136,10 +136,6 @@ form.flex-row div.filter_input.filter_input_switch { justify-content: flex-start; } -form.flex-row div.filter_input.filter_input_switch .p-slider { - width: 30px; -} - fieldset { margin: 0 auto; } @@ -299,7 +295,7 @@ ul.ui-tabs-nav.ui-corner-all.ui-helper-reset.ui-helper-clearfix.ui-widget-header } li.ui-tabs-tab.ui-corner-top.ui-state-default.ui-tab.ui-tabs-active.ui-state-active { - border-bottom: 4px solid rgb(130, 185, 46) !important; + border-bottom: 5px solid rgb(130, 185, 46) !important; } tr.group { diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index ed5050fec2..b556c7a517 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -173,7 +173,6 @@ input[type="checkbox"] { } select { - padding: 2px 3px 3px 3px; vertical-align: middle; border: 1px solid #ddd; } @@ -319,14 +318,22 @@ select:-webkit-autofill:focus { } /* All select type multiple */ -select[multiple] option:checked { - background: #82b92e linear-gradient(0deg, #82b92e 0%, #82b92e 100%); - color: #fff; +select[multiple] { + min-height: 10em; +} + +select[multiple] option:checked, +select[multiple] option:active { + background: #d9efee; +} + +select[multiple] option { + padding: 6px 12px; + margin: 0px -10px; } select option:checked { - background-color: #82b92e; - color: #fff; + background-color: #d9efee; } select > option:hover { @@ -1356,6 +1363,7 @@ td.datos2f9 { } table.info_box.suc { + border-left: 5px solid #5a8629; background-color: #d9efee; } .suc * { @@ -1363,6 +1371,7 @@ table.info_box.suc { } table.info_box.info { + border-left: 5px solid #006f9d; background-color: #d6edff; } .info * { @@ -1370,6 +1379,7 @@ table.info_box.info { } table.info_box.error { + border-left: 5px solid #f85858; background-color: #ffe8e8; } .error * { @@ -1377,6 +1387,7 @@ table.info_box.error { } table.info_box.warning { + border-left: 5px solid #f3b200; background-color: #fff1d6; } .warning * { @@ -2208,7 +2219,9 @@ div#event_control { } .ac_loading { - background: white url("../images/loading.gif") 95% center no-repeat; + background-image: url("../images/loading.gif"); + background-position: 95% center; + background-repeat: no-repeat; } .ac_over { @@ -2434,9 +2447,6 @@ td.cellBig { margin-top: 10px; margin-bottom: 10px; padding: 0px 5px 5px 10px; - border-color: #e2e2e2; - border-style: solid; - border-width: 1px; width: 100%; -moz-border-radius: 4px; -webkit-border-radius: 4px; @@ -2449,8 +2459,7 @@ td.cellBig { } .info_box .icon { - width: 30px; - text-align: center; + width: 24px; } /* Standard styles for status colos (groups, events, backgrounds...) */ @@ -8104,7 +8113,6 @@ div.graph div.legend table { .icon_ui { padding-right: 10px; - padding-top: 3px; vertical-align: top; } @@ -8973,7 +8981,6 @@ div#err_msg_centralised { font: normal normal normal 13px Pandora-Light; padding: 5.5pt 20pt; cursor: pointer; - background-color: #fff; color: #14524f; border: 2px solid #14524f; box-shadow: none; @@ -9002,6 +9009,7 @@ select { box-sizing: border-box; } +input[readonly], input:disabled, textarea:disabled, select:disabled, @@ -9022,20 +9030,13 @@ select:focus { #autorefresh_list_out::-webkit-scrollbar { /*color: test;*/ } -textarea, -select { - padding: 10px; -} - -select[multiple] { - min-height: 10em; -} select:focus { border-color: #8a96a6; } textarea { + padding: 10px; height: auto; } .dataTables_length > label > select { diff --git a/pandora_console/include/visual-console-client/vc.main.css b/pandora_console/include/visual-console-client/vc.main.css index a740ae872b..c27130cad6 100644 --- a/pandora_console/include/visual-console-client/vc.main.css +++ b/pandora_console/include/visual-console-client/vc.main.css @@ -389,10 +389,6 @@ p.error-p-validate { border-radius: 5px 5px 0px 0px; } -label span.p-slider { - width: 30px; -} - li.interval-color-ranges > label, li#li-default-ranges > label { margin-right: 15px; diff --git a/visual_console_client/src/main.css b/visual_console_client/src/main.css index cdafdf0f1b..e5e4e331c6 100644 --- a/visual_console_client/src/main.css +++ b/visual_console_client/src/main.css @@ -389,10 +389,6 @@ p.error-p-validate { border-radius: 5px 5px 0px 0px; } -label span.p-slider { - width: 30px; -} - li.interval-color-ranges > label, li#li-default-ranges > label { margin-right: 15px;