Skip to content

Refactor license contract page and improve collection display#114

Merged
kosarko merged 5 commits intoclarin-v7from
contract_page
Mar 20, 2026
Merged

Refactor license contract page and improve collection display#114
kosarko merged 5 commits intoclarin-v7from
contract_page

Conversation

@kosarko
Copy link
Member

@kosarko kosarko commented Mar 19, 2026

This pull request enhances the LicenseContractPageComponent, it keeps the previous functionality when collectionId is supplied and switches to "list mode" otherwise. The list mode shows all the collections (and their licenses) to which the current user has submission rights.

The most important changes are grouped by feature and testing improvements:

Feature: Support for List Mode and Pagination

  • The component now supports displaying a paginated list of authorized collections when no collectionId is provided, including UI changes to render a paginated list, handle empty states, and display loading/errors. (src/app/license-contract-page/license-contract-page.component.html, src/app/license-contract-page/license-contract-page.component.ts) [1] [2] [3] [4]
  • Introduces pagination configuration and uses the PaginationService to manage and clear pagination state when appropriate. (src/app/license-contract-page/license-contract-page.component.ts) [1] [2] [3]

Testing Improvements

  • Updates and expands the component spec to test both single collection and list modes, including the new pagination logic and destruction behavior. (src/app/license-contract-page/license-contract-page.component.spec.ts) [1] [2] [3]
  • Adds a mock directive for ngVar and stubs/mocks for pagination and collection services to enable comprehensive testing of new scenarios. (src/app/license-contract-page/license-contract-page.component.spec.ts) [1] [2]

These changes make the license contract page more flexible and robust, supporting both individual collection and authorized collections views with proper pagination and error handling.

kosarko added 2 commits March 19, 2026 13:27
lists all authorized collections and their licenses
replaced the nested manual subscriptions in
license-contract-page.component.ts with a single RxJS pipeline using
tap(...), switchMap(...), and takeUntil(this.destroy$), then completed
cleanup in ngOnDestroy().
@kosarko kosarko requested a review from amadulhaxxani March 19, 2026 13:58
@kosarko
Copy link
Member Author

kosarko commented Mar 19, 2026

@amadulhaxxani This is actually by copilot, can you give it a review?

@amadulhaxxani amadulhaxxani requested a review from Copilot March 19, 2026 14:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors LicenseContractPageComponent to support two modes: the existing single-collection license display when collectionId is provided via query params, and a new “list mode” that shows a paginated list of all submit-authorized collections (including their licenses) when collectionId is missing.

Changes:

  • Add list-mode data flow using PaginationService.getFindListOptions + CollectionDataService.getAuthorizedCollection, and clear pagination state on destroy.
  • Update the template to conditionally render either single-collection license or a paginated authorized-collections list with loading/error/empty states.
  • Expand unit tests to cover both single and list modes, including pagination clearing behavior.

Reviewed changes

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

File Description
src/app/license-contract-page/license-contract-page.component.ts Adds list-mode logic, pagination config, and teardown behavior; refactors single-mode license loading to avoid nested subscriptions.
src/app/license-contract-page/license-contract-page.component.html Introduces conditional rendering for list mode with <ds-pagination> and loading/error/empty UI.
src/app/license-contract-page/license-contract-page.component.spec.ts Updates tests and mocks to cover new list-mode behavior and pagination clearing on destroy.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link

@amadulhaxxani amadulhaxxani left a comment

Choose a reason for hiding this comment

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

Overall seems fine to me - I tested manually as well
One issue is already resolved by the AI while I was writing and other one may need attention.

Do we need error handling or loading in case of !isListMode or when the collection id is there?

Guard license stream with EMPTY and stricter check
@kosarko
Copy link
Member Author

kosarko commented Mar 19, 2026

@copilot in the "collectionId present" case hande bogus collectionIds, i.e. show error message

Copy link

Copilot AI commented Mar 19, 2026

@kosarko I've opened a new pull request, #115, to work on those changes. Once the pull request is ready, I'll request review from you.

* Initial plan

* Add error/loading handling for bogus collectionId in single-collection mode

Co-authored-by: kosarko <1842385+kosarko@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kosarko <1842385+kosarko@users.noreply.github.com>
@kosarko kosarko merged commit 0ca1429 into clarin-v7 Mar 20, 2026
5 checks passed
@port-pr
Copy link

port-pr bot commented Mar 20, 2026

Backport branch created but failed to create PR.
Request to create PR rejected with status 403.

Please create the PR manually:

Or via GitHub CLI:

gh pr create --repo dataquest-dev/dspace-angular --base dtq-dev --head ufal:backport-114-to-dtq-dev --title "[Port dtq-dev] Refactor license contract page and improve collection display" --body "Port of #114 by @kosarko to `dtq-dev`."

(see action log for full error response)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants