Skip to content

UoE/Clear statistics table pagination params on navigation - #25

Merged
milanmajchrak merged 3 commits into
datashare-UoEMainLibrary-dspace-8_xfrom
uoe/statistics-topitems-community-collection
Jul 20, 2026
Merged

UoE/Clear statistics table pagination params on navigation#25
milanmajchrak merged 3 commits into
datashare-UoEMainLibrary-dspace-8_xfrom
uoe/statistics-topitems-community-collection

Conversation

@jr-rk

@jr-rk jr-rk commented Jul 15, 2026

Copy link
Copy Markdown

Summary

Frontend half of dataquest-dev/dspace-customers#807. The shared StatisticsTableComponent already paginates every statistics table at all levels (site/community/collection/item) via URL-driven ds-pagination (DSpace#726 / #11); the only missing piece was cleanup — pagination params (stats-<uuid>_<reportType>.page/.rpp) leaked into the URL across scope navigation because pagination uses queryParamsHandling: 'merge'.

Impact is URL cleanliness, not a pagination correctness fix

Changes

  • ngOnDestroyPaginationService.clearPagination(id) — same idiom as the other paginated components; deferred (not eager) so simultaneous multi-table destroys don't race the in-flight navigation.
  • Guard for destroy-before-init; specs cover both.

Connected PRs

After fix:

community-totalvisits-per-month item-file-visits item-top-country-views item-top-city-views

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 866e6b8d-66c6-4c27-b7b8-23fb6b4d4014

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds scoped “Top item views” reporting to community and collection statistics pages, aligning pagination behavior across all DSO scopes and preventing pagination query params from leaking between scopes.

Changes:

  • Adds the TopItems report type to community and collection statistics pages and provides the corresponding i18n table title.
  • Clears per-table pagination query params on StatisticsTableComponent teardown to prevent cross-scope pagination leakage.
  • Extends/updates unit specs to cover the new report/table presence, label behavior, and pagination cleanup.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/assets/i18n/en.json5 Adds the statistics.table.title.TopItems translation string used for the new scoped table title.
src/app/statistics-page/statistics-table/statistics-table.component.ts Clears the table’s pagination params on destroy to avoid leaking page/rpp between scopes.
src/app/statistics-page/statistics-table/statistics-table.component.spec.ts Adds coverage for pagination cleanup on destroy and TopItems label handling.
src/app/statistics-page/site-statistics-page/site-statistics-page.component.spec.ts Updates PaginationService mock to include clearPagination for teardown behavior.
src/app/statistics-page/item-statistics-page/item-statistics-page.component.spec.ts Updates PaginationService mock to include clearPagination for teardown behavior.
src/app/statistics-page/community-statistics-page/community-statistics-page.component.ts Includes TopItems in the community statistics report types list.
src/app/statistics-page/community-statistics-page/community-statistics-page.component.spec.ts Verifies the community page renders the new TopItems report table.
src/app/statistics-page/collection-statistics-page/collection-statistics-page.component.ts Includes TopItems in the collection statistics report types list.
src/app/statistics-page/collection-statistics-page/collection-statistics-page.component.spec.ts Verifies the collection page renders the new TopItems report table.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jr-rk jr-rk self-assigned this Jul 16, 2026
Statistics pagination is URL-driven with queryParamsHandling: 'merge', so a page/rpp selection made on one scope's statistics page persisted in the URL when navigating to another scope. Clear the table's own params on destroy, like other paginated components do.

Verified on the seeded local instance that ds-pagination already renders and pages correctly at community, collection and item level via the shared StatisticsTableComponent (DSpace#726); no further frontend change is needed for lower-level pagination.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jr-rk
jr-rk force-pushed the uoe/statistics-topitems-community-collection branch from f4fe2f7 to cfc036f Compare July 16, 2026 13:19
@jr-rk jr-rk changed the title UoE/Scoped top-items statistics on community and collection pages UoE/Clear statistics table pagination params on navigation Jul 16, 2026
@jr-rk
jr-rk requested a review from Copilot July 16, 2026 13:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread src/app/statistics-page/statistics-table/statistics-table.component.ts Outdated
The stale stats-* params only survive 'merge' navigations (e.g. the navbar search form); plain navigations drop them. Clarify that clearPagination stages nulls applied on the service's next updateRoute, and why no navigation is issued from ngOnDestroy (racing the in-flight navigation).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Let Angular invoke ngOnDestroy through fixture.destroy() on a component whose ngOnInit never ran (createComponent without detectChanges), instead of calling the hook directly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@jr-rk
jr-rk requested a review from milanmajchrak July 17, 2026 20:00
@milanmajchrak
milanmajchrak merged commit e7dae74 into datashare-UoEMainLibrary-dspace-8_x Jul 20, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants