-
Notifications
You must be signed in to change notification settings - Fork 526
[DSpace-CRIS] Inverse Relations via Authority Framework (Frontend) #5134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
FrancescoMolinaro
wants to merge
7
commits into
DSpace:main
Choose a base branch
from
4Science:task/main/DURACOM-445
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+358
−57
Open
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7657918
[DURACOM-445] add new property for authority relations
FrancescoMolinaro 5ac23e6
[DURACOM-445] add authority based search relations component
FrancescoMolinaro 23ecd1e
[DURACOM-445] add nav tabs to authority-related-entities-search, fix …
FrancescoMolinaro e7b81b2
Merge remote-tracking branch 'gitHub/main' into task/main/DURACOM-445
FrancescoMolinaro aa9ed65
Merge remote-tracking branch 'gitHub/main' into task/main/DURACOM-445
FrancescoMolinaro 493ebcc
[DURACOM-445] set authority relations config as false by default, con…
FrancescoMolinaro ff807f9
[DURACOM-445] add missing labels
FrancescoMolinaro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...tities/authority-related-entities-search/authority-related-entities-search.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| @if (configurations.length > 1) { | ||
| <ul ngbNav #tabs="ngbNav" | ||
| [destroyOnHide]="true" | ||
| [activeId]="activeTab$ | async" | ||
| (navChange)="onTabChange($event)" | ||
| class="nav-tabs"> | ||
|
|
||
| @for (config of configurations; track config) { | ||
| <li [ngbNavItem]="config"> | ||
| <a ngbNavLink> | ||
| {{('item.page.relationships.' + config) | translate}} | ||
| </a> | ||
|
|
||
| <ng-template ngbNavContent> | ||
| <div class="mt-4"> | ||
| <ds-configuration-search-page | ||
| class="w-100" | ||
| [fixedFilterQuery]="searchFilter" | ||
| [configuration]="config" | ||
| [searchEnabled]="searchEnabled" | ||
| [showScopeSelector]="false"> | ||
| </ds-configuration-search-page> | ||
| </div> | ||
| </ng-template> | ||
| </li> | ||
| } | ||
| </ul> | ||
|
|
||
| <div [ngbNavOutlet]="tabs"></div> | ||
| } | ||
|
|
||
|
|
||
| @if (configurations.length === 1) { | ||
| <ds-configuration-search-page | ||
| class="w-100" | ||
| [fixedFilterQuery]="searchFilter" | ||
| [configuration]="configurations[0]" | ||
| [searchEnabled]="searchEnabled" | ||
| [showScopeSelector]="false"> | ||
| </ds-configuration-search-page> | ||
| } |
99 changes: 99 additions & 0 deletions
99
...ies/authority-related-entities-search/authority-related-entities-search.component.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| import { NO_ERRORS_SCHEMA } from '@angular/core'; | ||
| import { | ||
| ComponentFixture, | ||
| TestBed, | ||
| waitForAsync, | ||
| } from '@angular/core/testing'; | ||
| import { | ||
| ActivatedRoute, | ||
| Router, | ||
| } from '@angular/router'; | ||
| import { Item } from '@dspace/core/shared/item.model'; | ||
| import { RouterMock } from '@dspace/core/testing/router.mock'; | ||
| import { TranslateModule } from '@ngx-translate/core'; | ||
| import { of } from 'rxjs'; | ||
|
|
||
| import { ThemedConfigurationSearchPageComponent } from '../../../../search-page/themed-configuration-search-page.component'; | ||
| import { AuthorityRelatedEntitiesSearchComponent } from './authority-related-entities-search.component'; | ||
|
|
||
|
|
||
| describe('AuthorityRelatedEntitiesSearchComponent', () => { | ||
| let component: AuthorityRelatedEntitiesSearchComponent; | ||
| let fixture: ComponentFixture<AuthorityRelatedEntitiesSearchComponent>; | ||
|
|
||
| const mockItem = { | ||
| id: 'test-id-123', | ||
| } as Item; | ||
| const router = new RouterMock(); | ||
|
|
||
|
|
||
| beforeEach(waitForAsync(() => { | ||
| TestBed.configureTestingModule({ | ||
| imports: [TranslateModule.forRoot(), AuthorityRelatedEntitiesSearchComponent], | ||
| providers: [ | ||
| { | ||
| provide: ActivatedRoute, | ||
| useValue: { | ||
| queryParams: of({ tab: 'relations-configuration' }), | ||
| snapshot: { | ||
| queryParams: { | ||
| scope: 'collection-uuid', | ||
| query: 'test', | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| { provide: Router, useValue: router }, | ||
| ], | ||
| schemas: [NO_ERRORS_SCHEMA], | ||
| }) | ||
| .overrideComponent(AuthorityRelatedEntitiesSearchComponent, { | ||
| remove: { | ||
| imports: [ | ||
| ThemedConfigurationSearchPageComponent, | ||
| ], | ||
| }, | ||
| }) | ||
| .compileComponents(); | ||
| })); | ||
|
|
||
| beforeEach(() => { | ||
| fixture = TestBed.createComponent(AuthorityRelatedEntitiesSearchComponent); | ||
| component = fixture.componentInstance; | ||
| component.item = mockItem; | ||
| component.configurations = ['relations-configuration']; | ||
| fixture.detectChanges(); | ||
| }); | ||
|
|
||
| it('should create', () => { | ||
| expect(component).toBeTruthy(); | ||
| }); | ||
|
|
||
| it('should set searchFilter on init', () => { | ||
| component.item = mockItem; | ||
| component.ngOnInit(); | ||
|
|
||
| expect(component.searchFilter).toBe('scope=test-id-123'); | ||
| }); | ||
|
|
||
| it('should render configuration search page when configuration is provided', () => { | ||
| component.item = mockItem; | ||
| component.configurations = ['test-config']; | ||
|
|
||
| fixture.detectChanges(); | ||
|
|
||
| const searchPage = fixture.nativeElement.querySelector('ds-configuration-search-page'); | ||
| expect(searchPage).toBeTruthy(); | ||
| }); | ||
|
|
||
| it('should NOT render configuration search page when configuration is missing', () => { | ||
| component.item = mockItem; | ||
| component.configurations = []; | ||
|
|
||
| fixture.detectChanges(); | ||
|
|
||
| const searchPage = fixture.nativeElement.querySelector('ds-configuration-search-page'); | ||
| expect(searchPage).toBeFalsy(); | ||
| }); | ||
|
|
||
| }); |
52 changes: 52 additions & 0 deletions
52
...entities/authority-related-entities-search/authority-related-entities-search.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import { AsyncPipe } from '@angular/common'; | ||
| import { | ||
| Component, | ||
| Input, | ||
| OnInit, | ||
| } from '@angular/core'; | ||
| import { | ||
| NgbNav, | ||
| NgbNavContent, | ||
| NgbNavItem, | ||
| NgbNavLink, | ||
| NgbNavOutlet, | ||
| } from '@ng-bootstrap/ng-bootstrap'; | ||
| import { TranslateModule } from '@ngx-translate/core'; | ||
|
|
||
| import { ThemedConfigurationSearchPageComponent } from '../../../../search-page/themed-configuration-search-page.component'; | ||
| import { TabbedRelatedEntitiesSearchComponent } from '../tabbed-related-entities-search/tabbed-related-entities-search.component'; | ||
|
|
||
| @Component({ | ||
| selector: 'ds-authority-related-entities-search', | ||
| templateUrl: './authority-related-entities-search.component.html', | ||
| imports: [ | ||
| AsyncPipe, | ||
| NgbNav, | ||
| NgbNavContent, | ||
| NgbNavItem, | ||
| NgbNavLink, | ||
| NgbNavOutlet, | ||
| ThemedConfigurationSearchPageComponent, | ||
| TranslateModule, | ||
| ], | ||
| }) | ||
| /** | ||
| * A component to show related items as search results, based on authority value | ||
| */ | ||
| export class AuthorityRelatedEntitiesSearchComponent extends TabbedRelatedEntitiesSearchComponent implements OnInit { | ||
| /** | ||
| * Filter used for set scope in discovery invocation | ||
| */ | ||
| searchFilter: string; | ||
| /** | ||
| * Discovery configurations for search page | ||
| */ | ||
| @Input() configurations: string[] = []; | ||
|
|
||
|
|
||
|
|
||
| ngOnInit() { | ||
| super.ngOnInit(); | ||
| this.searchFilter = `scope=${this.item.id}`; | ||
| } | ||
| } |
2 changes: 1 addition & 1 deletion
2
...ted-entities/tabbed-related-entities-search/tabbed-related-entities-search.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FrancescoMolinaro : I haven't fully reviewed/tested this PR, but I have an immediate question about this PR.
How does this
showAuthorityRelationsfrontend setting relate to the newrelationship.enable-virtual-metadata = truesetting on the backend?The reason I ask is that I'm trying to understand whether you always would want
showAuthorityRelationsto be set totruewheneverrelationship.enable-virtual-metadatais set tofalse. If so, then we might want to consider reading the value ofrelationship.enable-virtual-metadatafrom the backend in order to determine the correct behavior of the frontend.But, if these configs are unrelated, then we definitely should keep both. I'm just trying to better understand if this PR requires
relationship.enable-virtual-metadata=falseor not.