Skip to content

Commit 3247a97

Browse files
committed
Removed "All" page length option for log tables, as this easily causes an out of memory situation on the server
You can easily have thousands of log entries, making it impossible to view them all at once. This fixes #835
1 parent edd254e commit 3247a97

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

config/packages/datatables.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ datatables:
88

99
# Set options, as documented at https://datatables.net/reference/option/
1010
options:
11-
lengthMenu : [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]]
11+
lengthMenu : [[10, 25, 50, 100], [10, 25, 50, 100]] # We add the "All" option, when part tables are generated
1212
pageLength: '%partdb.table.default_page_size%' # Set to -1 to disable pagination (i.e. show all rows) by default
1313
dom: " <'row' <'col mb-2 input-group flex-nowrap' B l > <'col-auto mb-2' < p >>>
1414
<'card'

src/Controller/PartListsController.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ protected function showListWithFilter(Request $request, string $template, ?calla
132132

133133
$filterForm->handleRequest($formRequest);
134134

135-
$table = $this->dataTableFactory->createFromType(PartsDataTable::class, array_merge(['filter' => $filter], $additional_table_vars))
135+
$table = $this->dataTableFactory->createFromType(
136+
PartsDataTable::class,
137+
array_merge(['filter' => $filter], $additional_table_vars),
138+
['lengthMenu' => PartsDataTable::LENGTH_MENU]
139+
)
136140
->handleRequest($request);
137141

138142
if ($table->isCallback()) {

src/DataTables/PartsDataTable.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757

5858
final class PartsDataTable implements DataTableTypeInterface
5959
{
60+
const LENGTH_MENU = [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]];
61+
6062
public function __construct(
6163
private readonly EntityURLGenerator $urlGenerator,
6264
private readonly TranslatorInterface $translator,

0 commit comments

Comments
 (0)