UoE/Add pagination to statistics tables (#726)#11
Conversation
The statistics tables (e.g. the repository-wide "Total visits" report) rendered every point in a single, ungoverned table and, combined with the backend cap of 10 items, users could only ever see the first 10 datasets. Add client-side pagination to the shared StatisticsTableComponent so that all reports paginate their points and every dataset can be browsed page by page. - Render only the current page of points (default 10 per page). - Show an ngb-pagination control when there are more points than fit on a page. - Add the `statistics.table.pagination.label` i18n key for accessibility. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Replace the raw ngb-pagination control with DSpace's standard PaginationComponent (ds-pagination) for consistency with the rest of the UI. Each statistics report table now paginates its points independently via a unique pagination id, the current page is driven through PaginationService, and the standard "Now showing X - Y of Z" detail and page-size selector are shown. - StatisticsTableComponent: build PaginationComponentOptions and derive the current page of points from PaginationService.getCurrentPagination(). - Template: wrap the table in <ds-pagination> and iterate the paged points. - Remove the custom statistics.table.pagination.label i18n key (ds-pagination provides its own accessible labels). - Provide a mocked PaginationService in the statistics page specs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds client-side pagination to the shared statistics table so large usage reports can be browsed page-by-page instead of rendering all rows at once.
Changes:
- Introduces paging state (
PaginationComponentOptions) and apaginatedPoints$slice inStatisticsTableComponent. - Wraps the table in the shared
ds-paginationcomponent and renders only the current page. - Extends/updates unit tests and page specs to accommodate the new pagination dependency.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/app/statistics-page/statistics-table/statistics-table.component.ts | Adds pagination options/state and slices points based on current page. |
| src/app/statistics-page/statistics-table/statistics-table.component.html | Wraps the table with ds-pagination and iterates over paginated points. |
| src/app/statistics-page/statistics-table/statistics-table.component.spec.ts | Adds pagination-focused unit tests and a mock pagination component. |
| src/app/statistics-page/site-statistics-page/site-statistics-page.component.spec.ts | Provides a PaginationService stub for tests. |
| src/app/statistics-page/item-statistics-page/item-statistics-page.component.spec.ts | Provides a PaginationService stub for tests. |
| src/app/statistics-page/community-statistics-page/community-statistics-page.component.spec.ts | Provides a PaginationService stub for tests. |
| src/app/statistics-page/collection-statistics-page/collection-statistics-page.component.spec.ts | Provides a PaginationService stub for tests. |
Comments suppressed due to low confidence (1)
src/app/statistics-page/statistics-table/statistics-table.component.spec.ts:101
- The test descriptions refer to a "storage report", but the component deals with a
UsageReport. Renaming these descriptions will make the specs easier to understand/grep and align with the domain language used elsewhere in the file.
describe('when the storage report is empty', () => {
it ('should not display a table', () => {
expect(de.query(By.css('table'))).toBeNull();
});
it('should not display a pagination control', () => {
expect(de.query(By.directive(MockPaginationComponent))).toBeNull();
});
});
describe('when the storage report has data', () => {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Make the ds-pagination id unique per scope (use report.id, i.e. `<dso-uuid>_<reportType>`) so navigating between scopes that share a report type (e.g. TotalVisits) no longer reuses a stale page from the URL. - Hide the page-size gear so pageSize behaves as a fixed, input-driven size. - Hide the pagination detail/bar for single-page reports, so the pagination UI only appears when there are more points than fit on one page. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Re-enable the standard ds-pagination "results per page" selector (gear) so users can choose how many datasets to show per page (10/20/40/60/80/100), reusing the built-in PaginationComponent control. The gear and pagination detail are shown only when a report has more rows than fit on one page; pageSize remains the default. The page slicing already honours the selected size. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ed to the table (DSpace#726) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
9fe5e6a
into
datashare-UoEMainLibrary-dspace-8_x
Summary
Resolves dataquest-dev/dspace-customers#726.
The statistics tables (e.g. the repository-wide Total visits report shown on the site statistics page) previously rendered every point in a single, ungoverned table. Combined with the backend limit of 10 items, users could only ever see the first 10 datasets.
This PR adds client-side pagination to the shared
StatisticsTableComponent, so every statistics report (Total visits, Top countries, Top cities, …) paginates its rows and all datasets can be browsed page by page. It is paired with a backend change that lifts the 10-item cap so all datasets are returned (see the backend PR).Changes
StatisticsTableComponentnow renders only the current page of points (default 10 per page, configurable via thepageSizeinput).ngb-paginationcontrol is shown only when there are more points than fit on a single page.statistics.table.pagination.labeli18n key for the pagination control's accessible label.Testing (TDD)
Added unit tests to
statistics-table.component.spec.tsfirst (red), then implemented until green:Notes
🤖 Generated with Claude Code