diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index e1c04a45b5..730f4d77d6 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -3913,6 +3913,11 @@ function ui_print_datatable(array $parameters) $parameters['toggle_collapsed'] = true; } + $parameters['startDisabled'] = false; + if (isset($parameters['start_disabled']) && $parameters['start_disabled'] === true) { + $parameters['startDisabled'] = true; + } + if (!is_array($parameters['order'])) { $order = 0; $direction = 'asc'; @@ -4113,7 +4118,7 @@ function ui_print_datatable(array $parameters) // Base table. $table = ''; $table .= ''; @@ -4187,13 +4192,19 @@ function ui_print_datatable(array $parameters) $info_msg_arr['message'] = $emptyTable; $info_msg_arr['div_class'] = 'info_box_container invisible_important datatable-msg-info-'.$table_id; - $spinner = '
'; + $info_msg_arr_filter = []; + $info_msg_arr_filter['message'] = __('Please apply a filter to display the data.'); + $info_msg_arr_filter['div_class'] = 'info_box_container invisible_important datatable-msg-info-filter-'.$table_id; + + $spinner = ''; // TODO This widget should take a return: ui_print_info_message($info_msg_arr, '', true) $info_msg = '
'.ui_print_info_message($info_msg_arr).'
'; + $info_msg_filter = '
'.ui_print_info_message($info_msg_arr_filter, true).'
'; + $err_msg = '
'; - $output = $info_msg.$err_msg.$filter.$extra.$spinner.$table.$js; + $output = $info_msg.$info_msg_filter.$err_msg.$filter.$extra.$spinner.$table.$js; if (is_ajax() === false) { ui_require_css_file('datatables.min', 'include/styles/js/'); ui_require_css_file('tables'); diff --git a/pandora_console/include/javascript/datatablesFunction.js b/pandora_console/include/javascript/datatablesFunction.js index 41f0bbf1e2..6c9dc6a3f4 100644 --- a/pandora_console/include/javascript/datatablesFunction.js +++ b/pandora_console/include/javascript/datatablesFunction.js @@ -126,6 +126,11 @@ if (typeof dt.ajax_data !== "undefined") { ajaxData = dt.ajax_data; } +var startDisabled = false; +if (dt.startDisabled === true) { + startDisabled = true; +} + $(document).ready(function() { function checkPages() { if (dt_table.page.info().pages > 1) { @@ -335,7 +340,25 @@ $(document).ready(function() { } $.extend(settings_datatable, ajaxOrData); - var dt_table = $(`#${dt.table_id}`).DataTable(settings_datatable); + + var dt_table; + + if (startDisabled === true) { + $(`.datatable-msg-info-filter-${dt.id}`) + .removeClass("invisible_important") + .show(); + + $(`div#${dt.id}-spinner`).hide(); + $(`#${dt.table_id}`).hide(); + + $(`#button-form_${dt.table_id}_search_bt`).click(function() { + $(`.datatable-msg-info-filter-${dt.id}`).hide(); + $(`#${dt.table_id}`).show(); + dt_table = $(`#${dt.table_id}`).DataTable(settings_datatable); + }); + } else { + dt_table = $(`#${dt.table_id}`).DataTable(settings_datatable); + } $(`#button-${dt.form_id}_search_bt`).click(function() { dt_table.draw().page(0); diff --git a/pandora_console/operation/agentes/alerts_status.php b/pandora_console/operation/agentes/alerts_status.php index 07974af99e..f9d7bb01cd 100755 --- a/pandora_console/operation/agentes/alerts_status.php +++ b/pandora_console/operation/agentes/alerts_status.php @@ -407,7 +407,7 @@ if ($agent_view_page === true) { [ 'id' => 'alerts_status_datatable', 'class' => 'info_table', - 'style' => 'width: 99%;', + 'style' => 'width: 100%;', 'columns' => $columns, 'column_names' => $column_names, 'no_sortable_columns' => $no_sortable_columns, @@ -439,6 +439,7 @@ if ($agent_view_page === true) { $strict_user ), ], + 'start_disabled' => true, ] ); }