From c855061d430de746e9d6ceb0559d2f295b8cb53a Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Thu, 9 Mar 2023 00:45:41 +0100 Subject: [PATCH 01/17] Netflow view --- pandora_console/include/functions_html.php | 15 +- .../operation/netflow/netflow_explorer.php | 19 +- .../operation/network/network_report.php | 286 +++++++++++------- 3 files changed, 212 insertions(+), 108 deletions(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 5d6f413573..71a2d10152 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -5231,9 +5231,13 @@ function html_print_switch($attributes=[]) * * @return string With HTML code. */ -function html_print_link_with_params($text, $params=[], $type='text', $style='') +function html_print_link_with_params($text, $params=[], $type='text', $style='', $formStyle='') { - $html = '
'; + if (empty($formStyle) === false) { + $formStyle = ' style="'.$formStyle.'"'; + } + + $html = ''; switch ($type) { case 'image': $html .= html_print_input_image($text, $text, $text, $style, true); @@ -5241,7 +5245,7 @@ function html_print_link_with_params($text, $params=[], $type='text', $style='') case 'text': default: - if (!empty($style)) { + if (empty($style) === false) { $style = ' style="'.$style.'"'; } @@ -5249,7 +5253,10 @@ function html_print_link_with_params($text, $params=[], $type='text', $style='') $text, $text, false, - 'class="button-as-link"'.$style, + [ + 'mode' => 'link', + 'style' => $style, + ], true ); break; diff --git a/pandora_console/operation/netflow/netflow_explorer.php b/pandora_console/operation/netflow/netflow_explorer.php index e191118855..cb09927178 100644 --- a/pandora_console/operation/netflow/netflow_explorer.php +++ b/pandora_console/operation/netflow/netflow_explorer.php @@ -34,7 +34,24 @@ if (! check_acl($config['id_user'], 0, 'AR')) { $action = get_parameter('action', 'listeners'); -ui_print_page_header(__('Netflow explorer')); +ui_print_standard_header( + __('Netflow explorer'), + '', + false, + '', + false, + [], + [ + [ + 'link' => '', + 'label' => __('Monitoring'), + ], + [ + 'link' => '', + 'label' => __('Network'), + ], + ] +); if (netflow_print_check_version_error()) { include $config['homedir'].'/operation/network/network_report.php'; diff --git a/pandora_console/operation/network/network_report.php b/pandora_console/operation/network/network_report.php index bb0800a262..a25ccff67b 100644 --- a/pandora_console/operation/network/network_report.php +++ b/pandora_console/operation/network/network_report.php @@ -62,95 +62,170 @@ $style_period = ($is_period) ? '' : 'display: none;'; // Build the table. $table = new stdClass(); -$table->class = 'databox filters'; -$table->styleTable = 'width: 100%'; -$table->data['0']['0'] = __('Data to show').'  '; -$table->data['0']['0'] .= html_print_select( - network_get_report_actions(false), - 'action', - $action, - '', - '', - 0, - true +$table->class = 'filter-table-adv'; +$table->width = '100%'; +$table->data = []; + +$table->data[0][] = html_print_label_input_block( + __('Data to show'), + html_print_select( + network_get_report_actions(false), + 'action', + $action, + '', + '', + 0, + true + ) ); -$table->data['0']['1'] = __('Number of result to show').'  '; -$table->data['0']['1'] .= html_print_select( - [ - '5' => 5, - '10' => 10, - '15' => 15, - '20' => 20, - '25' => 25, - '50' => 50, - '100' => 100, - '250' => 250, - ], - 'top', - $top, - '', - '', - 0, - true +$table->data[0][] = html_print_label_input_block( + __('Number of result to show'), + html_print_select( + [ + '5' => 5, + '10' => 10, + '15' => 15, + '20' => 20, + '25' => 25, + '50' => 50, + '100' => 100, + '250' => 250, + ], + 'top', + $top, + '', + '', + 0, + true + ) ); -$table->data['0']['2'] = ''; - -$table->data['1']['0'] = '
'; -$table->data['1']['0'] .= '
'; -$table->data['1']['0'] .= __('Start date').'  '; -$table->data['1']['0'] .= html_print_input_text('date_lower', $date_lower, '', 10, 7, true); -$table->data['1']['0'] .= '  '; -$table->data['1']['0'] .= html_print_input_text('time_lower', $time_lower, '', 7, 8, true); -$table->data['1']['0'] .= '
'; - -$table->data['1']['0'] .= '
'; -$table->data['1']['0'] .= __('Time Period').'  '; -$table->data['1']['0'] .= html_print_extended_select_for_time('period', $period, '', '', 0, false, true); -$table->data['1']['0'] .= '
'; -$table->data['1']['0'] .= html_print_checkbox( - 'is_period', - 1, - ($is_period === true) ? 1 : 0, - true, - false, - 'network_report_click_period(event)' +$table->data[1][] = html_print_label_input_block( + __('Start date'), + html_print_div( + [ + 'id' => 'end_date_container', + 'content' => html_print_input_text( + 'date_lower', + $date_lower, + '', + 10, + 7, + true + ).html_print_input_text( + 'time_lower', + $time_lower, + '', + 7, + 8, + true + ), + ], + true + ).html_print_div( + [ + 'id' => 'period_container', + 'style' => 'display: none;', + 'content' => html_print_label_input_block( + '', + html_print_extended_select_for_time( + 'period', + $period, + '', + '', + 0, + false, + true + ), + ), + ], + true + ).html_print_label_input_block( + '', + html_print_checkbox_switch( + 'is_period', + 1, + ($is_period === true) ? 1 : 0, + true, + false, + 'network_report_click_period(event)' + ).'', + ) ); -$table->data['1']['0'] .= ui_print_help_tip( - __('Select this checkbox to write interval instead a date.'), - true -); -$table->data['1']['0'] .= '
'; -$table->data['1']['1'] = __('End date').'  '; -$table->data['1']['1'] .= html_print_input_text('date_greater', $date_greater, '', 10, 7, true); -$table->data['1']['1'] .= '  '; -$table->data['1']['1'] .= html_print_input_text('time_greater', $time_greater, '', 7, 8, true); - -$table->data['1']['2'] = html_print_submit_button( - __('Update'), - 'update', - false, - 'class="sub upd"', - true -); -$table->data['1']['2'] .= '  '; -$table->data['1']['2'] .= html_print_submit_button( - __('Export to CSV'), - 'export_csv', - false, - 'class="sub next" onclick="blockResumit($(this))"', - true +$table->data[1][] = html_print_label_input_block( + __('End date'), + html_print_div( + [ + 'id' => '', + 'class' => '', + 'content' => html_print_input_text( + 'date_greater', + $date_greater, + '', + 10, + 7, + true + ).html_print_input_text( + 'time_greater', + $time_greater, + '', + 7, + 8, + true + ), + ], + true + ) ); echo ''; html_print_input_hidden('order_by', $order_by); -if (!empty($main_value)) { +if (empty($main_value) === false) { html_print_input_hidden('main_value', $main_value); } -html_print_table($table); +$outputTable = html_print_table($table, true); +$outputTable .= html_print_div( + [ + 'class' => 'action-buttons-right-forced', + 'content' => html_print_submit_button( + __('Filter'), + 'update', + false, + [ + 'icon' => 'search', + 'mode' => 'mini', + ], + true + ), + ], + true +); +ui_toggle( + $outputTable, + ''.__('Filters').'', + __('Filters'), + '', + true, + false, + '', + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' +); +html_print_action_buttons( + html_print_submit_button( + __('Export to CSV'), + 'export_csv', + false, + [ + 'icon' => 'load', + 'onclick' => 'blockResumit($(this))', + ], + true + ) +); echo '
'; // Print the data. @@ -178,7 +253,8 @@ $hidden_main_link = [ unset($table); $table = new stdClass(); -$table->styleTable = 'width: 60%'; +$table->id = ''; +$table->width = '100%'; // Print the header. $table->head = []; $table->head['main'] = __('IP'); @@ -252,20 +328,6 @@ if (get_parameter('export_csv')) { exit; } -// Print the filter remove link. -if (!empty($main_value)) { - echo html_print_link_with_params( - in_array($action, ['udp', 'tcp']) ? __('Filtered by port %s. Click here to remove the filter.', $main_value) : __('Filtered by IP %s. Click here to remove the filter.', $main_value), - array_merge( - $hidden_main_link, - [ - 'main_value' => $main_value, - 'remove_filter' => 1, - ] - ) - ); -} - // Print the data and build the chart. $table->data = []; $chart_data = []; @@ -277,7 +339,7 @@ foreach ($data as $item) { $row['main'] .= $item['host']; if (!$hide_filter) { $row['main'] .= html_print_link_with_params( - 'images/filter.png', + 'images/filters@svg.svg', array_merge($hidden_main_link, ['main_value' => $item['host']]), 'image' ); @@ -316,9 +378,7 @@ foreach ($data as $item) { if (empty($data)) { ui_print_info_message(__('No data found')); } else { - echo '
'; - html_print_table($table); - + // Pie graph options. $options = [ 'height' => 230, 'legend' => [ @@ -328,15 +388,35 @@ if (empty($data)) { ], 'labels' => $labels, ]; - - // Print the graph. - echo '
'; - echo pie_graph( - $chart_data, - $options + // Pie graph. + html_print_div( + [ + 'class' => 'databox netflow-pie-graph-container padding-2 white_box', + 'content' => pie_graph( + $chart_data, + $options + ), + ] ); - echo '
'; - echo '
'; + // Print the filter remove link. + if (empty($main_value) === false) { + echo html_print_link_with_params( + in_array($action, ['udp', 'tcp']) ? __('Filtered by port %s. Click here to remove the filter.', $main_value) : __('Filtered by IP %s. Click here to remove the filter.', $main_value), + array_merge( + $hidden_main_link, + [ + 'main_value' => $main_value, + 'remove_filter' => 1, + ] + ), + 'text', + '', + 'width: 100%; display: flex; justify-content: center;' + ); + } + + // Print results. + html_print_table($table); } ?> From 63d83b3f97fd72726f513b5deadaa6fc3218794f Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 9 Mar 2023 11:25:43 +0100 Subject: [PATCH 02/17] fixed styles --- pandora_console/general/main_menu.php | 1 + pandora_console/include/functions_html.php | 2 +- pandora_console/include/functions_ui.php | 13 ++++-- pandora_console/include/javascript/pandora.js | 4 +- pandora_console/include/styles/pandora.css | 46 +++++++++++-------- pandora_console/include/styles/wizard.css | 4 ++ pandora_console/index.php | 1 - .../operation/agentes/status_monitor.php | 4 +- 8 files changed, 46 insertions(+), 29 deletions(-) diff --git a/pandora_console/general/main_menu.php b/pandora_console/general/main_menu.php index a961a62ecb..1f9a204d95 100644 --- a/pandora_console/general/main_menu.php +++ b/pandora_console/general/main_menu.php @@ -98,6 +98,7 @@ echo ''; ?> From 2a97b26cfeb7c83d6d7ea7b65f268652b6037c0f Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Thu, 9 Mar 2023 15:14:47 +0100 Subject: [PATCH 07/17] Admin tools --- pandora_console/extensions/db_status.php | 102 +++++++++--- pandora_console/extensions/dbmanager.php | 124 +++++++------- .../extensions/dbmanager/dbmanager.css | 5 +- .../extensions/extension_uploader.php | 67 ++++++-- pandora_console/godmode/extensions.php | 63 ++++++- .../godmode/setup/file_manager.php | 2 +- pandora_console/godmode/setup/news.php | 154 ++++++++++++++---- pandora_console/include/ajax/events.php | 4 + .../include/class/EventSound.class.php | 65 +++++--- pandora_console/include/functions_html.php | 4 + pandora_console/include/styles/pandora.css | 1 + 11 files changed, 436 insertions(+), 155 deletions(-) diff --git a/pandora_console/extensions/db_status.php b/pandora_console/extensions/db_status.php index 98b95783be..25965efb0c 100755 --- a/pandora_console/extensions/db_status.php +++ b/pandora_console/extensions/db_status.php @@ -21,13 +21,23 @@ function extension_db_status() $db_name = get_parameter('db_name', ''); $db_status_execute = (bool) get_parameter('db_status_execute', false); - ui_print_page_header( + ui_print_standard_header( __('DB Schema check'), 'images/extensions.png', false, 'db_status_tab', true, - '' + [], + [ + [ + 'link' => '', + 'label' => __('Admin tools'), + ], + [ + 'link' => '', + 'label' => __('Run test'), + ], + ] ); if (!is_user_admin($config['id_user'])) { @@ -46,38 +56,86 @@ function extension_db_status() __('At the moment the checks is for MySQL/MariaDB.') ); - echo "
"; + echo ""; echo '
'; echo ''.__('DB settings').''; $table = new stdClass(); $table->data = []; $row = []; - $row[] = __('DB User with privileges'); - $row[] = html_print_input_text('db_user', $db_user, '', 50, 255, true); - $row[] = __('DB Password for this user'); - $row[] = html_print_input_password('db_password', $db_password, '', 50, 255, true); + $row[] = html_print_label_input_block( + __('DB User with privileges'), + html_print_input_text( + 'db_user', + $db_user, + '', + 50, + 255, + true, + false, + false, + '', + 'w100p mrgn_top_10px' + ) + ); + $row[] = html_print_label_input_block( + __('DB Password for this user'), + html_print_input_password( + 'db_password', + $db_password, + '', + 50, + 255, + true, + false, + false, + 'w100p mrgn_top_10px' + ) + ); $table->data[] = $row; $row = []; - $row[] = __('DB Hostname'); - $row[] = html_print_input_text('db_host', $db_host, '', 50, 255, true); - $row[] = __('DB Name (temporal for testing)'); - $row[] = html_print_input_text('db_name', $db_name, '', 50, 255, true); + $row[] = html_print_label_input_block( + __('DB Hostname'), + html_print_input_text( + 'db_host', + $db_host, + '', + 50, + 255, + true, + false, + false, + '', + 'w100p mrgn_top_10px' + ) + ); + $row[] = html_print_label_input_block( + __('DB Name (temporal for testing)'), + html_print_input_text( + 'db_name', + $db_name, + '', + 50, + 255, + true, + false, + false, + '', + 'w100p mrgn_top_10px' + ) + ); $table->data[] = $row; html_print_table($table); echo '
'; - html_print_div( - [ - 'class' => 'action-buttons', - 'content' => html_print_submit_button( - __('Execute Test'), - 'submit', - false, - [ 'icon' => 'cog' ], - true - ), - ] + html_print_action_buttons( + html_print_submit_button( + __('Execute Test'), + 'submit', + false, + [ 'icon' => 'cog' ], + true + ) ); html_print_input_hidden('db_status_execute', 1); diff --git a/pandora_console/extensions/dbmanager.php b/pandora_console/extensions/dbmanager.php index 3aacc776a0..1ec40b79f1 100644 --- a/pandora_console/extensions/dbmanager.php +++ b/pandora_console/extensions/dbmanager.php @@ -132,47 +132,37 @@ function dbmgr_extension_main() echo $warning_message; } + ui_print_warning_message( + __( + "This is an advanced extension to interface with %s database directly from WEB console + using native SQL sentences. Please note that you can damage your %s installation + if you don't know exactly what are you are doing, + this means that you can severily damage your setup using this extension. + This extension is intended to be used only by experienced users + with a depth knowledge of %s internals.", + get_product_name(), + get_product_name(), + get_product_name() + ) + ); + echo ""; $table = new stdClass(); $table->id = 'db_interface'; - $table->class = 'databox'; + $table->class = 'databox no_border filter-table-adv'; $table->width = '100%'; $table->data = []; - $table->head = []; $table->colspan = []; - $table->rowstyle = []; + $table->style[0] = 'width: 30%;'; + $table->style[1] = 'width: 70%;'; - $table->colspan[0][0] = 2; $table->colspan[1][0] = 2; - $table->rowspan[2][0] = 3; - $table->rowclass[0] = 'notify'; - $table->rowclass[3] = 'pdd_5px'; - $table->rowclass[3] = 'flex-content-right'; - $table->rowclass[4] = 'flex-content-right'; - - $data[0][0] = __( - "This is an advanced extension to interface with %s database directly from WEB console - using native SQL sentences. Please note that you can damage your %s installation - if you don't know exactly what are you are doing, - this means that you can severily damage your setup using this extension. - This extension is intended to be used only by experienced users - with a depth knowledge of %s internals.", - get_product_name(), - get_product_name(), - get_product_name() - ); - - $data[1][0] = "Some samples of usage:
SHOW STATUS;
DESCRIBE tagente
SELECT * FROM tserver
UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'
"; - - $data[2][0] = html_print_textarea( - 'sql', - 5, - 50, - html_entity_decode($sql, ENT_QUOTES), - '', - true + $data[0][0] = "Some samples of usage:
SHOW STATUS;
DESCRIBE tagente
SELECT * FROM tserver
UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'
"; + $data[0][0] = html_print_label_input_block( + __('Some samples of usage:'), + "
SHOW STATUS;
DESCRIBE tagente
SELECT * FROM tserver
UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'
" ); if (is_metaconsole() === true) { @@ -191,35 +181,57 @@ function dbmgr_extension_main() $servers = []; } - $data[3][2] = html_print_input( - [ - 'name' => 'node_id', - 'type' => 'select', - 'fields' => $servers, - 'selected' => $node_id, - 'nothing' => __('This metaconsole'), - 'nothing_value' => -1, - 'return' => true, - 'label' => _('Select query target'), - ] + $data[0][1] = html_print_label_input_block( + __('Select query target'), + html_print_select( + $servers, + 'node_id', + $node_id, + '', + __('This metaconsole'), + -1, + true, + false, + false, + 'w40p', + false, + 'width: 40%;' + ) ); } - $data[4][2] = html_print_div( - [ - 'class' => 'action-buttons', - 'content' => html_print_submit_button( - __('Execute SQL'), - '', - false, - [ 'icon' => 'cog' ], - true - ), - ] + $data[1][0] = html_print_textarea( + 'sql', + 3, + 50, + html_entity_decode($sql, ENT_QUOTES), + 'placeholder="'.__('Type your query here...').'"', + true, + 'w100p' + ); + + $execute_button = html_print_submit_button( + __('Execute SQL'), + '', + false, + [ 'icon' => 'cog' ], + true ); $table->data = $data; - html_print_table($table); + // html_print_table($table); + html_print_action_buttons($execute_button); + ui_toggle( + html_print_table($table, true), + ''.__('SQL query').'', + __('SQL query'), + 'query', + false, + false, + '', + 'white-box-content no_border', + 'box-flat white_table_graph fixed_filter_bar' + ); echo '
'; // Processing SQL Code. @@ -227,10 +239,6 @@ function dbmgr_extension_main() return; } - echo '
'; - echo '
'; - echo '
'; - try { if (\is_metaconsole() === true && $node_id !== -1) { $node = new Node($node_id); diff --git a/pandora_console/extensions/dbmanager/dbmanager.css b/pandora_console/extensions/dbmanager/dbmanager.css index 1e44dce3a8..1882b71e92 100644 --- a/pandora_console/extensions/dbmanager/dbmanager.css +++ b/pandora_console/extensions/dbmanager/dbmanager.css @@ -24,7 +24,6 @@ table.dbmanager th { } textarea { - min-height: 50px; - height: 50px; - width: 95%; + width: 100% !important; + max-width: 100% !important; } diff --git a/pandora_console/extensions/extension_uploader.php b/pandora_console/extensions/extension_uploader.php index f5447703e8..d989a3661b 100644 --- a/pandora_console/extensions/extension_uploader.php +++ b/pandora_console/extensions/extension_uploader.php @@ -25,13 +25,28 @@ function extension_uploader_extensions() return; } - ui_print_page_header( - __('Uploader extension'), + // Header. + ui_print_standard_header( + __('Extensions'), 'images/extensions.png', false, '', true, - '' + [], + [ + [ + 'link' => '', + 'label' => __('Admin tools'), + ], + [ + 'link' => '', + 'label' => __('Extension manager'), + ], + [ + 'link' => '', + 'label' => __('Uploader extension'), + ], + ] ); $upload = (bool) get_parameter('upload', 0); @@ -77,20 +92,52 @@ function extension_uploader_extensions() $table = new stdClass(); $table->width = '100%'; - $table->class = 'databox filters'; + $table->class = 'databox filters filter-table-adv'; + $table->size[0] = '20%'; + $table->size[1] = '20%'; + $table->size[2] = '60%'; $table->data = []; - $table->data[0][0] = __('Upload extension'); - $table->data[0][1] = html_print_input_file('extension', true).ui_print_help_tip(__('Upload the extension as a zip file.'), true); + + $table->data[0][0] = html_print_label_input_block( + __('Upload extension').ui_print_help_tip(__('Upload the extension as a zip file.'), true), + html_print_input_file( + 'extension', + true, + [ + 'required' => true, + 'accept' => '.zip', + ] + ) + ); + if (enterprise_installed()) { - $table->data[0][2] = __('Upload enterprise extension').' '.html_print_checkbox('upload_enterprise', 1, false, true); + $table->data[0][1] = html_print_label_input_block( + __('Upload enterprise extension'), + html_print_checkbox( + 'upload_enterprise', + 1, + false, + true + ) + ); + } else { + $table->data[0][1] = ''; } + $table->data[0][2] = ''; + echo "
"; html_print_table($table); - echo "
"; html_print_input_hidden('upload', 1); - html_print_submit_button(__('Upload'), 'submit', false, 'class="sub add"'); - echo '
'; + html_print_action_buttons( + html_print_submit_button( + __('Upload'), + 'submit', + false, + ['icon' => 'wand'], + true + ) + ); echo '
'; } diff --git a/pandora_console/godmode/extensions.php b/pandora_console/godmode/extensions.php index 966ecd0ce7..8faef70d3e 100644 --- a/pandora_console/godmode/extensions.php +++ b/pandora_console/godmode/extensions.php @@ -24,8 +24,29 @@ if (! check_acl($config['id_user'], 0, 'PM')) { exit; } -// Header -ui_print_page_header(__('Extensions').' » '.__('Defined extensions'), 'images/extensions.png', false, '', true, ''); +// Header. +ui_print_standard_header( + __('Extensions'), + 'images/extensions.png', + false, + '', + true, + [], + [ + [ + 'link' => '', + 'label' => __('Admin tools'), + ], + [ + 'link' => '', + 'label' => __('Extension manager'), + ], + [ + 'link' => '', + 'label' => __('Defined extensions'), + ], + ] +); if (count($config['extensions']) == 0) { $extensions = extensions_get_extension_info(); @@ -132,7 +153,7 @@ if ($disabled != '') { $extensions = extensions_get_extension_info(); $table = new StdClass; -$table->width = '98%'; +$table->width = '100%'; $table->head = []; $table->head[] = __('File'); @@ -146,7 +167,7 @@ $table->head[] = __('Login Function'); $table->head[] = __('Agent operation tab'); $table->head[] = __('Agent godmode tab'); $table->head[] = __('Operation'); -$table->width = '100%'; + $table->class = 'info_table'; $table->align = []; @@ -254,9 +275,39 @@ foreach ($extensions as $file => $extension) { if ($file != 'update_manager.php') { $table->cellclass[][10] = 'table_action_buttons'; if (!$extension['enabled']) { - $data[] = ''.html_print_image('images/cross.disabled.png', true, ['class' => 'filter_none']).''.' '.html_print_image('images/lightbulb_off.png', true, ['class' => 'filter_none']).''; + $data[] = html_print_menu_button( + [ + 'href' => 'index.php?sec=godmode/extensions&sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&delete='.$file, + 'image' => 'images/cross.disabled.png', + 'title' => __('Delete'), + 'onClick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;', + ], + true + ).html_print_menu_button( + [ + 'href' => 'index.php?sec=godmode/extensions&sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&enabled='.$file, + 'image' => 'images/lightbulb_off.png', + 'title' => __('Delete'), + ], + true + ); } else { - $data[] = ''.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).''.' '.html_print_image('images/lightbulb.png', true).''; + $data[] = html_print_menu_button( + [ + 'href' => 'index.php?sec=godmode/extensions&sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&delete='.$file, + 'image' => 'images/cross.png', + 'title' => __('Delete'), + 'onClick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;', + ], + true + ).html_print_menu_button( + [ + 'href' => 'index.php?sec=godmode/extensions&sec2=godmode/extensions&enterprise='.(int) $extension['enterprise'].'&disabled='.$file, + 'image' => 'images/lightbulb.png', + 'title' => __('Delete'), + ], + true + ); } } else { $data[] = ''; diff --git a/pandora_console/godmode/setup/file_manager.php b/pandora_console/godmode/setup/file_manager.php index f54cf7f7f6..dbbd2674be 100644 --- a/pandora_console/godmode/setup/file_manager.php +++ b/pandora_console/godmode/setup/file_manager.php @@ -80,7 +80,7 @@ if (empty($directory) === true) { $real_directory = realpath($config['homedir'].'/'.$directory); -echo '

'.__('Index of %s', io_safe_input($directory)).'

'; +echo '

'.__('Index of %s', io_safe_input($directory)).'

'; $upload_file = (bool) get_parameter('upload_file'); $create_text_file = (bool) get_parameter('create_text_file'); diff --git a/pandora_console/godmode/setup/news.php b/pandora_console/godmode/setup/news.php index 633e8f224f..efbf574779 100644 --- a/pandora_console/godmode/setup/news.php +++ b/pandora_console/godmode/setup/news.php @@ -170,46 +170,118 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) { $table->id = 'news'; $table->cellpadding = 4; $table->cellspacing = 4; - $table->class = 'databox filters'; + $table->class = 'databox filters filter-table-adv'; $table->head = []; $table->data = []; - $table->style[0] = 'font-weight: bold;'; - $table->style[1] = 'font-weight: bold;'; - $table->style[2] = 'font-weight: bold;'; - $table->style[3] = 'font-weight: bold;'; - $table->style[4] = 'font-weight: bold;'; + $table->size[0] = '33%'; + $table->size[1] = '33%'; + $table->colspan[2][0] = 2; + $table->rowclass[2] = 'w100p'; $data = []; - $data[0] = __('Subject').'
'; - $data[0] .= ''; + $data[0] = html_print_label_input_block( + __('Subject'), + html_print_input_text( + 'subject', + $subject, + '', + 35, + 255, + true + ) + ); - $data[1] = __('Group').'
'; - $data[1] .= '
'; - $data[1] .= html_print_select_groups($config['id_user'], 'ER', users_can_manage_group_all(), 'id_group', $id_group, '', '', 0, true, false, false, ''); - $data[1] .= '
'; + $data[1] = html_print_label_input_block( + __('Group'), + html_print_select_groups( + $config['id_user'], + 'ER', + users_can_manage_group_all(), + 'id_group', + $id_group, + '', + '', + 0, + true, + false, + false, + 'w100p', + false, + 'width: 100%;' + ) + ); + $table->data[] = $data; - $data[2] = __('Modal screen').'
'; - $data[2] .= html_print_checkbox_extended('modal', 1, $modal, false, '', 'class="mrgn_top_5 mrg_btt_7"', true); + $data = []; + $data[0] = html_print_label_input_block( + __('Modal screen'), + html_print_checkbox_extended( + 'modal', + 1, + $modal, + false, + '', + 'class="w100p"', + true + ) + ); - $data[3] = __('Expire').'
'; - $data[3] .= html_print_checkbox_extended('expire', 1, $expire, false, '', 'class="mrgn_top_5 mrg_btt_7"', true); - - $data[4] = __('Expiration').'
'; - $data[4] .= html_print_input_text('expire_date', $expire_date, '', 12, 10, true).' '; - $data[4] .= html_print_input_text('expire_time', $expire_time, '', 10, 7, true).' '; + $data[1] = '
'.html_print_label_input_block( + __('Expire'), + html_print_checkbox_extended( + 'expire', + 1, + $expire, + false, + '', + 'class="w100p"', + true + ), + ['div_class' => 'display-grid'] + ); + $data[1] .= html_print_label_input_block( + __('Expiration'), + '
'.html_print_input_text( + 'expire_date', + $expire_date, + '', + 12, + 10, + true + ).' '.html_print_input_text( + 'expire_time', + $expire_time, + '', + 10, + 7, + true + ).'
', + [ + 'div_class' => 'display-grid mrgn_lft_20px', + 'div_id' => 'news-0-4', + ] + ).'
'; $table->rowclass[] = ''; $table->data[] = $data; $data = []; - $data[0] = __('Text').'
'; - $data[0] .= html_print_textarea('text', 25, 15, $text, '', true); - $table->rowclass[] = ''; - $table->colspan[1][0] = 5; + $data[0] = html_print_label_input_block( + __('Text'), + html_print_textarea( + 'text', + 25, + 100, + $text, + '', + true, + 'w100p' + ) + ); $table->data[] = $data; - echo '
'; + echo ''; if ($creation_mode == 1) { echo ""; } else { @@ -228,11 +300,25 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) { echo ""; echo "
"; if (isset($_GET['form_add'])) { - echo ""; + $submit_button = html_print_submit_button( + __('Create'), + 'crtbutton', + false, + ['icon' => 'wand'], + true + ); } else { - echo ""; + $submit_button = html_print_submit_button( + __('Update'), + 'crtbutton', + false, + ['icon' => 'wand'], + true + ); } + html_print_action_buttons($submit_button); + echo '
'; } else { $rows = db_get_all_rows_in_table('tnews', 'timestamp'); @@ -293,11 +379,17 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) { echo ''; } - echo ""; - echo "
"; echo "
"; - echo ""; - echo '
'; + html_print_action_buttons( + html_print_submit_button( + __('Add'), + 'form_add', + false, + ['icon' => 'wand'], + true + ) + ); + echo ''; } /* diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index ccdb086f9a..70d6cba47e 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -791,6 +791,10 @@ if ($save_filter_modal) { $table->rowid[1] = 'save_filter_row1'; $table->size[0] = '50%'; $table->size[1] = '50%'; + $table->rowclass[1] = 'flex'; + $table->rowclass[2] = 'flex'; + $table->rowclass[3] = 'flex'; + $table->rowclass[4] = 'flex'; $data[0] = ''.__('Filter name').''.$jump; $data[0] .= html_print_input_text('id_name', '', '', 15, 255, true); if (is_metaconsole()) { diff --git a/pandora_console/include/class/EventSound.class.php b/pandora_console/include/class/EventSound.class.php index b943e9cce1..283d99d296 100644 --- a/pandora_console/include/class/EventSound.class.php +++ b/pandora_console/include/class/EventSound.class.php @@ -239,38 +239,53 @@ class EventSound extends HTML ui_require_css_file('discovery'); if ($tab === 'add') { - echo '
'; + echo ''; $table = new stdClass(); $table->width = '100%'; - $table->class = 'databox filters'; + $table->class = 'databox filters filter-table-adv'; $table->data = []; - $table->data[0][0] = __('Name:'); + $table->size[0] = '50%'; + $table->size[1] = '50%'; - $table->data[0][1] = html_print_input_text( - 'name', - '', - '', - 80, - 100, - true, - false, - true + $table->data[0][0] = html_print_label_input_block( + __('Name:'), + html_print_input_text( + 'name', + '', + '', + 80, + 100, + true, + false, + true + ) ); - $table->data[1][0] = __('WAV Sound'); - $table->data[1][1] = html_print_input_file('file', true, ['required' => true]); + $table->data[0][1] = html_print_label_input_block( + __('WAV Sound'), + html_print_input_file( + 'file', + true, + [ + 'required' => true, + 'accept' => 'audio/*', + ] + ) + ); html_print_table($table); - echo '
'; - html_print_submit_button( - __('Create'), - 'save_sound', - false, - 'class="sub wand"' + html_print_action_buttons( + html_print_submit_button( + __('Create'), + 'save_sound', + false, + ['icon' => 'wand'], + true + ) ); - echo '
'; echo '
'; // Load own javascript file. @@ -305,7 +320,7 @@ class EventSound extends HTML [ 'id' => $this->tableId, 'class' => 'info_table', - 'style' => 'width: 100%', + 'style' => 'width: 99%', 'columns' => $columns, 'column_names' => $column_names, 'ajax_url' => $this->ajaxController, @@ -321,7 +336,7 @@ class EventSound extends HTML [ 'label' => __('Free search').ui_print_help_tip(__('Search filter by Name or Sound fields content'), true), 'type' => 'text', - 'class' => 'w200px', + 'class' => 'w70p', 'id' => 'filter_text', 'name' => 'filter_text', ], @@ -333,12 +348,13 @@ class EventSound extends HTML '0' => __('No'), '1' => __('Yes'), ], - 'class' => 'w100px', + 'class' => 'w100p', 'id' => 'active', 'name' => 'active', ], ], ], + 'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar ', ] ); } catch (Exception $e) { @@ -350,6 +366,7 @@ class EventSound extends HTML close_meta_frame(); } + html_print_action_buttons(''); // Load own javascript file. echo $this->loadJS(); } diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 5d6f413573..56a19e4d1d 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -4773,6 +4773,10 @@ function html_print_input_file($name, $return=false, $options=false) if (isset($options['style']) === true) { $output .= ' style="'.$options['style'].'"'; } + + if (isset($options['accept']) === true) { + $output .= ' accept="'.$options['accept'].'"'; + } } // Close input. diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 43e66868bd..fc4acd7488 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -11452,6 +11452,7 @@ form#satellite_conf_edit > fieldset.full-column { background-repeat: no-repeat; background-size: 24px; background-image: url("../../images/enable.svg"); + padding-right: 45px; } .orientation-report { From 13261a1298c6fc6bda512ca2321b41fb499ff115 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 9 Mar 2023 16:08:33 +0100 Subject: [PATCH 08/17] Availability Graph correction --- pandora_console/include/functions_reporting_html.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 1f86ef8f0d..71e621c4b3 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -4643,7 +4643,7 @@ function reporting_html_availability_graph($table, $item, $pdf=0) $table1->data[$k_chart][0] .= ' (24 x 7)'; } - $total_values += $sla_value; + $total_values .= $sla_value; $count_total_charts++; $table1->data[$k_chart][1] = $chart['chart']; $table1->data[$k_chart][2] = "".$sla_value.'
'; @@ -4720,7 +4720,7 @@ function reporting_html_availability_graph($table, $item, $pdf=0) case 'result': default: - $total_values += $sla_value; + $total_values .= $sla_value; $count_total_charts++; $title = ''.__('Result').''; $sla_value_text = "".$sla_value.''; From 7b3ed98d4b5fc6f57b75575b8870554a514a652f Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 9 Mar 2023 16:28:08 +0100 Subject: [PATCH 09/17] Agent inventory fix graph --- pandora_console/include/functions_reporting.php | 4 ++++ pandora_console/include/functions_ui.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index ea3f7de46f..61a79e224b 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -2618,6 +2618,10 @@ function reporting_agents_inventory($report, $content) $es_agents_inventory_display_options = []; } + if ($es_agent_custom_fields === '') { + $es_agent_custom_fields = []; + } + $custom_field_sql = ''; $search_sql = ''; diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index fe1e577088..daf9015cc0 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -728,7 +728,7 @@ function ui_print_group_icon($id_group, $return=false, $path='', $style='', $lin } $output .= html_print_image( - 'images/'.$icon, + 'images/'.$icon.'.svg', true, [ 'style' => $style, From 068f23f2780acfdc71d4284c14bab25d8253c6ca Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 9 Mar 2023 16:33:58 +0100 Subject: [PATCH 10/17] Tables icon svg correction reports --- pandora_console/include/functions_ui.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index daf9015cc0..ede1cbb165 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -727,8 +727,9 @@ function ui_print_group_icon($id_group, $return=false, $path='', $style='', $lin } } + $icon = (str_contains($icon, '.svg') === true) ? $icon : $icon.'.svg'; $output .= html_print_image( - 'images/'.$icon.'.svg', + 'images/'.$icon, true, [ 'style' => $style, From a9abda1fd48e9b5ff764985d3883a7d230fe6ea1 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Thu, 9 Mar 2023 16:37:43 +0100 Subject: [PATCH 11/17] Network maps adjust --- pandora_console/include/styles/pandora.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index c0d50bfb3a..c113fd2086 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -8141,7 +8141,8 @@ div.graph div.legend table { min-height: 460px; position: relative; overflow: hidden; - background-color: #fafafa; + background-color: var(--secondary-color); + min-height: calc(100vh - 200px); } /* From d4fa2831bf6e9732d316aaeb331ba7d856445257 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Thu, 9 Mar 2023 16:44:45 +0100 Subject: [PATCH 12/17] Inventory tab --- pandora_console/godmode/agentes/configurar_agente.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 27f3b7ea3a..339060092d 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -476,11 +476,6 @@ if ($id_agente) { $inventorytab['active'] = false; } - $inventorytab = enterprise_hook('inventory_tab'); - if ($inventorytab === ENTERPRISE_NOT_HOOK) { - $inventorytab = ''; - } - $has_remote_conf = enterprise_hook( 'config_agents_has_remote_configuration', [$id_agente] From d3ed5a93fc945f890dbd617fab9be152a5e043d1 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Thu, 9 Mar 2023 17:21:18 +0100 Subject: [PATCH 13/17] Admin tools --- pandora_console/extensions/api_checker.php | 185 +++++++++++------- pandora_console/extensions/files_repo.php | 24 ++- .../extensions/files_repo/files_repo_form.php | 144 +++++++++----- pandora_console/extensions/pandora_logs.php | 79 ++++++-- pandora_console/include/styles/pandora.css | 2 +- 5 files changed, 291 insertions(+), 143 deletions(-) diff --git a/pandora_console/extensions/api_checker.php b/pandora_console/extensions/api_checker.php index 2ffc5ef6c8..9b08815349 100755 --- a/pandora_console/extensions/api_checker.php +++ b/pandora_console/extensions/api_checker.php @@ -195,140 +195,183 @@ function extension_api_checker() ); } - ui_print_page_header( - __('API checker'), + // Header. + ui_print_standard_header( + __('Extensions'), 'images/extensions.png', false, '', true, - '' + [], + [ + [ + 'link' => '', + 'label' => __('Admin tools'), + ], + [ + 'link' => '', + 'label' => __('Extension manager'), + ], + [ + 'link' => '', + 'label' => __('API checker'), + ], + ] ); $table = new stdClass(); + $table->width = '100%'; + $table->class = 'databox filters filter-table-adv'; + $table->size[0] = '50%'; + $table->size[1] = '50%'; $table->data = []; $row = []; - $row[] = __('IP'); - $row[] = html_print_input_text('ip', $ip, '', 50, 255, true); + $row[] = html_print_label_input_block( + __('IP'), + html_print_input_text('ip', $ip, '', 50, 255, true) + ); + + $row[] = html_print_label_input_block( + __('%s Console URL', get_product_name()), + html_print_input_text('pandora_url', $pandora_url, '', 50, 255, true) + ); $table->data[] = $row; $row = []; - $row[] = __('%s Console URL', get_product_name()); - $row[] = html_print_input_text('pandora_url', $pandora_url, '', 50, 255, true); + $row[] = html_print_label_input_block( + __('API Token').ui_print_help_tip(__('Use API Token instead API Pass, User and Password.'), true), + html_print_input_text('token', $token, '', 50, 255, true) + ); + + $row[] = html_print_label_input_block( + __('API Pass'), + html_print_input_password('apipass', $apipass, '', 50, 255, true) + ); $table->data[] = $row; $row = []; - $row[] = __('API Token').ui_print_help_tip(__('Use API Token instead API Pass, User and Password.'), true); - $row[] = html_print_input_text('token', $token, '', 50, 255, true); - $table->data[] = $row; + $row[] = html_print_label_input_block( + __('User'), + html_print_input_text('user', $user, '', 50, 255, true) + ); - $row = []; - $row[] = __('API Pass'); - $row[] = html_print_input_password('apipass', $apipass, '', 50, 255, true); - $table->data[] = $row; - - $row = []; - $row[] = __('User'); - $row[] = html_print_input_text('user', $user, '', 50, 255, true); - $table->data[] = $row; - - $row = []; - $row[] = __('Password'); - $row[] = html_print_input_password('password', $password, '', 50, 255, true); + $row[] = html_print_label_input_block( + __('Password'), + html_print_input_password('password', $password, '', 50, 255, true) + ); $table->data[] = $row; $table2 = new stdClass(); + $table2->width = '100%'; + $table2->class = 'databox filters filter-table-adv'; + $table2->size[0] = '50%'; + $table2->size[1] = '50%'; $table2->data = []; $row = []; - $row[] = __('Action (get or set)'); - $row[] = html_print_input_text('op', $op, '', 50, 255, true); + $row[] = html_print_label_input_block( + __('Action (get or set)'), + html_print_input_text('op', $op, '', 50, 255, true) + ); + + $row[] = html_print_label_input_block( + __('Operation'), + html_print_input_text('op2', $op2, '', 50, 255, true) + ); $table2->data[] = $row; $row = []; - $row[] = __('Operation'); - $row[] = html_print_input_text('op2', $op2, '', 50, 255, true); + $row[] = html_print_label_input_block( + __('ID'), + html_print_input_text('id', $id, '', 50, 255, true) + ); + + $row[] = html_print_label_input_block( + __('ID 2'), + html_print_input_text('id2', $id2, '', 50, 255, true) + ); $table2->data[] = $row; $row = []; - $row[] = __('ID'); - $row[] = html_print_input_text('id', $id, '', 50, 255, true); + $row[] = html_print_label_input_block( + __('Return Type'), + html_print_input_text('return_type', $return_type, '', 50, 255, true) + ); + + $row[] = html_print_label_input_block( + __('Other'), + html_print_input_text('other', $other, '', 50, 255, true) + ); $table2->data[] = $row; $row = []; - $row[] = __('ID 2'); - $row[] = html_print_input_text('id2', $id2, '', 50, 255, true); - $table2->data[] = $row; - - $row = []; - $row[] = __('Return Type'); - $row[] = html_print_input_text('return_type', $return_type, '', 50, 255, true); - $table2->data[] = $row; - - $row = []; - $row[] = __('Other'); - $row[] = html_print_input_text('other', $other, '', 50, 255, true); - $table2->data[] = $row; - - $row = []; - $row[] = __('Other Mode'); - $row[] = html_print_input_text('other_mode', $other_mode, '', 50, 255, true); + $row[] = html_print_label_input_block( + __('Other Mode'), + html_print_input_text('other_mode', $other_mode, '', 50, 255, true) + ); $table2->data[] = $row; $table3 = new stdClass(); + $table3->width = '100%'; + $table3->class = 'databox filters filter-table-adv'; + $table3->size[0] = '50%'; + $table3->size[1] = '50%'; $table3->data = []; $row = []; - $row[] = __('Raw URL'); - $row[] = html_print_input_text('url', $url, '', 50, 2048, true); + $row[] = html_print_label_input_block( + __('Raw URL'), + html_print_input_text('url', $url, '', 50, 2048, true) + ); $table3->data[] = $row; - echo "
"; - echo '
'; + echo ""; + echo '
'; echo ''.__('Credentials').''; html_print_table($table); echo '
'; - echo '
'; + echo '
'; echo ''.__('Call parameters').' '.ui_print_help_tip(__('Action: get Operation: module_last_value id: 63'), true).''; html_print_table($table2); echo '
'; echo "
"; echo '
'; - echo '
'; + echo '
'; echo ''.__('Custom URL').''; html_print_table($table3); echo '
'; html_print_input_hidden('api_execute', 1); - html_print_div( - [ - 'class' => 'action-buttons', - 'content' => html_print_submit_button( - __('Call'), - 'submit', - false, - [ 'icon' => 'next' ], - true - ), - ] + html_print_action_buttons( + html_print_submit_button( + __('Call'), + 'submit', + false, + [ 'icon' => 'next' ], + true + ) ); echo ''; if ($api_execute === true) { - echo '
'; + echo '
'; echo ''.__('Result').''; - echo __('URL').'
'; - html_print_input_password('url', $return_call_api['url'], '', 150, 255, false, true); - echo " "; - html_print_image('images/input_zoom.png'); - echo ''; + echo html_print_label_input_block( + __('URL'), + html_print_input_password('url', $return_call_api['url'], '', 150, 255, true, true, false, 'mrgn_top_10px'), + ['label_class' => 'font-title-font'] + ); echo '
'; - echo __('Result').'
'; - html_print_textarea('result', 30, 20, $return_call_api['result'], 'readonly="readonly"'); + echo html_print_label_input_block( + __('Result'), + html_print_textarea('result', 30, 20, $return_call_api['result'], 'readonly="readonly"', true, 'w100p mrgn_top_10px'), + ['label_class' => 'font-title-font'] + ); echo '
'; } ?> diff --git a/pandora_console/extensions/files_repo.php b/pandora_console/extensions/files_repo.php index c319954748..0313af90b2 100644 --- a/pandora_console/extensions/files_repo.php +++ b/pandora_console/extensions/files_repo.php @@ -126,8 +126,30 @@ function pandora_files_repo_godmode() 'godmode' => $godmode, 'operation' => $operation, ]; + // Header. - ui_print_page_header(__('Files repository manager'), 'images/extensions.png', false, '', true, $onheader); + ui_print_standard_header( + __('Extensions'), + 'images/extensions.png', + false, + '', + true, + $onheader, + [ + [ + 'link' => '', + 'label' => __('Admin tools'), + ], + [ + 'link' => '', + 'label' => __('Extension manager'), + ], + [ + 'link' => '', + 'label' => __('Files repository manager'), + ], + ] + ); $full_extensions_dir = $config['homedir'].'/'.EXTENSIONS_DIR.'/'; include_once $full_extensions_dir.'files_repo/functions_files_repo.php'; diff --git a/pandora_console/extensions/files_repo/files_repo_form.php b/pandora_console/extensions/files_repo/files_repo_form.php index a78606c271..d96357e87b 100644 --- a/pandora_console/extensions/files_repo/files_repo_form.php +++ b/pandora_console/extensions/files_repo/files_repo_form.php @@ -32,17 +32,15 @@ if (isset($file_id) && $file_id > 0) { $table = new stdClass(); $table->width = '100%'; -$table->class = 'databox filters'; -$table->style = []; -$table->style[0] = 'font-weight: bold;'; -$table->style[2] = 'text-align: center;'; -$table->colspan = []; +$table->class = 'databox filters filter-table-adv'; +$table->size[0] = '50%'; +$table->size[1] = '50%'; $table->data = []; -// GROUPS +// GROUPS. $groups = groups_get_all(); -// Add the All group to the beginning to be always the first -// Use this instead array_unshift to keep the array keys +// Add the All group to the beginning to be always the first. +// Use this instead array_unshift to keep the array keys. $groups = ([0 => __('All')] + $groups); $groups_selected = []; foreach ($groups as $id => $name) { @@ -52,66 +50,110 @@ foreach ($groups as $id => $name) { } $row = []; -$row[0] = __('Groups'); -$row[1] = '
'.html_print_select_groups( - // Id_user. - false, - // Privilege. - 'AR', - // ReturnAllGroup. - true, - // Name. - 'groups[]', - // Selected. - $groups_selected, - // Script. - '', - // Nothing. - '', - // Nothing_value. - 0, - // Return. - true, - // Multiple. - true -).'
'; -$table->data[] = $row; -$table->colspan[][1] = 3; +$row[0] = html_print_label_input_block( + __('Groups'), + html_print_select_groups( + // Id_user. + false, + // Privilege. + 'AR', + // ReturnAllGroup. + true, + // Name. + 'groups[]', + // Selected. + $groups_selected, + // Script. + '', + // Nothing. + '', + // Nothing_value. + 0, + // Return. + true, + // Multiple. + true + ) +); -// DESCRIPTION -$row = []; -$row[0] = __('Description'); -$row[0] .= ui_print_help_tip(__('Only 200 characters are permitted'), true); -$row[1] = html_print_textarea('description', 3, 20, $file['description'], 'class="file_repo_description"', true); +// DESCRIPTION. +$row[1] = html_print_label_input_block( + __('Description').ui_print_help_tip(__('Only 200 characters are permitted'), true), + html_print_textarea( + 'description', + 4, + 20, + $file['description'], + 'class="file_repo_description" style="min-height: 60px; max-height: 60px;"', + true + ) +); $table->data[] = $row; -$table->colspan[][1] = 3; -// FILE and SUBMIT BUTTON +// FILE and SUBMIT BUTTON. $row = []; -// Public checkbox +// Public checkbox. $checkbox = html_print_checkbox('public', 1, (bool) !empty($file['hash']), true); $style = 'class="inline padding-2-10"'; $row[0] = __('File'); if ($file_id > 0) { - $row[1] = $file['name']; - $row[2] = "
".__('Public link')." $checkbox
"; - $row[3] = html_print_submit_button(__('Update'), 'submit', false, 'class="sub upd"', true); - $row[3] .= html_print_input_hidden('update_file', 1, true); - $row[3] .= html_print_input_hidden('file_id', $file_id, true); + $submit_button = html_print_submit_button( + __('Update'), + 'submit', + false, + ['icon' => 'wand'], + true + ); + + $row[0] = html_print_label_input_block( + __('File'), + $file['name'] + ); + + $row[1] = html_print_label_input_block( + __('Public link'), + $checkbox.html_print_input_hidden( + 'file_id', + $file_id, + true + ) + ); } else { - $row[1] = html_print_input_file('upfile', true); - $row[2] = "
".__('Public link')." $checkbox
"; - $row[3] = html_print_submit_button(__('Add'), 'submit', false, 'class="sub add"', true); - $row[3] .= html_print_input_hidden('add_file', 1, true); + $submit_button = html_print_submit_button( + __('Add'), + 'submit', + false, + ['icon' => 'wand'], + true + ); + + $row[0] = html_print_label_input_block( + __('File'), + html_print_input_file( + 'upfile', + true + ) + ); + + $row[1] = html_print_label_input_block( + __('Public link'), + $checkbox.html_print_input_hidden( + 'add_file', + 1, + true + ) + ); } + + $table->data[] = $row; -$table->colspan[][1] = 1; $url = ui_get_full_url('index.php?sec=godmode/extensions&sec2=extensions/files_repo'); echo "
"; html_print_table($table); +html_print_action_buttons($submit_button); echo '
'; ?> diff --git a/pandora_console/extensions/pandora_logs.php b/pandora_console/extensions/pandora_logs.php index 21b817b978..28dcaa0814 100644 --- a/pandora_console/extensions/pandora_logs.php +++ b/pandora_console/extensions/pandora_logs.php @@ -11,11 +11,12 @@ // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -function view_logfile($file_name) +function view_logfile($file_name, $toggle=false) { global $config; $memory_limit = ini_get('memory_limit'); + $code = ''; if (strstr($memory_limit, 'M') !== false) { $memory_limit = str_replace('M', '', $memory_limit); @@ -31,21 +32,37 @@ function view_logfile($file_name) $file_size = filesize($file_name); if ($memory_limit < $file_size) { - echo "

$file_name (".__('File is too large than PHP memory allocated in the system.').')

'; - echo '

'.__('The preview file is imposible.').'

'; + $code .= '

'.$file_name.' ('.__('File is too large than PHP memory allocated in the system.').')

'; + $code .= '

'.__('The preview file is imposible.').'

'; } else if ($file_size > ($config['max_log_size'] * 1000)) { $data = file_get_contents($file_name, false, null, ($file_size - ($config['max_log_size'] * 1000))); - echo "

$file_name (".format_numeric(filesize($file_name) / 1024).' KB) '.ui_print_help_tip(__('The folder /var/log/pandora must have pandora:apache and its content too.'), true).'

'; - echo "

'; + $code .= "

$file_name (".format_numeric(filesize($file_name) / 1024).' KB) '.ui_print_help_tip(__('The folder /var/log/pandora must have pandora:apache and its content too.'), true).'

'; + $code .= "

'; } else { $data = file_get_contents($file_name); - echo "

$file_name (".format_numeric(filesize($file_name) / 1024).' KB) '.ui_print_help_tip(__('The folder /var/log/pandora must have pandora:apache and its content too.'), true).'

'; - echo "

'; + $code .= "

$file_name (".format_numeric(filesize($file_name) / 1024).' KB) '.ui_print_help_tip(__('The folder /var/log/pandora must have pandora:apache and its content too.'), true).'

'; + $code .= "

'; + } + + if ($toggle === true) { + ui_toggle( + $code, + ''.$file_name.'', + $file_name, + 'a', + false, + false, + '', + 'white-box-content no_border', + 'filter-datatable-main box-flat white_table_graph' + ); + } else { + echo $code; } } } @@ -64,21 +81,45 @@ function pandoralogs_extension_main() return; } - ui_print_page_header(__('System logfile viewer'), 'images/extensions.png', false, '', true, ''); + // Header. + ui_print_standard_header( + __('Extensions'), + 'images/extensions.png', + false, + '', + true, + [], + [ + [ + 'link' => '', + 'label' => __('Admin tools'), + ], + [ + 'link' => '', + 'label' => __('Extension manager'), + ], + [ + 'link' => '', + 'label' => __('System logfile viewer'), + ], + ] + ); - echo '

'.__('Use this tool to view your %s logfiles directly on the console', get_product_name()).'

'; - - echo '

'.__('You can choose the amount of information shown in general setup (Log size limit in system logs viewer extension), '.($config['max_log_size'] * 1000).'B at the moment').'

'; + ui_print_info_message( + __('Use this tool to view your %s logfiles directly on the console', get_product_name()).'
+ '.__('You can choose the amount of information shown in general setup (Log size limit in system logs viewer extension), '.($config['max_log_size'] * 1000).'B at the moment') + ); $logs_directory = (!empty($config['server_log_dir'])) ? io_safe_output($config['server_log_dir']) : '/var/log/pandora'; // Do not attempt to show console log if disabled. if ($config['console_log_enabled']) { - view_logfile($config['homedir'].'/log/console.log'); + view_logfile($config['homedir'].'/log/console.log', true); } - view_logfile($logs_directory.'/pandora_server.log'); - view_logfile($logs_directory.'/pandora_server.error'); + view_logfile($logs_directory.'/pandora_server.log', true); + view_logfile($logs_directory.'/pandora_server.error', true); + } diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index ba40b854cd..2db4a529c0 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -8466,7 +8466,7 @@ div.graph div.legend table { } .pandora_logs { - width: 98%; + width: 100%; float: right; height: 200px; margin-bottom: 20px; From a9de0496f63265b85ba7509d5be5e2d17ef42dc7 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 9 Mar 2023 17:21:36 +0100 Subject: [PATCH 14/17] tables graphs info_table class --- .../include/functions_reporting_html.php | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 71e621c4b3..3cc7031303 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -532,6 +532,7 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) if (isset($item['data']) === true) { $table1 = new stdClass(); $table1->width = '99%'; + $table1->class = 'info_table'; $table1->align = []; $table1->align[0] = 'left'; @@ -567,6 +568,7 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) // Second_table for time globals. $table2 = new stdClass(); $table2->width = '99%'; + $table2->class = 'info_table'; $table2->align = []; $table2->align[0] = 'left'; @@ -600,6 +602,7 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) // Third_table for time globals. $table3 = new stdClass(); $table3->width = '99%'; + $table3->class = 'info_table'; $table3->align = []; $table3->align[0] = 'left'; @@ -926,6 +929,7 @@ function reporting_html_top_n($table, $item, $pdf=0) } else { $table1 = new stdClass(); $table1->width = '99%'; + $table1->class = 'info_table'; $table1->align = []; $table1->align[0] = 'left'; @@ -1034,6 +1038,7 @@ function reporting_html_event_report_group($table, $item, $pdf=0) if ($item['total_events']) { $table1 = new stdClass(); $table1->width = '99%'; + $table1->class = 'info_table'; $table1->align = []; $table1->align[0] = 'center'; @@ -1305,6 +1310,7 @@ function reporting_html_event_report_module($table, $item, $pdf=0) foreach ($item['data'] as $item) { $table1 = new stdClass(); $table1->width = '99%'; + $table1->class = 'info_table'; $table1->data = []; $table1->head = []; $table1->align = []; @@ -1531,7 +1537,7 @@ function reporting_html_agents_inventory($table, $item, $pdf=0) $table1->width = '100%'; $table1->style[0] = 'text-align: left;vertical-align: top;min-width: 100px;'; - $table1->class = 'databox data'; + $table1->class = 'info_table'; $table1->cellpadding = 1; $table1->cellspacing = 1; $table1->styleTable = 'overflow: wrap; table-layout: fixed;'; @@ -1698,7 +1704,7 @@ function reporting_html_modules_inventory($table, $item, $pdf=0) $table1->width = '100%'; $table1->style[0] = 'text-align: left;vertical-align: top;min-width: 100px;'; - $table1->class = 'databox data'; + $table1->class = 'info_table'; $table1->cellpadding = 1; $table1->cellspacing = 1; $table1->styleTable = 'overflow: wrap; table-layout: fixed;'; @@ -1816,6 +1822,7 @@ function reporting_html_inventory_changes($table, $item, $pdf=0) foreach ($item['data'] as $module_item) { $table1 = new stdClass(); $table1->width = '99%'; + $table1->class = 'info_table'; $table1->cellstyle = []; $table1->cellstyle[0][0] = 'background: #373737; color: #FFF;'; @@ -1910,6 +1917,7 @@ function reporting_html_inventory($table, $item, $pdf=0) foreach ($type_modules as $key_type_module => $type_module) { $table1 = new stdClass(); $table1->width = '99%'; + $table1->class = 'info_table'; $table1->data = []; $table1->head = []; $table1->cellstyle = []; @@ -2000,7 +2008,7 @@ function reporting_html_agent_module($table, $item) if (!empty($item['failed'])) { $table->data['agent_module']['cell'] = $item['failed']; } else { - $table_data = ''; + $table_data = '
'; $table_data .= ''; $table_data .= ''; @@ -2349,6 +2357,7 @@ function reporting_html_exception($table, $item, $pdf=0) } else { $table1 = new stdClass(); $table1->width = '99%'; + $table1->class = 'info_table'; $table1->align = []; $table1->align['agent'] = 'left'; @@ -2466,7 +2475,7 @@ function reporting_html_group_report($table, $item, $pdf=0) $table->colspan['group_report']['cell'] = 3; $table->cellstyle['group_report']['cell'] = 'text-align: center;'; - $data = "
'.__('Agents').' / '.__('Modules').'
+ $data = "
@@ -2528,6 +2537,7 @@ function reporting_html_event_report_agent($table, $item, $pdf=0) if ($item['total_events'] != 0) { $table1 = new stdClass(); $table1->width = '99%'; + $table1->class = 'info_table'; $table1->align = []; $table1->align[0] = 'center'; $table1->align[1] = 'center'; @@ -2750,6 +2760,7 @@ function reporting_html_historical_data($table, $item, $pdf=0) $table1 = new stdClass(); $table1->width = '100%'; + $table1->class = 'info_table'; $table1->head = [ __('Date'), __('Data'), @@ -2834,6 +2845,7 @@ function reporting_html_database_serialized($table, $item, $pdf=0) $table1 = new stdClass(); $table1->width = '100%'; + $table1->class = 'info_table'; $table1->head = [ __('Date'), __('Data'), @@ -2902,6 +2914,7 @@ function reporting_html_last_value($table, $item, $pdf=0) if (empty($item['data']) === false) { $table_data = new stdClass(); $table_data->width = '100%'; + $table_data->class = 'info_table'; $table_data->headstyle = []; $table_data->headstyle[0] = 'text-align: left;'; $table_data->style = []; @@ -3064,6 +3077,7 @@ function reporting_html_group_configuration($table, $item, $pdf=0) if ($pdf === 0) { $table2 = new stdClass(); $table2->width = '100%'; + $table2->class = 'info_table'; $table2->data = []; reporting_html_agent_configuration( $table2, @@ -3214,6 +3228,7 @@ function reporting_html_network_interfaces_report($table, $item, $pdf=0) foreach ($item['data'] as $agent) { $table_agent = new StdCLass(); $table_agent->width = '100%'; + $table_agent->class = 'info_table'; $table_agent->data = []; $table_agent->head = []; $table_agent->head[0] = __('Agent').' '.$agent['agent']; @@ -3337,6 +3352,7 @@ function reporting_html_alert_report($table, $item, $pdf=0) $table1 = new stdClass(); $table1->width = '99%'; + $table1->class = 'info_table'; $table1->head = []; $table1->data = []; $table1->rowspan = []; @@ -3461,6 +3477,7 @@ function reporting_html_monitor_report($table, $item, $mini, $pdf=0) $table1 = new stdClass(); $table1->width = '99%'; + $table1->class = 'info_table'; $table1->head = []; $table1->data = []; if ($item['data']['unknown'] == 1) { @@ -3560,6 +3577,7 @@ function reporting_html_agent_configuration( $table1 = new stdClass(); $table1->width = '99%'; $table1->head = []; + $table1->class = 'info_table'; $table1->head['name'] = __('Agent name'); $table1->head['group'] = __('Group'); $table1->head['os'] = __('OS'); @@ -3734,6 +3752,7 @@ function reporting_html_value( ) { $table2 = new stdClass(); $table2->width = '100%'; + $table2->class = 'info_table'; switch ($item['type']) { case 'max_value': $table2->head = [ @@ -4040,6 +4059,7 @@ function reporting_html_availability($table, $item, $pdf=0) if (empty($item['data']) === false) { $table1 = new stdClass(); $table1->width = '99%'; + $table1->class = 'info_table'; $table1->data = []; $table1->head = []; @@ -4623,6 +4643,7 @@ function reporting_html_availability_graph($table, $item, $pdf=0) ) { $table1 = new stdClass(); $table1->width = '100%'; + $table1->class = 'info_table'; $table1->autosize = 1; $table1->styleTable = 'overflow: wrap; table-layout: fixed;'; $table1->data = []; @@ -4864,6 +4885,7 @@ function reporting_html_general($table, $item, $pdf=0) if (!$data_in_same_row) { $table1 = new stdClass(); $table1->width = '99%'; + $table1->class = 'info_table'; $table1->data = []; $table1->head = []; $table1->head[0] = __('Agent'); @@ -5065,7 +5087,7 @@ function reporting_html_sql($table, $item, $pdf=0) $first = true; $table2 = new stdClass(); - $table2->class = 'databox'; + $table2->class = 'info_table'; $table2->width = '100%'; foreach ($item['data'] as $row) { @@ -6372,7 +6394,7 @@ function reporting_html_permissions($table, $item, $pdf=0) $table1->width = '100%'; $table1->style[0] = 'text-align: left;vertical-align: top;min-width: 100px;'; - $table1->class = 'databox data'; + $table1->class = 'info_table'; $table1->cellpadding = 1; $table1->cellspacing = 1; $table1->styleTable = 'overflow: wrap; table-layout: fixed;'; From ac1db7820c55b048d9955f22bd0551823deeed0c Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Thu, 9 Mar 2023 17:41:29 +0100 Subject: [PATCH 15/17] Minor fixes --- pandora_console/godmode/agentes/configurar_agente.php | 4 ++-- .../godmode/modules/manage_inventory_modules.php | 2 +- pandora_console/images/error-red@svg.svg | 11 +++++++++++ pandora_console/operation/agentes/ver_agente.php | 4 ++-- 4 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 pandora_console/images/error-red@svg.svg diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 339060092d..a5a1445341 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -462,11 +462,11 @@ if ($id_agente) { // Inventory. $inventorytab['text'] = ''.html_print_image( - 'images/page_white_text.png', + 'images/hardware-software-component@svg.svg', true, [ 'title' => __('Inventory'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).''; diff --git a/pandora_console/godmode/modules/manage_inventory_modules.php b/pandora_console/godmode/modules/manage_inventory_modules.php index 4bf5f29e8b..86cd55bcb6 100644 --- a/pandora_console/godmode/modules/manage_inventory_modules.php +++ b/pandora_console/godmode/modules/manage_inventory_modules.php @@ -43,7 +43,7 @@ if (is_metaconsole() === true) { ui_print_standard_header( __('Inventory modules'), - 'images/page_white_text.png', + 'images/hardware-software-component@svg.svg', false, '', true, diff --git a/pandora_console/images/error-red@svg.svg b/pandora_console/images/error-red@svg.svg new file mode 100644 index 0000000000..f9526f0cb3 --- /dev/null +++ b/pandora_console/images/error-red@svg.svg @@ -0,0 +1,11 @@ + + + + Dark / 14 / info@svg + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 121800e92f..d75cb39568 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -1443,10 +1443,10 @@ $alerttab['active'] = ($tab === 'alert'); // Inventory. $inventoryCount = db_get_num_rows('SELECT id_agent_module_inventory FROM tagent_module_inventory WHERE id_agente = '.$agent['id_agente']); $inventorytab['text'] = ''.html_print_image( - 'images/page_white_text.png', + 'images/hardware-software-component@svg.svg', true, [ - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', 'title' => __('Inventory'), ] ).''; From 6d0b0039c5e009d630c0239740eec9d7c4e7231a Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 9 Mar 2023 19:25:14 +0100 Subject: [PATCH 16/17] fixed styles --- pandora_console/include/functions_html.php | 17 ++- pandora_console/include/styles/events.css | 2 + pandora_console/include/styles/menu.css | 1 - pandora_console/include/styles/pandora.css | 6 + .../operation/agentes/estado_agente.php | 139 +++++++++--------- .../operation/agentes/group_view.php | 10 +- 6 files changed, 102 insertions(+), 73 deletions(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index af4100c6ec..5b16cbabd6 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -495,7 +495,8 @@ function html_print_select_groups( $size=false, $simple_multiple_options=false, $required=false, - $inverse='' + $inverse='', + $form='' ) { $output = ''; @@ -609,7 +610,12 @@ function html_print_select_groups( '', false, $simple_multiple_options, - $required + $required, + false, + true, + false, + false, + $form ); if ($required !== false) { @@ -761,7 +767,8 @@ function html_print_select( $truncate_size=false, $select2_enable=true, $select2_multiple_enable=false, - $select2_multiple_enable_all=false + $select2_multiple_enable_all=false, + $form='' ) { $output = "\n"; @@ -802,6 +809,10 @@ function html_print_select( $attributes .= ' class="'.$class.'"'; } + if (!empty($form)) { + $attributes .= ' form="'.$form.'"'; + } + if (!empty($disabled)) { $attributes .= ' disabled="disabled"'; } diff --git a/pandora_console/include/styles/events.css b/pandora_console/include/styles/events.css index 89a05a3fb6..c2a4665925 100644 --- a/pandora_console/include/styles/events.css +++ b/pandora_console/include/styles/events.css @@ -82,10 +82,12 @@ table.dataTable tbody td { padding: 8px 10px; } +/* th:last-child { padding-top: 0px !important; padding-bottom: 0px !important; } +*/ table#table_events > tbody > tr > td { padding: 0px !important; diff --git a/pandora_console/include/styles/menu.css b/pandora_console/include/styles/menu.css index b8085838bb..e5ea0e51d6 100644 --- a/pandora_console/include/styles/menu.css +++ b/pandora_console/include/styles/menu.css @@ -577,7 +577,6 @@ ul li { #menu_tabs { height: 49px; border-bottom: 1px solid #c1ccdc; - padding-bottom: 2px; } .div_border_line { diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index f6f4364f92..29308f7684 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -11614,3 +11614,9 @@ ul.tag-editor { .ui-dialog .ui-dialog-titlebar { display: block !important; } + +.select2-container--default .select2-search--inline .select2-search__field { + height: 20px; + padding-left: 5px !important; + font-size: 20px !important; +} diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index 9898f4a290..c6a1e43b5c 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -1020,33 +1020,29 @@ $tableAgents->class = 'info_table tactical_table'; $tableAgents->head = []; $tableAgents->head[0] = ''.__('Agent').''; $tableAgents->head[0] .= ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectNameUp, $selectNameDown); -$tableAgents->size[0] = '12%'; +$tableAgents->size[0] = '10%'; $tableAgents->head[1] = ''.__('Description').''; -$tableAgents->head[0] .= ui_get_sorting_arrows($url_up_description, $url_down_description, $selectDescriptionUp, $selectDescriptionDown); -$tableAgents->size[1] = '16%'; - -$tableAgents->head[10] = ''.__('Remote').''; -$tableAgents->head[10] .= ui_get_sorting_arrows($url_up_remote, $url_down_remote, $selectRemoteUp, $selectRemoteDown); -$tableAgents->size[10] = '9%'; +$tableAgents->head[1] .= ui_get_sorting_arrows($url_up_description, $url_down_description, $selectDescriptionUp, $selectDescriptionDown); +$tableAgents->size[1] = '14%'; $tableAgents->head[2] = ''.__('OS').''; $tableAgents->head[2] .= ui_get_sorting_arrows($url_up_os, $url_down_os, $selectOsUp, $selectOsDown); -$tableAgents->size[2] = '8%'; +$tableAgents->size[2] = '7%'; $tableAgents->head[3] = ''.__('Interval').''; $tableAgents->head[3] .= ui_get_sorting_arrows($url_up_interval, $url_down_interval, $selectIntervalUp, $selectIntervalDown); -$tableAgents->size[3] = '10%'; +$tableAgents->size[3] = '7%'; $tableAgents->head[4] = ''.__('Group').''; $tableAgents->head[4] .= ui_get_sorting_arrows($url_up_group, $url_down_group, $selectGroupUp, $selectGroupDown); -$tableAgents->size[4] = '8%'; +$tableAgents->size[4] = '7%'; $tableAgents->head[5] = ''.__('Type').''; -$tableAgents->size[5] = '8%'; +$tableAgents->size[5] = '7%'; $tableAgents->head[6] = ''.__('Modules').''; -$tableAgents->size[6] = '10%'; +$tableAgents->size[6] = '7%'; $tableAgents->head[7] = ''.__('Status').''; $tableAgents->size[7] = '4%'; @@ -1056,14 +1052,18 @@ $tableAgents->size[8] = '4%'; $tableAgents->head[9] = ''.__('Last contact').''; $tableAgents->head[9] .= ui_get_sorting_arrows($url_up_last, $url_down_last, $selectLastContactUp, $selectLastContactDown); -$tableAgents->size[9] = '15%'; +$tableAgents->size[9] = '7%'; $tableAgents->head[10] = ''.__('Last status change').''; $tableAgents->head[10] .= ui_get_sorting_arrows($url_up_last_status_change, $url_down_last_status_change, $selectLastStatusChangeUp, $selectLastStatusChangeDown); $tableAgents->size[10] = '10%'; -$tableAgents->head[11] = ''.__('Agent events').''; -$tableAgents->size[11] = '4%'; +$tableAgents->head[11] = ''.__('Remote').''; +$tableAgents->head[11] .= ui_get_sorting_arrows($url_up_remote, $url_down_remote, $selectRemoteUp, $selectRemoteDown); +$tableAgents->size[11] = '7%'; + +$tableAgents->head[12] = ''.__('Op').''; +$tableAgents->size[12] = '4%'; $tableAgents->align = []; @@ -1116,9 +1116,22 @@ foreach ($agents as $agent) { $data[0] = '
'; + if ($agent['id_os'] == CLUSTER_OS_ID) { + $cluster = PandoraFMS\Cluster::loadFromAgentId( + $agent['id_agente'] + ); + $url = 'index.php?sec=reporting&sec2='; + $url .= 'operation/cluster/cluster'; + $url = ui_get_full_url( + $url.'&op=view&id='.$cluster->id() + ); + } else { + $url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente']; + } + $data[0] .= html_print_anchor( [ - 'href' => ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente']), + 'href' => ui_get_full_url($url), 'content' => ui_print_truncate_text($agent['alias'], 'agent_medium', false, true, true), ], true @@ -1146,61 +1159,12 @@ foreach ($agents as $agent) { $data[0] .= ''; } - $data[0] .= '
'; + $data[0] .= ''; $data[1] = ''.ui_print_truncate_text($agent['description'], 'description', false, true, true, '[…]').''; $data[2] = ''; - if (enterprise_installed()) { - enterprise_include_once('include/functions_config_agents.php'); - if (enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']])) { - $data[10] = ''.html_print_image( - 'images/remote-configuration@svg.svg', - true, - [ - 'align' => 'middle', - 'title' => __('Remote config'), - 'class' => 'invert_filter main_menu_icon', - ] - ).''; - } - } - $data[2] = html_print_div( [ 'class' => 'invert_filter main_menu_icon', @@ -1252,8 +1216,24 @@ foreach ($agents as $agent) { 'status' => -1, ]; + $data[11] = ''; + if (enterprise_installed()) { + enterprise_include_once('include/functions_config_agents.php'); + if (enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']])) { + $data[11] = ''.html_print_image( + 'images/remote-configuration@svg.svg', + true, + [ + 'align' => 'middle', + 'title' => __('Remote config'), + 'class' => 'invert_filter main_menu_icon', + ] + ).''; + } + } + $fb64 = base64_encode(json_encode($agent_event_filter)); - $data[11] = ''.html_print_image( + $data[12] = ''.html_print_image( 'images/event.svg', true, [ @@ -1263,6 +1243,31 @@ foreach ($agents as $agent) { ] ).''; + if (check_acl($config['id_user'], $agent['id_grupo'], 'AW')) { + if ($agent['id_os'] == CLUSTER_OS_ID) { + $cluster = PandoraFMS\Cluster::loadFromAgentId( + $agent['id_agente'] + ); + $url = 'index.php?sec=reporting&sec2='; + $url .= 'operation/cluster/cluster'; + $url = ui_get_full_url( + $url.'&op=update&id='.$cluster->id() + ); + } else { + $url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$agent['id_agente']; + } + + $data[12] .= ''.html_print_image( + 'images/edit.svg', + true, + [ + 'align' => 'middle', + 'title' => __('Edit'), + 'class' => 'main_menu_icon invert_filter', + ] + ).''; + } + array_push($tableAgents->data, $data); } diff --git a/pandora_console/operation/agentes/group_view.php b/pandora_console/operation/agentes/group_view.php index f2ebbedbcf..fa4d171e24 100644 --- a/pandora_console/operation/agentes/group_view.php +++ b/pandora_console/operation/agentes/group_view.php @@ -176,13 +176,16 @@ if ($total_agentes > 0) { } echo '
".__('Total')."
'; + echo ''; echo ''; echo "'; echo ''; echo ''; - echo "'; - echo "'; + echo "'; + echo "'; echo ''; + echo ''; + echo ''; echo ""; echo "
".__('Summary of the status groups').'
".__('Agents').'".__('Modules').'".__('Agents').'".__('Modules').'
"; echo "".$total_agent_critical.'%'; @@ -199,6 +202,7 @@ echo ''; echo "".$total_monitor_not_init.'%'; echo ''; echo ''; + echo ''; echo '
'; if ($count == 1) { @@ -224,6 +228,7 @@ if (empty($result_groups) === false) { ); echo ''; + echo ''; echo ''; echo ''; echo ''; @@ -246,6 +251,7 @@ if (empty($result_groups) === false) { echo "'; echo "'; echo ''; + echo ''; foreach ($result_groups as $data) { if ((bool) $config['show_empty_groups'] === false From 89b3be06f965cf6369203368595636545bc2e23e Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 9 Mar 2023 19:57:37 +0100 Subject: [PATCH 17/17] fixed styles --- pandora_console/include/styles/pandora.css | 21 +++++++-------------- pandora_console/include/styles/tables.css | 5 ----- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 29308f7684..a0678c3079 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -1131,7 +1131,6 @@ div#container { div#main { display: flex; background-color: #f6f7fb; - padding-bottom: 3em; position: relative; flex-direction: column; height: 100%; @@ -6142,18 +6141,12 @@ div#status_pie { padding-left: 15px; } -/* -.agent_details_graph { - text-align: center; - margin: 0 auto; -} - .agent_details_info { - max-width: 45%; - overflow: hidden; - min-width: 220px; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; } -*/ .agent_details_agent_data { display: flex; @@ -8142,7 +8135,7 @@ div.graph div.legend table { position: relative; overflow: hidden; background-color: var(--secondary-color); - min-height: calc(100vh - 200px); + min-height: calc(100vh - 220px); } /* @@ -11241,8 +11234,8 @@ table.table_modal_alternate } .subsection_header_title { - font-size: 18px; - font-weight: initial; + font-size: 14px; + font-weight: "lato-bold"; } span.subsection_header_title { diff --git a/pandora_console/include/styles/tables.css b/pandora_console/include/styles/tables.css index 80b5288146..af6508027d 100644 --- a/pandora_console/include/styles/tables.css +++ b/pandora_console/include/styles/tables.css @@ -309,11 +309,6 @@ table.dataTable.info_table.no-footer { border-bottom: none; } -/* Datatables pagination */ -.dataTables_paginate.paging_simple_numbers { - margin: 2em 0; -} - a.pandora_pagination { background-color: #f6f7fb; padding: 11px;
'.__('Agents').'".__('Critical').'".__('Alert fired').'