Merge branch 'ent-11801-giss-y-entornos-pesados-desactivar-filtrado-por-defecto-al-acceder-a-vista-de-alertas-y-vista' into 'develop'

Ent 11801 giss y entornos pesados desactivar filtrado por defecto al acceder a vista de alertas y vista

See merge request artica/pandorafms!6384
This commit is contained in:
Rafael Ameijeiras 2023-09-08 07:24:18 +00:00
commit 1014287cba
4 changed files with 42 additions and 7 deletions

View File

@ -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;
}
$columns_tmp = [];
foreach ($parameters['columns'] as $k_column => $v_column) {
if (isset($parameters['columns'][$k_column]['text']) === true) {
@ -4126,7 +4131,7 @@ function ui_print_datatable(array $parameters)
// Base table.
$table = '<table id="'.$table_id.'" ';
$table .= 'class="'.$parameters['class'].'"';
$table .= 'class="invisible '.$parameters['class'].'"';
$table .= 'style="box-sizing: border-box;'.$parameters['style'].'">';
$table .= '<thead><tr class="datatables_thead_tr">';
@ -4200,13 +4205,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 = '<div id="'.$table_id.'-spinner" class="spinner-fixed"><span></span><span></span><span></span><span></span></div>';
$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 = '<div id="'.$table_id.'-spinner" class="invisible spinner-fixed"><span></span><span></span><span></span><span></span></div>';
// TODO This widget should take a return: ui_print_info_message($info_msg_arr, '', true)
$info_msg = '<div>'.ui_print_info_message($info_msg_arr).'</div>';
$info_msg_filter = '<div>'.ui_print_info_message($info_msg_arr_filter, true).'</div>';
$err_msg = '<div id="error-'.$table_id.'"></div>';
$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');

View File

@ -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);

View File

@ -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,
]
);
}

View File

@ -154,7 +154,7 @@ if ($ag_freestring !== '' || $moduletype !== '' || $datatype !== ''
// The execution has not been done manually.
$userRequest = (bool) get_parameter('uptbutton');
if ($userRequest === false) {
if ($userRequest === true) {
$autosearch = true;
}
@ -2354,7 +2354,7 @@ if (empty($result) === false) {
$tablePagination = ui_pagination($count_modules, false, $offset, 0, true, 'offset', false);
}
} else {
ui_print_info_message(['no_close' => true, 'message' => __('Sorry no search parameters')]);
ui_print_info_message(['no_close' => true, 'message' => __('Please apply a filter to display the data')]);
}
if (is_metaconsole() !== true) {