diff --git a/pandora_console/godmode/agentes/planned_downtime.list.php b/pandora_console/godmode/agentes/planned_downtime.list.php
index a9a65bc834..959db70ed6 100755
--- a/pandora_console/godmode/agentes/planned_downtime.list.php
+++ b/pandora_console/godmode/agentes/planned_downtime.list.php
@@ -89,7 +89,7 @@ if (is_ajax() === true) {
[
'id' => 'agent_modules_affected_planned_downtime',
'class' => 'info_table',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'godmode/agentes/planned_downtime.list',
diff --git a/pandora_console/godmode/groups/tactical.php b/pandora_console/godmode/groups/tactical.php
index 067bed45be..0b09cbc789 100644
--- a/pandora_console/godmode/groups/tactical.php
+++ b/pandora_console/godmode/groups/tactical.php
@@ -187,7 +187,7 @@ try {
[
'id' => 'list_agents_tactical',
'class' => 'info_table',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columnNames,
'return' => true,
diff --git a/pandora_console/godmode/update_manager/update_manager.history.php b/pandora_console/godmode/update_manager/update_manager.history.php
index e827951e88..7caab40f8b 100644
--- a/pandora_console/godmode/update_manager/update_manager.history.php
+++ b/pandora_console/godmode/update_manager/update_manager.history.php
@@ -50,7 +50,7 @@ try {
[
'id' => $tableId,
'class' => 'info_table',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'include/ajax/update_manager',
diff --git a/pandora_console/include/class/AuditLog.class.php b/pandora_console/include/class/AuditLog.class.php
index 98bca38e43..b5018cd286 100644
--- a/pandora_console/include/class/AuditLog.class.php
+++ b/pandora_console/include/class/AuditLog.class.php
@@ -178,7 +178,7 @@ class AuditLog extends HTML
[
'id' => $this->tableId,
'class' => 'info_table',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => $this->ajaxController,
diff --git a/pandora_console/include/class/CalendarManager.class.php b/pandora_console/include/class/CalendarManager.class.php
index ba1761d6f9..311559c4e2 100644
--- a/pandora_console/include/class/CalendarManager.class.php
+++ b/pandora_console/include/class/CalendarManager.class.php
@@ -1040,7 +1040,7 @@ class CalendarManager
'id' => 'templates_alerts_special_days',
'return' => true,
'class' => 'info_table',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'godmode/alerts/alert_special_days',
diff --git a/pandora_console/include/class/ConfigPEN.class.php b/pandora_console/include/class/ConfigPEN.class.php
index 2177e73a74..cea6123f08 100644
--- a/pandora_console/include/class/ConfigPEN.class.php
+++ b/pandora_console/include/class/ConfigPEN.class.php
@@ -612,7 +612,7 @@ class ConfigPEN extends HTML
'id' => $tableId,
'return' => true,
'class' => 'info_table',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => $this->ajaxController,
diff --git a/pandora_console/include/class/CredentialStore.class.php b/pandora_console/include/class/CredentialStore.class.php
index b82a129cd1..937f505f8d 100644
--- a/pandora_console/include/class/CredentialStore.class.php
+++ b/pandora_console/include/class/CredentialStore.class.php
@@ -827,7 +827,7 @@ class CredentialStore extends Wizard
[
'id' => $this->tableId,
'class' => 'info_table',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => $this->ajaxController,
diff --git a/pandora_console/include/class/Diagnostics.class.php b/pandora_console/include/class/Diagnostics.class.php
index 7483cbca30..2c00a6b328 100644
--- a/pandora_console/include/class/Diagnostics.class.php
+++ b/pandora_console/include/class/Diagnostics.class.php
@@ -1579,7 +1579,7 @@ class Diagnostics extends Wizard
[
'id' => $tableId,
'class' => 'info_table caption_table',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columnNames,
'ajax_data' => [
@@ -1591,6 +1591,7 @@ class Diagnostics extends Wizard
'no_sortable_columns' => [-1],
'caption' => $title,
'print' => true,
+ 'mini_csv' => true,
]
);
} else {
diff --git a/pandora_console/include/class/EventSound.class.php b/pandora_console/include/class/EventSound.class.php
index e485ac4dfb..5658b44324 100644
--- a/pandora_console/include/class/EventSound.class.php
+++ b/pandora_console/include/class/EventSound.class.php
@@ -320,7 +320,7 @@ class EventSound extends HTML
[
'id' => $this->tableId,
'class' => 'info_table',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => $this->ajaxController,
diff --git a/pandora_console/include/class/SatelliteAgent.class.php b/pandora_console/include/class/SatelliteAgent.class.php
index 31cd2550d9..29fa2e3b77 100644
--- a/pandora_console/include/class/SatelliteAgent.class.php
+++ b/pandora_console/include/class/SatelliteAgent.class.php
@@ -162,7 +162,7 @@ class SatelliteAgent extends HTML
[
'id' => $this->tableId,
'class' => 'info_table',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => $this->ajaxController,
diff --git a/pandora_console/include/class/SatelliteCollection.class.php b/pandora_console/include/class/SatelliteCollection.class.php
index 8af5f210c8..a1ef24393c 100644
--- a/pandora_console/include/class/SatelliteCollection.class.php
+++ b/pandora_console/include/class/SatelliteCollection.class.php
@@ -142,7 +142,7 @@ class SatelliteCollection extends HTML
[
'id' => $this->tableId,
'class' => 'info_table',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => $this->ajaxController,
diff --git a/pandora_console/include/class/SnmpConsole.class.php b/pandora_console/include/class/SnmpConsole.class.php
index e613ab57bf..c58a9e4619 100644
--- a/pandora_console/include/class/SnmpConsole.class.php
+++ b/pandora_console/include/class/SnmpConsole.class.php
@@ -326,7 +326,7 @@ class SnmpConsole extends HTML
[
'id' => $tableId,
'class' => 'info_table',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => $this->ajaxController,
diff --git a/pandora_console/include/class/TipsWindow.class.php b/pandora_console/include/class/TipsWindow.class.php
index cf0824f626..ae4271fba9 100644
--- a/pandora_console/include/class/TipsWindow.class.php
+++ b/pandora_console/include/class/TipsWindow.class.php
@@ -475,7 +475,7 @@ class TipsWindow
[
'id' => 'list_tips_windows',
'class' => 'info_table',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'dom_elements' => 'lpfti',
'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar',
'columns' => $columns,
diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php
index b2e3928b69..c5b83e48ae 100755
--- a/pandora_console/include/functions_ui.php
+++ b/pandora_console/include/functions_ui.php
@@ -3742,28 +3742,71 @@ function ui_progress_extend(
* Generate needed code to print a datatables jquery plugin.
*
* @param array $parameters All desired data using following format:
- * [
- * 'print' => true (by default printed)
- * 'id' => datatable id.
- * 'class' => datatable class.
- * 'style' => datatable style.
- * 'order' => [
- * 'field' => column name
- * 'direction' => asc or desc
- * ],
- * 'default_pagination' => integer, default pagination is set to block_size
- * 'ajax_url' => 'include/ajax.php' ajax_url.
- * 'ajax_data' => [ operation => 1 ] extra info to be sent.
- * 'ajax_postprocess' => a javscript function to postprocess data received
- * by ajax call. It is applied foreach row and must
- * use following format:
- * * [code]
- * * function (item) {
- * * // Process received item, for instance, name:
- * * tmp = '' + item.name + '';
- * * item.name = tmp;
- * * }
- * * [/code]
+ *
+ * ```php
+ * $parameters = [
+ * // JS Parameters
+ * 'serverside' => true,
+ * 'paging' => true,
+ * 'default_pagination' => $config['block_size'],
+ * 'searching' => false,
+ * 'dom_elements' => "plfrtiB",
+ * 'pagination_options' => [default_pagination, 5, 10, 20, 100, 200, 500, 1000, "All"],
+ * 'ordering' => true,
+ * 'order' => [[0, "asc"]], //['field' => 'column_name', 'direction' => 'asc/desc']
+ * 'zeroRecords' => "No matching records found",
+ * 'emptyTable' => "No data available in table",
+ * 'no_sortable_columns' => [], //Allows the column name (db) from "columns" parameter
+ * 'csv_field_separator' => ",",
+ * 'csv_header' => true,
+ * 'mini_csv' => false,
+ * 'mini_pagination' => false,
+ * 'mini_search' => false,
+ * 'drawCallback' => undefined, //'console.log(123),'
+ * 'data_element' => undefined, //Rows processed
+ * 'ajax_postprocess' => undefined, //'process_datatables_item(item)'
+ * 'ajax_data' => undefined, //Extra data to be sent ['field1' => 1, 'field2 => 0]
+ * 'ajax_url' => undefined,
+ * 'caption' => undefined,
+ *
+ * // PHP Parameters
+ * 'id' => undefined, //Used for table and form id,
+ * 'columns' =>,
+ * 'column_names' =>,
+ * 'filter_main_class' =>,
+ * 'toggle_collapsed' =>true,
+ * 'search_button_class' => 'sub filter',
+ * 'csv' =>=1,
+ * 'form' =>
+ * ..[
+ * ....'id' => $form_id,
+ * ....'class' => 'flex-row',
+ * ....'style' => 'width: 100%,',
+ * ....'js' => '',
+ * ....'html' => $filter,
+ * ....'inputs' => [],
+ * ....'extra_buttons' => $buttons,
+ * ..],
+ * 'no_toggle' => false,
+ * 'form_html' => undefined,
+ * 'toggle_collapsed' => true,
+ * 'class' => "", //Datatable class.
+ * 'style' => "" ,//Datatable style.
+ * 'return' => false,
+ * 'print' => true,
+ * ]
+ *
+ * ```
+ *
+ * ```php
+ * ajax_postprocess => a javscript function to postprocess data received
+ * by ajax call. It is applied foreach row and must
+ * use following format:
+ * function (item) {
+ * // Process received item, for instance, name:
+ * tmp = '' + item.name + '';
+ * item.name = tmp;
+ * }
* 'columns_names' => [
* 'column1' :: Used as th text. Direct text entry. It could be array:
* OR
@@ -3780,7 +3823,6 @@ function ui_progress_extend(
* 'column2',
* ...
* ],
- * 'no_sortable_columns' => [ indexes ] 1,2... -1 etc. Avoid sorting.
* 'form' => [
* 'html' => 'html code' a directly defined inputs in HTML.
* 'extra_buttons' => [
@@ -3812,12 +3854,7 @@ function ui_progress_extend(
* ]
* ],
* 'extra_html' => HTML content to be placed after 'filter' section.
- * 'drawCallback' => function to be called after draw. Sample in:
- * https://datatables.net/examples/advanced_init/row_grouping.html
- * ]
- * 'zeroRecords' => Message when zero records obtained from filter.(Leave blank for default).
- * 'emptyTable' => Message when table data empty.(Leave blank for default).
- * End.
+ * ```
*
* @return string HTML code with datatable.
* @throws Exception On error.
@@ -3834,6 +3871,9 @@ function ui_print_datatable(array $parameters)
$form_id = uniqid('datatable_filter_');
}
+ $parameters['table_id'] = $table_id;
+ $parameters['form_id'] = $form_id;
+
if (!isset($parameters['columns']) || !is_array($parameters['columns'])) {
throw new Exception('[ui_print_datatable]: You must define columns for datatable');
}
@@ -3853,10 +3893,6 @@ function ui_print_datatable(array $parameters)
$parameters['default_pagination'] = $config['block_size'];
}
- if (!isset($parameters['paging'])) {
- $parameters['paging'] = true;
- }
-
if (!isset($parameters['filter_main_class'])) {
$parameters['filter_main_class'] = '';
}
@@ -3865,13 +3901,9 @@ function ui_print_datatable(array $parameters)
$parameters['toggle_collapsed'] = true;
}
- $no_sortable_columns = json_encode([]);
- if (isset($parameters['no_sortable_columns'])) {
- $no_sortable_columns = json_encode($parameters['no_sortable_columns']);
- }
-
if (!is_array($parameters['order'])) {
- $order = '0, "asc"';
+ $order = 0;
+ $direction = 'asc';
} else {
if (!isset($parameters['order']['direction'])) {
$direction = 'asc';
@@ -3890,47 +3922,35 @@ function ui_print_datatable(array $parameters)
}
}
- $order .= ', "'.$parameters['order']['direction'].'"';
+ $direction = $parameters['order']['direction'];
}
- if (!isset($parameters['ajax_data'])) {
- $parameters['ajax_data'] = '';
+ $parameters['order']['order'] = $order;
+ $parameters['order']['direction'] = $direction;
+
+ foreach ($parameters['no_sortable_columns'] as $key => $find) {
+ $found = array_search(
+ $parameters['no_sortable_columns'][$key],
+ $parameters['columns']
+ );
+
+ if ($found !== false) {
+ unset($parameters['no_sortable_columns'][$key]);
+ array_push($parameters['no_sortable_columns'], $found);
+ }
+
+ if (is_int($parameters['no_sortable_columns'][$key]) === false) {
+ unset($parameters['no_sortable_columns'][$key]);
+ }
}
- $search_button_class = 'sub filter';
+ $parameters['csvTextInfo'] = __('Export current page to CSV');
+ $parameters['csvFileTitle'] = sprintf(__('export_%s_current_page_%s'), $table_id, date('Y-m-d'));
+
if (isset($parameters['search_button_class'])) {
$search_button_class = $parameters['search_button_class'];
- }
-
- if (isset($parameters['pagination_options'])) {
- $pagination_options = $parameters['pagination_options'];
} else {
- $pagination_options = [
- [
- // There is a limit of (2^32)^2 (18446744073709551615) rows in a MyISAM table, show for show all use max nrows.
- // -1 Retun error or only 1 row.
- $parameters['default_pagination'],
- 5,
- 10,
- 25,
- 100,
- 200,
- 500,
- 1000,
- 18446744073709551615,
- ],
- [
- $parameters['default_pagination'],
- 5,
- 10,
- 25,
- 100,
- 200,
- 500,
- 1000,
- 'All',
- ],
- ];
+ $search_button_class = 'sub filter';
}
if (isset($parameters['datacolumns']) === false
@@ -3943,16 +3963,12 @@ function ui_print_datatable(array $parameters)
$parameters['csv'] = 1;
}
- $dom_elements = '"plfrtiB"';
- if (isset($parameters['dom_elements'])) {
- $dom_elements = '"'.$parameters['dom_elements'].'"';
- }
-
$filter = '';
// Datatable filter.
if (isset($parameters['form']) && is_array($parameters['form'])) {
if (isset($parameters['form']['id'])) {
$form_id = $parameters['form']['id'];
+ $parameters['form_id'] = $form_id;
}
if (isset($parameters['form']['class'])) {
@@ -4070,10 +4086,13 @@ function ui_print_datatable(array $parameters)
)
);
$processing .= '';
+ $parameters['processing'] = $processing;
$zeroRecords = isset($parameters['zeroRecords']) === true ? $parameters['zeroRecords'] : __('No matching records found');
$emptyTable = isset($parameters['emptyTable']) === true ? $parameters['emptyTable'] : __('No data available in table');
+ $parameters['zeroRecords'] = $zeroRecords;
+ $parameters['emptyTable'] = $emptyTable;
// Extra html.
$extra = '';
if (isset($parameters['extra_html']) && !empty($parameters['extra_html'])) {
@@ -4082,8 +4101,8 @@ function ui_print_datatable(array $parameters)
// Base table.
$table = '
';
+ $table .= 'class="'.$parameters['class'].'"';
+ $table .= 'style="box-sizing: border-box;'.$parameters['style'].'">';
$table .= '';
if (isset($parameters['column_names'])
@@ -4110,336 +4129,60 @@ function ui_print_datatable(array $parameters)
}
$table .= '
';
-
- if (isset($parameters['data_element']) === true) {
- $table .= '';
- foreach ($parameters['data_element'] as $row) {
- $table .= '';
- foreach ($row as $td_data) {
- $table .= ''.$td_data.' | ';
- }
-
- $table .= '
';
- }
-
- $table .= '';
-
- $js = '';
- }
-
$table .= '
';
- $pagination_class = 'pandora_pagination';
- if (!empty($parameters['pagination_class'])) {
- $pagination_class = $parameters['pagination_class'];
+ $parameters['ajax_url_full'] = ui_get_full_url('ajax.php', false, false, false);
+
+ $parameters['spinnerLoading'] = html_print_image(
+ 'images/spinner.gif',
+ true,
+ [
+ 'id' => $form_id.'_loading',
+ 'class' => 'loading-search-datatables-button',
+ ]
+ );
+
+ $language = substr(get_user_language(), 0, 2);
+ if (is_metaconsole() === false) {
+ $parameters['language'] = 'include/javascript/i18n/dataTables.'.$language.'.json';
+ } else {
+ $parameters['language'] = '../../include/javascript/i18n/dataTables.'.$language.'.json';
}
- $columns = '';
- for ($i = 1; $i <= (count($parameters['columns']) - 3); $i++) {
- if ($i != (count($parameters['columns']) - 3)) {
- $columns .= $i.',';
- } else {
- $columns .= $i;
- }
+ $parameters['phpDate'] = date('Y-m-d');
+ $parameters['dataElements'] = json_encode($parameters['data_element']);
+
+ // * START JAVASCRIPT.
+ if (is_metaconsole() === false) {
+ $file_path = ui_get_full_url('include/javascript/datatablesFunction.js');
+ } else {
+ $file_path = ui_get_full_url('../../include/javascript/datatablesFunction.js');
}
- $export_columns = '';
- if (isset($parameters['csv_exclude_latest']) === true
- && $parameters['csv_exclude_latest'] === true
- ) {
- $export_columns = ',columns: \'th:not(:last-child)\'';
- }
+ $file_content = file_get_contents($file_path);
+ $json_data = json_encode($parameters);
+ $json_config = json_encode($config);
- if (isset($parameters['data_element']) === false || isset($parameters['print_pagination_search_csv'])) {
- if (isset($parameters['ajax_url'])) {
- $type_data = 'ajax: {
- url: "'.ui_get_full_url('ajax.php', false, false, false).'",
- type: "POST",
- dataSrc: function (json) {
- if($("#'.$form_id.'_search_bt") != undefined) {
- $("#'.$form_id.'_loading").remove();
- }
+ $js = '';
- if (json.error) {
- console.error(json.error);
- $("#error-'.$table_id.'").html(json.error);
- $("#error-'.$table_id.'").dialog({
- title: "Filter failed",
- width: 630,
- resizable: true,
- draggable: true,
- modal: false,
- closeOnEscape: true,
- buttons: {
- "Ok" : function () {
- $(this).dialog("close");
- }
- }
- }).parent().addClass("ui-state-error");
- } else {';
-
- if (isset($parameters['ajax_return_operation']) === true
- && empty($parameters['ajax_return_operation']) === false
- && isset($parameters['ajax_return_operation_function']) === true
- && empty($parameters['ajax_return_operation_function']) === false
- ) {
- $type_data .= '
- if (json.'.$parameters['ajax_return_operation'].' !== undefined) {
- '.$parameters['ajax_return_operation_function'].'(json.'.$parameters['ajax_return_operation'].');
- }
- ';
- }
-
- if (isset($parameters['ajax_postprocess'])) {
- $type_data .= '
- if (json.data) {
- json.data.forEach(function(item) {
- '.$parameters['ajax_postprocess'].'
- });
- } else {
- json.data = {};
- }';
- }
-
- $type_data .= '
- return json.data;
- }
- },
- data: function (data) {
- if($("#button-'.$form_id.'_search_bt") != undefined) {
- var loading = \''.html_print_image(
- 'images/spinner.gif',
- true,
- [
- 'id' => $form_id.'_loading',
- 'class' => 'loading-search-datatables-button',
- ]
- ).'\';
- $("#button-'.$form_id.'_search_bt").parent().append(loading);
- }
-
- inputs = $("#'.$form_id.' :input");
-
- values = {};
- inputs.each(function() {
- values[this.name] = $(this).val();
- })
-
- $.extend(data, {
- filter: values,'."\n";
-
- if (is_array($parameters['ajax_data'])) {
- foreach ($parameters['ajax_data'] as $k => $v) {
- $type_data .= $k.':'.json_encode($v).",\n";
- }
- }
-
- $type_data .= 'page: "'.$parameters['ajax_url'].'"
- });
-
- return data;
- }
- },';
- } else {
- $type_data = 'data: '.json_encode($parameters['data_element']).',';
- }
-
- $serverside = 'true';
- if (isset($parameters['data_element'])) {
- $serverside = 'false';
- }
-
- // Javascript controller.
- $js = '';
- }
-
- // Order.
+ $js .= '';
+ // * END JAVASCRIPT.
$info_msg_arr = [];
$info_msg_arr['message'] = $emptyTable;
$info_msg_arr['div_class'] = 'info_box_container invisible_important datatable-msg-info-'.$table_id;
- $spinner = '
';
+ $spinner = '
';
$info_msg = ''.ui_print_info_message($info_msg_arr).'
';
+
$err_msg = '';
$output = $info_msg.$err_msg.$filter.$extra.$spinner.$table.$js;
if (is_ajax() === false) {
@@ -4463,7 +4206,7 @@ function ui_print_datatable(array $parameters)
false,
false
);
- $output .= '?v='.$config['current_package'].'"/>';
+ $output .= '"/>';
// Load tables.css.
$output .= ' 1) {
+ $(
+ "div.pagination-child-div > .dataTables_paginate.paging_simple_numbers"
+ ).show();
+ $(`#${dt.id}_paginate`).show();
+ } else {
+ $(
+ "div.pagination-child-div > .dataTables_paginate.paging_simple_numbers"
+ ).hide();
+ $(`#${dt.id}_paginate`).hide();
+ }
+ }
+
+ function moveElementsToActionButtons() {
+ $(".action_buttons_right_content").html(
+ ''
+ );
+ $(".pagination-child-div").append(
+ $(`#${dt.id}_wrapper > .dataTables_paginate.paging_simple_numbers`).attr(
+ "style",
+ "margin-right: 10px;"
+ )
+ );
+ $(".pagination-child-div").append(
+ $(`#${dt.id}_wrapper > .dataTables_length`)
+ );
+ $(".pagination-child-div").append($(`#${dt.id}_wrapper > .dt-buttons`));
+ $(".pagination-child-div").append(
+ $(`#${dt.id}_wrapper > .dataTables_filter`)
+ );
+ }
+
+ $.fn.dataTable.ext.errMode = "none";
+ $.fn.dataTable.ext.classes.sPageButton = paginationClass;
+
+ if (dt.mini_pagination === true) {
+ $.fn.dataTable.ext.classes.sPageButton = `${paginationClass} mini-pandora-pagination`;
+ }
+
+ var settings_datatable = {
+ processing: true,
+ responsive: true,
+ serverSide,
+ paging,
+ pageLength,
+ searching,
+ dom,
+ lengthMenu,
+ ordering,
+ order,
+ columns: eval(datacolumns),
+ columnDefs,
+ language: {
+ url: dt.language,
+ processing,
+ zeroRecords,
+ emptyTable
+ },
+ buttons:
+ dt.csv == 1
+ ? [
+ {
+ extend: "csv",
+ className: csvClassName,
+ text: dt.csvTextInfo,
+ titleAttr: dt.csvTextInfo,
+ title: dt.csvFileTitle,
+ fieldSeparator: csvFieldSeparator,
+ header: csvHeader,
+ action: function(e, dt, node, config) {
+ blockResubmit(node);
+ // Call the default csvHtml5 action method to create the CSV file
+ $.fn.dataTable.ext.buttons.csvHtml5.action.call(
+ this,
+ e,
+ dt,
+ node,
+ config
+ );
+ },
+ exportOptions: {
+ modifier: {
+ // DataTables core
+ order: "current",
+ page: "All",
+ search: "applied"
+ },
+ columns: csvExcludeLast
+ }
+ }
+ ]
+ : [],
+ initComplete: function(settings, json) {
+ moveElementsToActionButtons();
+
+ checkPages();
+
+ $(`div#${dt.id}-spinner`).hide();
+ },
+ drawCallback: function(settings) {
+ if ($(`#${dt.id} tr td`).length == 1) {
+ $(`.datatable-msg-info-${dt.id}`)
+ .removeClass("invisible_important")
+ .show();
+ $(`table#${dt.id}`).hide();
+ $("div.pagination-child-div").hide();
+ $("div.dataTables_info").hide();
+ $(`#${dt.id}_wrapper`).hide();
+ $(`.action_buttons_right_content .pagination-child-div`).hide();
+ } else {
+ $(`.datatable-msg-info-${dt.id}`).hide();
+ $(`table#${dt.id}`).show();
+ $("div.pagination-child-div").show();
+ $("div.dataTables_info").show();
+ $(`#${dt.id}_wrapper`).show();
+
+ if (typeof dt.drawCallback !== "undefined") {
+ eval(dt.drawCallback);
+ }
+ }
+
+ $(`div#${dt.id}-spinner`).hide();
+
+ checkPages();
+ }
+ };
+
+ var ajaxOrData = {};
+ if (typeof dt.data_element == "undefined") {
+ ajaxOrData = {
+ ajax: {
+ url: dt.ajax_url_full,
+ type: "POST",
+ dataSrc: function(json) {
+ if ($(`#${dt.form_id}_search_bt`) != undefined) {
+ $(`#${dt.form_id}_loading`).remove();
+ }
+
+ if (json.error) {
+ console.error(json.error);
+ $(`#error-${dt.id}`).html(json.error);
+ $(`#error-${dt.id}`)
+ .dialog({
+ title: "Filter failed",
+ width: 630,
+ resizable: true,
+ draggable: true,
+ modal: false,
+ closeOnEscape: true,
+ buttons: {
+ Ok: function() {
+ $(this).dialog("close");
+ }
+ }
+ })
+ .parent()
+ .addClass("ui-state-error");
+ } else {
+ if (json.ajaxReturn !== "undefined") {
+ eval(`${ajaxReturnFunction}(${json.ajaxReturn})`);
+ }
+
+ if (typeof dt.ajax_postprocess !== "undefined") {
+ if (json.data) {
+ json.data.forEach(function(item) {
+ eval(dt.ajax_postprocess);
+ });
+ } else {
+ json.data = {};
+ }
+ }
+
+ return json.data;
+ }
+ },
+ data: function(data) {
+ $(`div#${dt.id}-spinner`).show();
+ if ($(`#button-${dt.form_id}_search_bt`) != undefined) {
+ var loading = `
`;
+ $(`#button-${dt.form_id}_search_bt`)
+ .parent()
+ .append(loading);
+ }
+
+ var inputs = $(`#${dt.form_id} :input`);
+
+ var values = {};
+ inputs.each(function() {
+ values[this.name] = $(this).val();
+ });
+
+ $.extend(data, ajaxData);
+
+ $.extend(data, {
+ filter: values,
+ page: dt.ajax_url
+ });
+
+ return data;
+ }
+ }
+ };
+ } else {
+ ajaxOrData = { data: dt.data_element };
+ }
+
+ $.extend(settings_datatable, ajaxOrData);
+ var dt_table = $(`#${dt.table_id}`).DataTable(settings_datatable);
+
+ $(`#button-${dt.form_id}_search_bt`).click(function() {
+ dt_table.draw().page(0);
+ });
+
+ if (typeof dt.caption !== "undefined" && dt.caption !== "") {
+ $(`#${dt.table_id}`).append(`${dt.caption}`);
+ $(".datatables_thead_tr").css("height", 0);
+ }
+
+ $(function() {
+ $(document).on("init.dt", function(ev, settings) {
+ if (dt.mini_search === true) {
+ $(`#${dt.id}_filter > label > input`).addClass("mini-search-input");
+ }
+
+ $("div.dataTables_length").show();
+ $("div.dataTables_filter").show();
+ $("div.dt-buttons").show();
+
+ if (dt_table.page.info().pages === 0) {
+ $(`.action_buttons_right_content .pagination-child-div`).hide();
+ }
+
+ if (dt_table.page.info().pages === 1) {
+ $(`div.pagination-child-div > #${dt.table_id}_paginate`).hide();
+ } else {
+ $(`div.pagination-child-div > #${dt.table_id}_paginate`).show();
+ }
+ });
+ });
+});
+
+$(function() {
+ $(document).on("preInit.dt", function(ev, settings) {
+ $(`#${dt.id}_wrapper div.dataTables_length`).hide();
+ $(`#${dt.id}_wrapper div.dataTables_filter`).hide();
+ $(`#${dt.id}_wrapper div.dt-buttons`).hide();
+ });
+});
diff --git a/pandora_console/include/javascript/i18n/dataTables.en.json b/pandora_console/include/javascript/i18n/dataTables.en.json
index 9ccd76c4ad..d80bbe6e75 100644
--- a/pandora_console/include/javascript/i18n/dataTables.en.json
+++ b/pandora_console/include/javascript/i18n/dataTables.en.json
@@ -6,7 +6,6 @@
"infoThousands": ",",
"lengthMenu": "Show _MENU_ entries",
"loadingRecords": "Loading...",
- "processing": "Processing...",
"search": "Search:",
"zeroRecords": "No matching records found",
"thousands": ",",
diff --git a/pandora_console/include/lib/Dashboard/Widgets/DataMatrix.php b/pandora_console/include/lib/Dashboard/Widgets/DataMatrix.php
index b00c3ae421..10ddd2bc9c 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/DataMatrix.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/DataMatrix.php
@@ -520,7 +520,7 @@ class DataMatrix extends Widget
[
'id' => $tableId,
'class' => 'info_table',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'include/ajax/module',
diff --git a/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php b/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php
index 86a50eefef..351d78ffec 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/ModulesByStatus.php
@@ -438,7 +438,7 @@ class ModulesByStatus extends Widget
[
'id' => $tableId,
'class' => 'info_table align-left-important',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'include/ajax/module',
diff --git a/pandora_console/include/styles/form.css b/pandora_console/include/styles/form.css
index fd7e496aac..a0e5957358 100644
--- a/pandora_console/include/styles/form.css
+++ b/pandora_console/include/styles/form.css
@@ -365,3 +365,7 @@ form#modal_form_feedback > ul > li > textarea {
form#modal_form_feedback > ul > li:not(:first-child) > label {
margin-top: 20px !important;
}
+
+table.dataTable {
+ box-sizing: border-box !important;
+}
diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css
index e0ca7fc68f..14305f533d 100644
--- a/pandora_console/include/styles/pandora.css
+++ b/pandora_console/include/styles/pandora.css
@@ -11949,7 +11949,7 @@ span.help_icon_15px > img {
/* ==== Spinner ==== */
.spinner-fixed {
position: absolute;
- left: 40%;
+ left: 45%;
top: 40%;
z-index: 1;
width: 100px;
@@ -11959,6 +11959,7 @@ span.help_icon_15px > img {
animation: animate 1.2s linear infinite;
margin: auto;
margin-bottom: 40px;
+ text-align: initial;
}
.spinner-fixed span {
position: absolute;
diff --git a/pandora_console/include/styles/tables.css b/pandora_console/include/styles/tables.css
index 562ffc3c80..bc6c504529 100644
--- a/pandora_console/include/styles/tables.css
+++ b/pandora_console/include/styles/tables.css
@@ -381,15 +381,35 @@ a.pandora_pagination.current:hover {
cursor: pointer;
}
+.dt-button.buttons-csv.buttons-html5.mini-csv-button {
+ background-image: url(../../images/file-csv.svg);
+ background-position: 4px center;
+ height: 26px;
+ width: 31px;
+ margin-left: 10px;
+ box-shadow: 0px 0px 0px #00000000;
+ border: 0px;
+ border-radius: 0px;
+}
+
.dt-button.buttons-csv.buttons-html5:hover {
color: #1d7873 !important;
border: 2px solid #1d7873 !important;
}
+.dt-button.buttons-csv.buttons-html5.mini-csv-button:hover {
+ color: #00000000 !important;
+ border: 0px !important;
+}
+
.dt-button.buttons-csv.buttons-html5:before {
content: "csv";
}
+.dt-button.buttons-csv.buttons-html5.mini-csv-button:before {
+ content: "";
+}
+
.dt-button.buttons-csv.buttons-html5 span {
font-size: 0;
}
diff --git a/pandora_console/operation/agentes/alerts_status.php b/pandora_console/operation/agentes/alerts_status.php
index 4db865990f..7f7309794e 100755
--- a/pandora_console/operation/agentes/alerts_status.php
+++ b/pandora_console/operation/agentes/alerts_status.php
@@ -359,7 +359,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,
diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php
index 92f1875513..04a51cb88a 100644
--- a/pandora_console/operation/events/events.php
+++ b/pandora_console/operation/events/events.php
@@ -2560,7 +2560,7 @@ try {
[
'id' => $table_id,
'class' => 'info_table events',
- 'style' => 'width: 99%;',
+ 'style' => 'width: 100%;',
'ajax_url' => 'operation/events/events',
'ajax_data' => [
'get_events' => 1,
diff --git a/pandora_console/operation/inventory/inventory.php b/pandora_console/operation/inventory/inventory.php
index 63b302062c..536f470fe6 100755
--- a/pandora_console/operation/inventory/inventory.php
+++ b/pandora_console/operation/inventory/inventory.php
@@ -804,7 +804,7 @@ if ($inventory_module !== 'basic') {
[
'id' => $id_table,
'class' => 'info_table w100p',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
'no_sortable_columns' => [],
@@ -919,7 +919,7 @@ if ($inventory_module !== 'basic') {
[
'id' => $id_table,
'class' => 'info_table w100p',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
'no_sortable_columns' => [],
@@ -1083,7 +1083,7 @@ if ($inventory_module !== 'basic') {
[
'id' => $id_table,
'class' => 'info_table w100p',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
'no_sortable_columns' => [],
@@ -1173,7 +1173,7 @@ if ($inventory_module !== 'basic') {
[
'id' => $id_table,
'class' => 'info_table w100p',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
'no_sortable_columns' => [],
@@ -1188,6 +1188,8 @@ if ($inventory_module !== 'basic') {
'emptyTable' => __('No inventory found'),
'return' => true,
'no_sortable_columns' => [],
+ 'mini_search' => true,
+ 'mini_pagination' => true,
]
);
@@ -1204,7 +1206,7 @@ if ($inventory_module !== 'basic') {
[
'id' => $id_table,
'class' => 'info_table w100p',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
'no_sortable_columns' => [],
@@ -1233,7 +1235,7 @@ if ($inventory_module !== 'basic') {
$agentes = [];
$data = [];
$class = 'info_table';
- $style = 'width: 99%';
+ $style = 'width: 100%';
$ordering = true;
$searching = false;
diff --git a/pandora_console/views/calendar/list.php b/pandora_console/views/calendar/list.php
index 236f20460e..2a7c0721c9 100644
--- a/pandora_console/views/calendar/list.php
+++ b/pandora_console/views/calendar/list.php
@@ -105,7 +105,7 @@ try {
[
'id' => $tableId,
'class' => 'info_table',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => $ajax_url,
diff --git a/pandora_console/views/cluster/list.php b/pandora_console/views/cluster/list.php
index f9afe627c1..39c00efd91 100644
--- a/pandora_console/views/cluster/list.php
+++ b/pandora_console/views/cluster/list.php
@@ -82,7 +82,7 @@ try {
[
'id' => $tableId,
'class' => 'info_table',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => $model->ajaxController,
diff --git a/pandora_console/views/consoles/list.php b/pandora_console/views/consoles/list.php
index 14131f4357..a35f0818cf 100644
--- a/pandora_console/views/consoles/list.php
+++ b/pandora_console/views/consoles/list.php
@@ -86,7 +86,7 @@ try {
[
'id' => $tableId,
'class' => 'info_table',
- 'style' => 'width: 99%',
+ 'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'include/ajax/consoles.ajax',