From 0373cd3514453017b0b74ce06c4f00fc9b80e5db Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Wed, 8 Mar 2023 15:02:12 +0100 Subject: [PATCH] Scheduled downtime --- .../agentes/planned_downtime.editor.php | 764 +++++++++++------- .../godmode/agentes/planned_downtime.list.php | 360 +++++---- 2 files changed, 695 insertions(+), 429 deletions(-) diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index 08688c623b..b0925a787a 100644 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -15,7 +15,7 @@ * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas + * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas * Please see http://pandorafms.org for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -54,23 +54,33 @@ require_once $config['homedir'].'/include/functions_cron.php'; // Buttons. $buttons = [ 'text' => "".html_print_image( - 'images/list.png', + 'images/logs@svg.svg', true, [ 'title' => __('List'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).'', ]; // Header. -ui_print_page_header( +ui_print_standard_header( __('Scheduled Downtime'), 'images/gm_monitoring.png', false, '', true, - $buttons + $buttons, + [ + [ + 'link' => '', + 'label' => __('Tools'), + ], + [ + 'link' => '', + 'label' => __('Scheduled Downtime'), + ], + ] ); // Recursion group filter. @@ -813,227 +823,7 @@ if (users_can_manage_group_all('AW') === true || $disabled) { $return_all_group = true; } -$table = new StdClass(); -$table->class = 'databox filters'; -$table->width = '100%'; -$table->data = []; -$table->data[0][0] = __('Name'); -$table->data[0][1] = html_print_input_text( - 'name', - $name, - '', - 25, - 40, - true, - $disabled_in_execution -); -$table->data[1][0] = __('Group'); -$table->data[1][1] = '
'.html_print_select_groups( - false, - $access, - $return_all_group, - 'id_group', - $id_group, - '', - '', - 0, - true, - false, - true, - '', - $disabled_in_execution -).'
'; -$table->data[2][0] = __('Description'); -$table->data[2][1] = html_print_textarea( - 'description', - 3, - 35, - $description, - '', - true -); - -$table->data[3][0] = __('Type').ui_print_help_tip( - __('Quiet: Modules will not generate events or fire alerts.').'
'.__('Disable Agents: Disables the selected agents.').'
'.__('Disable Alerts: Disable alerts for the selected agents.'), - true -); -$table->data[3][1] = html_print_select( - [ - 'quiet' => __('Quiet'), - 'disable_agents' => __('Disabled Agents'), - 'disable_agent_modules' => __('Disable Modules'), - 'disable_agents_alerts' => __('Disabled only Alerts'), - ], - 'type_downtime', - $type_downtime, - 'change_type_downtime()', - '', - 0, - true, - false, - true, - '', - $disabled_in_execution -); -$table->data[4][0] = __('Execution'); -$table->data[4][1] = html_print_select( - [ - 'once' => __('Once'), - 'periodically' => __('Periodically'), - 'cron' => __('Cron from/to'), - ], - 'type_execution', - $type_execution, - 'change_type_execution();', - '', - 0, - true, - false, - true, - '', - $disabled_in_execution -); - $days = array_combine(range(1, 31), range(1, 31)); -$table->data[5][0] = __('Configure the time').' '; -; -$table->data[5][1] = " - - - '; - -if ($id_downtime > 0) { - echo "
"; -} else { - echo ''; -} - -// Editor form. -html_print_table($table); - -echo ""; $filter_group = (int) get_parameter('filter_group', 0); @@ -1074,39 +864,439 @@ if (empty($agents) || $disabled_in_execution) { $disabled_add_button = true; } -// Show available agents to include into downtime + $table = new StdClass(); -$table->class = 'databox filters'; +$table->class = 'databox filter-table-adv'; +$table->id = 'principal_table_scheduled'; $table->width = '100%'; +$table->size = []; +$table->size[0] = '50%'; +$table->size[1] = '50%'; $table->data = []; -$table->size[0] = '25%'; - -$table->data[0][0] = __('Group filter'); -$table->data[0][1] = html_print_select_groups( - false, - $access, - $return_all_group, - 'filter_group', - $filter_group, - '', - '', - '', - true, - false, - true, - '', - false, - 'min-width:180px;margin-right:15px;' +$table->data['first_title'][] = html_print_div( + [ + 'class' => 'section_table_title', + 'content' => __('Editor'), + ], + true +); +$table->data[0][] = html_print_label_input_block( + __('Name'), + html_print_input_text( + 'name', + $name, + '', + 25, + 40, + true, + $disabled_in_execution + ) ); -$table->data[0][2] = __('Recursion').'  '.html_print_checkbox('recursion', 1, $recursion, true, false, ''); -$table->data[1][0] = __('Available agents'); -$table->data[1][1] = html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, true, true, true, '', false, 'min-width: 250px;width: 70%;'); +$table->data[0][] = html_print_label_input_block( + __('Group'), + html_print_select_groups( + false, + $access, + $return_all_group, + 'id_group', + $id_group, + '', + '', + 0, + true, + false, + true, + '', + $disabled_in_execution + ) +); +$table->data[1][] = html_print_label_input_block( + __('Description'), + html_print_textarea( + 'description', + 3, + 35, + $description, + '', + true + ) +); -$table->rowid[2] = 'available_modules_selection_mode'; +$table->data[1][] = html_print_label_input_block( + __('Type'), + html_print_select( + [ + 'quiet' => __('Quiet'), + 'disable_agents' => __('Disabled Agents'), + 'disable_agent_modules' => __('Disable Modules'), + 'disable_agents_alerts' => __('Disabled only Alerts'), + ], + 'type_downtime', + $type_downtime, + 'change_type_downtime()', + '', + 0, + true, + false, + true, + '', + $disabled_in_execution + ).ui_print_input_placeholder( + __('Quiet: Modules will not generate events or fire alerts.').'
'.__('Disable Agents: Disables the selected agents.').'
'.__('Disable Alerts: Disable alerts for the selected agents.'), + true + ) +); -$table->data[2][1] = html_print_select( +$table->data[2][] = html_print_label_input_block( + __('Execution'), + html_print_select( + [ + 'once' => __('Once'), + 'periodically' => __('Periodically'), + 'cron' => __('Cron from/to'), + ], + 'type_execution', + $type_execution, + 'change_type_execution();', + '', + 0, + true, + false, + true, + '', + $disabled_in_execution + ) +); + +$timeInputs = []; + +$timeInputs[] = html_print_div( + [ + 'id' => 'once_time', + 'style' => 'display: none', + 'content' => html_print_div( + [ + 'class' => '', + 'content' => html_print_input_text( + 'once_date_from', + $once_date_from, + '', + 10, + 10, + true, + $disabled_in_execution + ).html_print_input_text( + 'once_time_from', + $once_time_from, + '', + 9, + 9, + true, + $disabled_in_execution + ).''.__( + 'To' + ).''.html_print_input_text( + 'once_date_to', + $once_date_to, + '', + 10, + 10, + true + ).html_print_input_text( + 'once_time_to', + $once_time_to, + '', + 9, + 9, + true + ), + ], + true + ), + ], + true +); + +$timeInputs[] = html_print_div( + [ + 'id' => 'periodically_time', + 'style' => 'display: none', + 'content' => html_print_div( + [ + 'class' => 'filter-table-adv-manual w50p', + 'content' => html_print_label_input_block( + __('Type Periodicity'), + html_print_select( + [ + 'weekly' => __('Weekly'), + 'monthly' => __('Monthly'), + ], + 'type_periodicity', + $type_periodicity, + 'change_type_periodicity();', + '', + 0, + true, + false, + true, + '', + $disabled_in_execution + ) + ), + ], + true + ).html_print_div( + [ + 'id' => 'weekly_item', + 'class' => '', + 'content' => '', + ], + true + ).html_print_div( + [ + 'id' => 'monthly_item', + 'style' => 'margin-top: 12px;', + 'class' => 'filter-table-adv-manual flex-row-start w50p', + 'content' => html_print_label_input_block( + __('From day'), + html_print_select( + $days, + 'periodically_day_from', + $periodically_day_from, + '', + '', + 0, + true, + false, + true, + '', + $disabled_in_execution + ), + [ 'div_style' => 'flex: 50; margin-right: 5px;' ] + ).html_print_label_input_block( + __('To day'), + html_print_select( + $days, + 'periodically_day_to', + $periodically_day_to, + '', + '', + 0, + true, + false, + true, + '', + $disabled_in_execution + ).ui_print_input_placeholder( + __('The end day must be higher than the start day'), + true + ), + [ 'div_style' => 'flex: 50; margin-left: 5px;' ] + ), + ], + true + ).html_print_div( + [ + 'class' => 'filter-table-adv-manual flex-row-start w50p', + 'content' => html_print_label_input_block( + __('From hour'), + html_print_input_text( + 'periodically_time_from', + $periodically_time_from, + '', + 7, + 7, + true, + $disabled_in_execution + ).ui_print_input_placeholder( + __('The start time must be lower than the end time'), + true + ), + [ 'div_style' => 'flex: 50; margin-right: 5px;' ] + ).html_print_label_input_block( + __('To hour'), + html_print_input_text( + 'periodically_time_to', + $periodically_time_to, + '', + 7, + 7, + true, + $disabled_in_execution + ).ui_print_input_placeholder( + __('The end time must be higher than the start time'), + true + ), + [ 'div_style' => 'flex: 50; margin-left: 5px;' ] + ), + ], + true + ).ui_get_using_system_timezone_warning(), + ], + true +); + +$timeInputs[] = html_print_div( + [ + 'id' => 'cron_time', + 'style' => 'display: none', + 'content' => html_print_label_input_block( + __('Cron from'), + html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, false, false, true, 'from') + ).html_print_label_input_block( + __('Cron to'), + html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, false, true, true, 'to') + ), + ], + true +); + +$table->colspan[3][0] = 2; +$table->data[3][0] = html_print_label_input_block( + __('Configure the time'), + implode('', $timeInputs) +); + +$table->data[4][] = html_print_div( + [ + 'class' => 'section_table_title', + 'content' => __('Filtering'), + ], + true +); + +$table->data[5][] = html_print_label_input_block( + __('Group filter'), + html_print_select_groups( + false, + $access, + $return_all_group, + 'filter_group', + $filter_group, + '', + '', + '', + true, + false, + true, + '', + false, + 'min-width:180px;margin-right:15px;' + ) +); + +$table->data[5][] = html_print_label_input_block( + __('Recursion'), + html_print_checkbox_switch( + 'recursion', + 1, + $recursion, + true, + false, + '' + ) +); + +$table->colspan[6][0] = 2; +$availableModules = html_print_label_input_block( + __('Available agents'), + html_print_select( + $agents, + 'id_agents[]', + -1, + '', + __('Any'), + -2, + true, + true, + true, + '', + false, + 'min-width: 250px;width: 70%;' + ), + [ + 'div_class' => 'flex-column', + 'div_style' => 'flex: 33', + ] +); + +$availableModules .= html_print_label_input_block( + __('Selection mode'), + html_print_select( + [ + 'common' => __('Show common modules'), + 'all' => __('Show all modules'), + ], + 'modules_selection_mode', + 'common', + false, + '', + '', + true, + false, + true, + '', + false, + 'min-width:180px;' + ), + [ + 'div_class' => 'available_modules_selection_mode flex-column', + 'div_style' => 'flex: 33', + ] +); + +$availableModules .= html_print_label_input_block( + __('Available modules'), + html_print_select( + [], + 'module[]', + '', + '', + '', + 0, + true, + true, + true, + '', + false, + 'min-width: 250px;width: 70%;' + ).ui_print_input_placeholder( + __('Only for type Quiet for downtimes.'), + true + ), + [ + 'div_class' => 'available_modules flex-column', + 'div_style' => 'flex: 33', + ] +); + +$table->data[6][0] = html_print_div( + [ + 'style' => 'flex-direction: row;align-items: flex-start;', + 'content' => $availableModules, + ], + true +); + +// $table->data[0][2] = __('Recursion').'  '.html_print_checkbox('recursion', 1, $recursion, true, false, ''); +/* + $table->data[1][0] = __('Available agents'); + $table->data[1][1] = html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, true, true, true, '', false, 'min-width: 250px;width: 70%;'); +*/ +/* + $table->rowid[2] = 'available_modules_selection_mode'; + + $table->data[2][1] = html_print_select( [ 'common' => __('Show common modules'), 'all' => __('Show all modules'), @@ -1122,16 +1312,16 @@ $table->data[2][1] = html_print_select( '', false, 'min-width:180px;' -); + ); -$table->rowid[3] = 'available_modules'; -$table->data[3][0] = __('Available modules:').ui_print_help_tip( + $table->rowid[3] = 'available_modules'; + $table->data[3][0] = __('Available modules:').ui_print_help_tip( __('Only for type Quiet for downtimes.'), true -); + ); -$table->data[3][1] = html_print_select( + $table->data[3][1] = html_print_select( [], 'module[]', '', @@ -1144,35 +1334,45 @@ $table->data[3][1] = html_print_select( '', false, 'min-width: 250px;width: 70%;' -); - + ); +*/ // Print agent table. +if ($id_downtime > 0) { + echo ""; +} else { + echo ''; +} + html_print_table($table); -echo '


'; - +$buttons = ''; html_print_input_hidden('id_agent', $id_agent); -echo '
'; + if ($id_downtime > 0) { html_print_input_hidden('update_downtime', 1); html_print_input_hidden('id_downtime', $id_downtime); - html_print_submit_button( + $buttons .= html_print_submit_button( __('Update'), 'updbutton', false, - 'class="sub upd"' + ['icon' => 'update'], + true ); } else { html_print_input_hidden('create_downtime', 1); - html_print_submit_button( + $buttons .= html_print_submit_button( __('Add'), 'crtbutton', false, - 'class="sub wand"' + ['icon' => 'wand'], + true ); } -echo '
'; +html_print_action_buttons( + $buttons +); + html_print_input_hidden('all_common_modules', ''); echo '
'; @@ -1208,11 +1408,17 @@ if (empty($downtimes_agents)) { $table->head[2] = __('OS'); $table->head[3] = __('Last contact'); $table->head['count_modules'] = __('Modules'); + $table->align = []; + $table->align[0] = 'center'; + $table->align[1] = 'center'; + $table->align[2] = 'center'; + $table->align[3] = 'center'; + $table->align[4] = 'center'; if (!$running) { $table->head[5] = __('Actions'); - $table->align[5] = 'center'; - $table->size[5] = '5%'; + $table->align[5] = 'right'; + $table->size[5] = '10%'; } foreach ($downtimes_agents as $downtime_agent) { @@ -1232,7 +1438,13 @@ if (empty($downtimes_agents)) { WHERE id_grupo = '.$downtime_agent['id_grupo'] ); - $data[2] = ui_print_os_icon($downtime_agent['id_os'], true, true); + $data[2] = html_print_div( + [ + 'class' => 'main_menu_icon invert_filter', + 'content' => ui_print_os_icon($downtime_agent['id_os'], false, true), + ], + true + ); $data[3] = $downtime_agent['ultimo_contacto']; @@ -1251,10 +1463,10 @@ if (empty($downtimes_agents)) { if (!$running) { $data[5] = ''; if ($type_downtime !== 'disable_agents') { - $data[5] = ''.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete'), 'class' => 'invert_filter']).''; + $data[5] = ''.html_print_image('images/edit.svg', true, ['alt' => __('Edit'), 'class' => 'main_menu_icon invert_filter']).''; } - $data[5] .= ''.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete'), 'class' => 'invert_filter']).''; + $data[5] .= ''.html_print_image('images/delete.svg', true, ['alt' => __('Delete'), 'class' => 'main_menu_icon invert_filter']).''; } $table->data['agent_'.$downtime_agent['id_agente']] = $data; @@ -1263,17 +1475,7 @@ if (empty($downtimes_agents)) { html_print_table($table); } -$table = new stdClass(); -$table->id = 'loading'; -$table->width = '100%'; -$table->colspan['loading'][0] = '6'; -$table->style[0] = 'text-align: center;'; -$table->data = []; -$table->data['loading'] = []; -$table->data['loading'][0] = html_print_image('images/spinner.gif', true); -echo "'; +ui_print_spinner('Loading'); $table = new stdClass(); $table->id = 'editor'; diff --git a/pandora_console/godmode/agentes/planned_downtime.list.php b/pandora_console/godmode/agentes/planned_downtime.list.php index 0eda511a48..da860c1bbc 100755 --- a/pandora_console/godmode/agentes/planned_downtime.list.php +++ b/pandora_console/godmode/agentes/planned_downtime.list.php @@ -14,7 +14,7 @@ * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2022 Artica Soluciones Tecnologicas + * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas * Please see http://pandorafms.org for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -89,7 +89,7 @@ if (is_ajax() === true) { [ 'id' => 'agent_modules_affected_planned_downtime', 'class' => 'info_table', - 'style' => 'width: 100%', + 'style' => 'width: 99%', 'columns' => $columns, 'column_names' => $column_names, 'ajax_url' => 'godmode/agentes/planned_downtime.list', @@ -103,6 +103,7 @@ if (is_ajax() === true) { ], 'search_button_class' => 'sub filter float-right', 'form' => [ + 'class' => 'filter-table-adv', 'inputs' => [ [ 'label' => __('Agents'), @@ -207,13 +208,23 @@ if ($migrate_malformed === true) { } // Header. -ui_print_page_header( +ui_print_standard_header( __('Scheduled Downtime'), 'images/gm_monitoring.png', false, '', true, - '' + [], + [ + [ + 'link' => '', + 'label' => __('Tools'), + ], + [ + 'link' => '', + 'label' => __('Scheduled Downtime'), + ], + ], ); $id_downtime = (int) get_parameter('id_downtime', 0); @@ -308,34 +319,8 @@ $filter_params['module_name'] = $module_name; $filter_params_str = http_build_query($filter_params); -// Table filter. -$table_form = new StdClass(); -$table_form->class = 'databox filters'; -$table_form->width = '100%'; -$table_form->rowstyle = []; -$table_form->cellstyle[0] = ['width: 100px;']; -$table_form->cellstyle[1] = ['width: 100px;']; -$table_form->cellstyle[1][2] = 'display: flex; align-items: center;'; -$table_form->cellstyle[2] = ['width: 100px;']; -$table_form->cellstyle[3] = ['text-align: right;']; -$table_form->colspan[3][0] = 3; -$table_form->data = []; - -$row = []; - -// Search text. -$row[] = __('Search'); - -$row[] = html_print_input_text( - 'search_text', - $search_text, - '', - 50, - 250, - true -); -// Dates. -$date_inputs = __('From').' '.html_print_input_text( +// From/To inputs. +$date_inputs = html_print_input_text( 'date_from', $date_from, '', @@ -343,8 +328,8 @@ $date_inputs = __('From').' '.html_print_input_text( 10, true ); -$date_inputs .= '  '; -$date_inputs .= __('To').' '.html_print_input_text( +$date_inputs .= ' '.__('To').' '; +$date_inputs .= html_print_input_text( 'date_to', $date_to, '', @@ -352,11 +337,6 @@ $date_inputs .= __('To').' '.html_print_input_text( 10, true ); -$row[] = $date_inputs; - -$table_form->data[] = $row; - -$row = []; // Execution type. $execution_type_fields = [ @@ -364,29 +344,6 @@ $execution_type_fields = [ 'periodically' => __('Periodically'), 'cron' => __('Cron'), ]; -$row[] = __('Execution type'); -$row[] = html_print_select( - $execution_type_fields, - 'execution_type', - $execution_type, - '', - __('Any'), - '', - true, - false, - false -); -// Show past downtimes. -$row[] = __('Show past downtimes').'    '.html_print_switch( - [ - 'name' => 'archived', - 'value' => $show_archived, - ] -); - -$table_form->data[] = $row; - -$row = []; // Agent. $params = []; @@ -397,36 +354,89 @@ $params['return'] = true; $params['print_hidden_input_idagent'] = true; $params['hidden_input_idagent_name'] = 'agent_id'; $params['hidden_input_idagent_value'] = $agent_id; -$row[] = __('Agent'); -$row[] = ui_print_agent_autocomplete_input($params); -// Module. -$row[] = __('Module').' '.html_print_autocomplete_modules( - 'module_name', - $module_name, - false, - true, - '', - [], - true -); - -$table_form->data[] = $row; - -$row = []; - -$row[] = html_print_submit_button( +// Table filter. +$table_form = new stdClass(); +$table_form->class = 'filter-table-adv'; +$table_form->id = 'filter_scheduled_downtime'; +$table_form->width = '100%'; +$table_form->rowstyle = []; +$table_form->cellstyle[0] = ['width: 100px;']; +$table_form->cellstyle[1] = ['width: 100px;']; +$table_form->cellstyle[1][2] = 'display: flex; align-items: center;'; +$table_form->cellstyle[2] = ['width: 100px;']; +$table_form->cellstyle[3] = ['text-align: right;']; +$table_form->data = []; +// Search text. +$table_form->data[0][] = html_print_label_input_block( __('Search'), - 'search', - false, - [ - 'icon' => 'search', - 'mode' => 'mini', - ], - true + html_print_input_text( + 'search_text', + $search_text, + '', + 50, + 250, + true + ) +); +// From / To. +$table_form->data[0][] = html_print_label_input_block( + __('Between dates'), + html_print_div( + [ + 'class' => 'flex-content-left', + 'content' => $date_inputs, + ], + true + ) +); +// Show past downtimes. +$table_form->data[0][] = html_print_label_input_block( + __('Show past downtimes'), + html_print_switch( + [ + 'name' => 'archived', + 'value' => $show_archived, + ] + ) +); +// Execution type. +$table_form->data[1][] = html_print_label_input_block( + __('Execution type'), + html_print_select( + $execution_type_fields, + 'execution_type', + $execution_type, + '', + __('Any'), + '', + true, + false, + false + ) +); + +$table_form->data[1][] = html_print_label_input_block( + __('Agent'), + ui_print_agent_autocomplete_input($params) +); + +$table_form->data[1][] = html_print_label_input_block( + __('Module'), + html_print_autocomplete_modules( + 'module_name', + $module_name, + false, + true, + '', + [], + true, + 0, + 30, + true + ) ); -$table_form->data[] = $row; // End of table filter. // Useful to know if the user has done a form filtering. $filter_performed = false; @@ -629,41 +639,86 @@ if ($downtimes === false && $filter_performed === false) { // No downtimes cause the user performed a search. // Filter form. echo '
'; - html_print_table($table_form); + $outputTable = html_print_table($table_form, true); + $outputTable .= html_print_div( + [ + 'class' => 'action-buttons-right-forced', + 'content' => html_print_submit_button( + __('Filter'), + 'search', + 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' + ); echo '
'; // Info message. - echo '
'.__('No scheduled downtime').'
'; + ui_print_info_message(__('No scheduled downtime')); // Create button. if ($write_permisson === true) { echo '
'; - html_print_div( - [ - 'class' => 'action-buttons', - 'content' => html_print_submit_button( - __('Create'), - 'create', - false, - ['icon' => 'next'], - true - ), - ] + html_print_action_buttons( + html_print_submit_button( + __('Create'), + 'create', + false, + ['icon' => 'next'], + true + ) ); echo '
'; } } else { // Has downtimes. echo '
'; - html_print_table($table_form); + $outputTable = html_print_table($table_form, true); + $outputTable .= html_print_div( + [ + 'class' => 'action-buttons-right-forced', + 'content' => html_print_submit_button( + __('Search'), + 'search', + 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' + ); echo '
'; - ui_pagination( - $downtimes_number, - $url_list.'&'.$filter_params_str, - $offset - ); - // User groups with AR, AD or AW permission. $groupsAD = users_get_groups($config['id_user'], $access); $groupsAD = array_keys($groupsAD); @@ -762,17 +817,17 @@ if ($downtimes === false && $filter_performed === false) { $settings = [ 'url' => ui_get_full_url('ajax.php', false, false, false), 'loadingText' => __('Loading, this operation might take several minutes...'), - 'title' => __('Agents / Modules affected'), + 'title' => __('Elements affected'), 'id' => $downtime['id'], ]; $data['agents_modules'] = ''; $data['agents_modules'] .= html_print_image( - 'images/search_big.png', + 'images/details.svg', true, [ 'title' => __('Agents and modules affected'), - 'style' => 'width:22px; height: 22px;', + 'class' => 'main_menu_icon invert_filter', ] ); $data['agents_modules'] .= ''; @@ -789,15 +844,21 @@ if ($downtimes === false && $filter_performed === false) { $url_list_params = $url_list.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str; $data['stop'] = ''; $data['stop'] .= html_print_image( - 'images/cancel.png', + 'images/fail@svg.svg', true, - ['title' => __('Stop downtime')] + [ + 'title' => __('Stop downtime'), + 'class' => 'main_menu_icon invert_filter', + ] ); } else { $data['stop'] = html_print_image( - 'images/cancel.png', + 'images/fail@svg.svg', true, - ['title' => __('Stop downtime')] + [ + 'title' => __('Stop downtime'), + 'class' => 'main_menu_icon invert_filter', + ] ); } } else { @@ -812,11 +873,11 @@ if ($downtimes === false && $filter_performed === false) { // Copy. $data['copy'] = ''; $data['copy'] .= html_print_image( - 'images/copy.png', + 'images/copy.svg', true, [ 'title' => __('Copy'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $data['copy'] .= ''; @@ -824,11 +885,11 @@ if ($downtimes === false && $filter_performed === false) { // Edit. $data['edit'] = ''; $data['edit'] .= html_print_image( - 'images/config.png', + 'images/configuration@svg.svg', true, [ 'title' => __('Update'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $data['edit'] .= ''; @@ -837,11 +898,11 @@ if ($downtimes === false && $filter_performed === false) { $url_delete = $url_list.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str; $data['delete'] = ''; $data['delete'] .= html_print_image( - 'images/cross.png', + 'images/delete.svg', true, [ 'title' => __('Delete'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $data['delete'] .= ''; @@ -858,22 +919,22 @@ if ($downtimes === false && $filter_performed === false) { // Copy. $data['copy'] = ''; $data['copy'] .= html_print_image( - 'images/copy.png', + 'images/copy.svg', true, [ 'title' => __('Copy'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $data['copy'] .= ''; // Edit. $data['edit'] = ''; $data['edit'] .= html_print_image( - 'images/config.png', + 'images/configuration@svg.svg', true, [ 'title' => __('Update'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $data['edit'] .= ''; @@ -910,44 +971,47 @@ if ($downtimes === false && $filter_performed === false) { } html_print_table($table); - ui_pagination( + $tablePagination = ui_pagination( $downtimes_number, $url_list.'&'.$filter_params_str, $offset, 0, - false, - 'offset', true, - 'pagination-bottom' + 'offset', + false ); - echo '
'; - - // CSV export button. - echo '
'; - html_print_button( - __('Export to CSV'), - 'csv_export', - false, - 'blockResubmit($(this)); location.href=\'godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'\'', - 'class="sub next"' - ); - echo '
'; - + $actionsButtons = ''; // Create button. if ($write_permisson === true) { - echo ' '; - echo '
'; - html_print_submit_button( + $actionsButtons .= ''; + $actionsButtons .= html_print_submit_button( __('Create'), 'create', false, - 'class="sub next"' + ['icon' => 'next'], + true ); - echo '
'; + $actionsButtons .= ''; } - echo '
'; + // CSV export button. + $actionsButtons .= html_print_button( + __('Export to CSV'), + 'csv_export', + false, + 'blockResubmit($(this)); location.href="godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'"', + [ + 'icon' => 'load', + 'mode' => 'secondary', + ], + true + ); + + html_print_action_buttons( + $actionsButtons, + [ 'right_content' => $tablePagination ] + ); } ui_require_jquery_file(