From 89780a7085b2eda54a62e19b7c66b9b8ae8f4c94 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 7 Mar 2023 09:53:19 +0100 Subject: [PATCH] Container graph visual --- .../godmode/reporting/create_container.php | 392 +++++++++++------- 1 file changed, 236 insertions(+), 156 deletions(-) diff --git a/pandora_console/godmode/reporting/create_container.php b/pandora_console/godmode/reporting/create_container.php index e487723d2e..26231fc107 100644 --- a/pandora_console/godmode/reporting/create_container.php +++ b/pandora_console/godmode/reporting/create_container.php @@ -192,13 +192,23 @@ $buttons['graph_container'] = [ ]; // Header. -ui_print_page_header( +ui_print_standard_header( __('Create container'), - '', + 'images/chart.png', false, 'create_container', false, - $buttons + $buttons, + [ + [ + 'link' => '', + 'label' => __('Reporting'), + ], + [ + 'link' => '', + 'label' => __('Custom graphs'), + ], + ] ); if ($add_container) { @@ -212,28 +222,33 @@ if ($update_container) { ui_print_result_message($success, __('Update the container'), __('Bad update the container')); } -echo ""; +$table = ''; if ($edit_container) { - echo ""; + $table .= ""; } else { - echo ""; + $table .= ""; +} + +$table .= "
"; +$table .= ''; -echo "'; if ($id_container === '1') { - echo "'; +$table .= ''; $own_info = get_user_info($config['id_user']); if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) { $return_all_groups = true; @@ -241,41 +256,96 @@ if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) { $return_all_groups = false; } -echo "'; +$table .= ''; -echo ''; -echo "'; +$table .= "'; +$table .= html_print_label_input_block( + __('Description'), + html_print_textarea( + 'description', + 2, + 95, + $texarea_value, + '', + true, + '', + $textarea_disabled + ) +); +$table .= ''; $container = folder_get_folders(); $tree = folder_get_folders_tree_recursive($container); $containers_tree = folder_flatten_tree_folders($tree, 0); @@ -283,57 +353,59 @@ $containers_tree = folder_get_select($containers_tree); unset($containers_tree[$id_container]); -echo ''; -echo "'; -if ($id_container === '1') { - echo "'; - - -echo '
'; + +$input_value = ''; +if ($edit_container) { + $input_value = io_safe_output($name); } -echo '
".__('Name').'".__('Group').''; -echo '
'; -echo html_print_input( - [ - 'type' => 'select_groups', - 'id_user' => $config['id_user'], - 'privilege' => 'RW', - 'returnAllGroup' => $return_all_groups, - 'name' => 'container_id_group', - 'selected' => $id_group, - 'script' => '', - 'nothing' => '', - 'nothing_value' => '', - 'return' => false, - 'required' => true, - 'disabled' => ($id_container === '1'), - ] +$table .= "
"; +$table .= html_print_label_input_block( + __('Group'), + html_print_input( + [ + 'type' => 'select_groups', + 'id_user' => $config['id_user'], + 'privilege' => 'RW', + 'returnAllGroup' => $return_all_groups, + 'name' => 'container_id_group', + 'selected' => $id_group, + 'script' => '', + 'nothing' => '', + 'nothing_value' => '', + 'return' => true, + 'required' => true, + 'disabled' => ($id_container === '1'), + 'style' => 'width:100% !important', + ] + ) ); -echo ''; -echo '
".__('Description').'"; if ($id_container === '1') { - echo "'; -echo '
".__('Parent container').'".html_print_select( - $containers_tree, - 'id_parent', - $id_parent, - '', - __('none'), - 0, - true, - '', - false, - 'w130', - true, - 'width: 195px', - '' - ); -} else { - echo "".html_print_select( - $containers_tree, - 'id_parent', - $id_parent, - '', - __('none'), - 0, - true, - '', - false, - 'w130', - '', - 'width: 195px', - '' - ); -} - -echo '
'; +$table .= ''; if ($edit_container) { if ($id_container !== '1') { - echo "
"; + $table .= html_print_div( + [ + 'class' => 'action-buttons', + 'content' => html_print_submit_button( + __('Update'), + 'store', + false, + [ + 'mode' => 'mini', + 'icon' => 'next', + ], + true + ), + ], + true + ); } } else { - echo "
"; + $table .= html_print_div( + [ + 'class' => 'action-buttons', + 'content' => html_print_submit_button( + __('Create'), + 'store', + false, + [ + 'mode' => 'mini', + 'icon' => 'next', + ], + true + ), + ], + true + ); } -echo ''; +$table .= ''; +ui_toggle( + $table, + ''.__('Container').'', + 'container', + '', + false, + false, + '', + 'white-box-content', + 'box-flat white_table_graph' +); echo '
'; echo '
'; @@ -358,35 +430,31 @@ if ($edit_container) { $type_graphs[0] = __('Area'); $type_graphs[1] = __('Line'); - $single_table = ""; - $single_table .= ""; - $single_table .= "'; - $single_table .= '
"; - $single_table .= __('Time lapse'); - $single_table .= ui_print_help_tip(__('This is the interval or period of time with which the graph data will be obtained. For example, a week means data from a week ago from now. '), true); - $single_table .= ''; - $single_table .= html_print_extended_select_for_time( - 'period_single', - $period, - '', - '', - '0', - 10, - true, - false, - true, - '', - false, - $periods + $single_table = ""; + $single_table .= ""; + $single_table .= "'; - $single_table .= ''; - - $single_table .= ""; - $single_table .= "'; - $single_table .= ''; - $single_table .= ''; + $single_table .= ""; - $single_table .= "'; - $single_table .= ''; $single_table .= ''; - - $single_table .= ""; - $single_table .= "'; - $single_table .= ''; - $single_table .= ''; - - $single_table .= ""; - $single_table .= ""; + $single_table .= "'; - $single_table .= ''; - $single_table .= ''; - $single_table .= ''; - $single_table .= ''; - $single_table .= "'; $single_table .= ''; $single_table .= '
"; + $single_table .= html_print_label_input_block( + __('Time lapse').ui_print_help_tip( + __('This is the interval or period of time with which the graph data will be obtained. For example, a week means data from a week ago from now. '), + true + ), + html_print_extended_select_for_time( + 'period_single', + $period, + '', + '', + '0', + 10, + true, + 'width:100%', + true, + '', + false, + $periods + ) ); $single_table .= '
"; - $single_table .= __('Agent'); - $single_table .= ''; + $single_table .= ""; $params = []; $params['show_helptip'] = false; @@ -401,62 +469,74 @@ if ($edit_container) { $params['hidden_input_idagent_id'] = 'hidden-id_agent'; - $single_table .= ui_print_agent_autocomplete_input($params); + $single_table .= html_print_label_input_block( + __('Agent'), + ui_print_agent_autocomplete_input($params) + ); $single_table .= '
"; - $single_table .= "
"; - $single_table .= __('Module'); - $single_table .= ''; if ($idAgent) { - $single_table .= html_print_select_from_sql($sql_modules, 'id_agent_module', $idAgentModule, '', '', '0', true); + $select_module .= html_print_select_from_sql($sql_modules, 'id_agent_module', $idAgentModule, '', '', '0', true); } else { - $single_table .= "'; + $select_module .= "'; } + $single_table .= html_print_label_input_block( + __('Module'), + $select_module + ); $single_table .= '
"; - $single_table .= __('Type of graph'); - $single_table .= ''; - $single_table .= html_print_select($type_graphs, 'simple_type_graph', '', '', '', 0, true); - $single_table .= '
"; - $single_table .= __('Show full scale graph (TIP)').ui_print_help_tip('This option may cause performance issues', true); + $single_table .= "
"; + $single_table .= html_print_label_input_block( + __('Type of graph'), + html_print_select($type_graphs, 'simple_type_graph', '', '', '', 0, true) + ); $single_table .= ''; - $single_table .= html_print_checkbox('fullscale', 1, false, true); - $single_table .= '
'; - $single_table .= '"; - $single_table .= ""; + $single_table .= ""; + $single_table .= html_print_label_input_block( + __('Show full scale graph (TIP)').ui_print_help_tip('This option may cause performance issues', true), + html_print_checkbox('fullscale', 1, false, true) + ); $single_table .= '
'; - echo ""; - echo ''; - echo ''; - echo ''; - echo '
'; - echo ui_toggle($single_table, 'Simple module graph', '', '', true); - echo '
'; + $single_table .= html_print_div( + [ + 'class' => 'action-buttons-right-forced mrgn_right_10px', + 'content' => html_print_submit_button( + __('Add item'), + 'add_single', + false, + [ + 'mode' => 'mini', + 'icon' => 'next', + ], + true + ), + ], + true + ); + + ui_toggle( + $single_table, + ''.__('Simple module graph').'', + 'container', + '', + true, + false, + '', + 'white-box-content', + 'box-flat white_table_graph' + ); $table = new stdClass(); $table->id = 'custom_graph_table'; @@ -680,7 +760,7 @@ if ($edit_container) { } $data[7] = ''.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete')]).''; + return false;">'.html_print_image('images/delete.svg', true, ['alt' => __('Delete'), 'title' => __('Delete'), 'class' => 'invert_filter main_menu_icon']).''; array_push($table->data, $data); } @@ -694,7 +774,7 @@ echo html_print_input_hidden('id_agent', 0);