refactor: restore traditional pagination - #1661
labmecanicatec wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR restores traditional, server-driven pagination across multiple admin and credits log screens by re-enabling page size usage from IPageable/PageInfo and adding a new Smarty {pagination} helper to render page navigation links.
Changes:
- Re-enable and consistently pass
GetPageNumber()/GetPageSize()into list-loading services/repositories to avoid accidental “pageSize=1” limiting whennullis coerced. - Add a Smarty
{pagination pageInfo=$PageInfo}function and wire it into several templates to display page navigation and result counts. - Adjust frontend pagination click handling to target the new pagination link markup.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Web/scripts/ajax-helpers.js | Updates AJAX pagination click selector for the new pagination link markup. |
| tpl/Credits/transaction_log.tpl | Adds {pagination} to the user transaction log partial and normalizes {datatable} call syntax. |
| tpl/Credits/credit_log.tpl | Adds {pagination} to the user credit log partial and normalizes {datatable} call syntax. |
| tpl/Admin/Users/manage_users.tpl | Adds {pagination} below the users table. |
| tpl/Admin/Users/credit_log.tpl | Adds {pagination} and minor include formatting cleanup. |
| tpl/Admin/Schedules/view_schedules.tpl | Adds {pagination} below the schedules table. |
| tpl/Admin/Schedules/manage_schedules.tpl | Adds {pagination} and swaps datatablefilter to datatable for the schedules table initialization. |
| tpl/Admin/Resources/manage_resources.tpl | Adds {pagination} below the resources table. |
| tpl/Admin/Reservations/manage_reservations.tpl | Adds {pagination} below the reservations table. |
| tpl/Admin/Payments/transaction_log.tpl | Adds {pagination} to the admin payments transaction log partial and normalizes {datatable} call syntax. |
| tpl/Admin/Groups/manage_groups.tpl | Adds {pagination} below the groups table. |
| tpl/Admin/Blackouts/manage_blackouts.tpl | Adds {pagination} below the blackouts table. |
| Presenters/ViewSchedulesPresenter.php | Passes page number + page size to schedules list retrieval. |
| Presenters/Admin/ManageUsersPresenter.php | Passes page size to user repository list retrieval; minor formatting cleanups. |
| Presenters/Admin/ManageSchedulesPresenter.php | Passes page size to schedules list retrieval. |
| Presenters/Admin/ManageResourcesPresenter.php | Passes page size to resources repository list retrieval. |
| Presenters/Admin/ManageReservationsPresenter.php | Passes page size to reservations filtered load; minor formatting cleanups. |
| Presenters/Admin/ManageGroupsPresenter.php | Passes page size to groups repository list retrieval. |
| Presenters/Admin/ManageBlackoutsPresenter.php | Passes page size to blackouts filtered load. |
| Pages/Admin/ManageUsersPage.php | Restores GetPageSize() by delegating to the wrapped pageable implementation. |
| Pages/Admin/ManageSchedulesPage.php | Restores GetPageSize() (with existing cap logic) to support server pagination again. |
| Pages/Admin/ManageResourcesPage.php | Restores GetPageSize() (with existing cap logic) to support server pagination again. |
| Pages/Admin/ManageReservationsPage.php | Restores GetPageSize() by delegating to the wrapped pageable implementation. |
| Pages/Admin/ManageGroupsPage.php | Restores GetPageSize() by delegating to the wrapped pageable implementation. |
| Pages/Admin/ManageBlackoutsPage.php | Restores GetPageSize() by delegating to the wrapped pageable implementation. |
| lib/Common/SmartyPage.php | Registers {pagination} and implements CreatePagination/CreatePageLink; adjusts DataTables initialization. |
Suppressed comments (2)
Web/scripts/ajax-helpers.js:277
- ajaxPagination reads data attributes from
$(e.target). If the click originates from a nested element inside the (e.g., an icon/span), data-page/data-page-size will be missing and pagination will break. Use $ (this) and/or select anchors by data attributes so all pagination links are handled consistently.
element.find('a.page-link').on('click', function (e) {
e.preventDefault();
var a = $(e.target);
callback(a.data('page'), a.data('page-size'));
});
lib/Common/SmartyPage.php:749
- CreateDataTableFilter's language configuration maps the Info strings incorrectly:
infois currently set to the Filter text, andinfoEmptyis set to the Info text. This produces incorrect UI copy in the table footer.
const tableFilter = new DataTable("#' . $tableId . '", {
"dom": \'<"d-flex justify-content-between my-1"fl><t>t<"d-flex justify-content-center"i><"d-flex justify-content-center"p><"clear">\',
"pageLength": ' . $defaultPageSize . ',
"lengthMenu": ' . $lengthMenu . ',
language: {
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
c04639f to
67a38fd
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 26 out of 26 changed files in this pull request and generated 8 comments.
Suppressed comments (1)
lib/Common/SmartyPage.php:791
- Use the existing
PageInfo::Allconstant instead of the magic-1; this keeps the link coupled to the paging contract if its sentinel changes.
$sb->Append($this->CreatePageLink(['class' => 'link-primary', 'page' => 1, 'size' => -1, 'text' => $viewAllText], $smarty));
67a38fd to
5a34e01
Compare
5a34e01 to
6a4545c
Compare
6a4545c to
fa2e125
Compare
- Replace null parameters with actual page number and size - Use page->GetPageNumber() and page->GetPageSize() for pagination - Improves performance by limiting results per request
- Restore CreatePagination and CreatePageLink methods - Enable page navigation with prev/next buttons - Display results range and total count - Add data attributes for pagination handling - Replace view all behavior with paginated browsing Assisted-by: Claude:claude-haiku-4.5
fa2e125 to
7fdb301
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
CSV exports are truncated, and pagination correctness and accessibility issues remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 3
Open (3)
Resolved since last review (8)
This script is injected repeatedly for AJAX credit/transaction-log fragments, and the user credits…CreateDataTableis shared by many templates, but this now disables client-side paging… Replacingdatatablefilterwithdatatableremoves this page’s only schedule filter because… For the newly server-paginated tables, DataTables still defaults to client-side ordering. Clicking… The regression fix is not protected by a test that verifies the repository receives the page size.… This selector excludes the generated “View All” anchor becauseCreatePagination()gives it only… The restored page-size cap uses an unexplained10and duplicates the same rule in… The restored page-size cap uses an unexplained10and duplicates the same rule in…
| $reservations = $this->manageReservationsService->LoadFiltered( | ||
| $this->page->GetPageNumber(), | ||
| null, | ||
| $this->page->GetPageSize(), |
| $results = $this->resourceRepository->GetList( | ||
| $this->page->GetPageNumber(), | ||
| null, | ||
| $this->page->GetPageSize(), |
| $userList = $this->userRepository->GetList( | ||
| $this->page->GetPageNumber(), | ||
| null, | ||
| $this->page->GetPageSize(), |
Server-side pagination is a worthwhile goal for large installs, and the new The review did find several regressions that should be fixed before merging. Blocking
Other issues
Commit messages
|
|
This review was generated by Codex. Recommendation: request changes. The switch to server pagination leaves several existing table features operating on only the loaded page. In
In
Before merging, preserve query parameters when generating links, connect sorting/search/export behavior to the full matching dataset, and disable client pagination only for tables explicitly converted to server pagination. The existing unit suite completes without failures, but neither commit adds regression tests covering these interactions. Browser and database integration behavior was not exercised during this review. |
The truncation of the users, resources, and reservations tables when exporting to CSV can be considered a "bug" present in version 2.8—one that was "resolved" by removing traditional pagination. The expectation was that the user would apply the necessary filters, click "Show all," and then export to CSV. |



Close: #1612
Assisted-by: Claude:claude-haiku-4.5