Refactor license contract page and improve collection display#114
Refactor license contract page and improve collection display#114
Conversation
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().
|
@amadulhaxxani This is actually by copilot, can you give it a review? |
There was a problem hiding this comment.
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. |
src/app/license-contract-page/license-contract-page.component.html
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
amadulhaxxani
left a comment
There was a problem hiding this comment.
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?
src/app/license-contract-page/license-contract-page.component.html
Outdated
Show resolved
Hide resolved
src/app/license-contract-page/license-contract-page.component.ts
Outdated
Show resolved
Hide resolved
Guard license stream with EMPTY and stricter check
|
@copilot in the "collectionId present" case hande bogus collectionIds, i.e. show error message |
* 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>
|
Backport branch created but failed to create PR. 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) |
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
collectionIdis 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]PaginationServiceto manage and clear pagination state when appropriate. (src/app/license-contract-page/license-contract-page.component.ts) [1] [2] [3]Testing Improvements
src/app/license-contract-page/license-contract-page.component.spec.ts) [1] [2] [3]ngVarand 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.