Commits
Kristof De Langhe authored 966bcd31f6e
1 1 | import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; |
2 2 | import { Observable } from 'rxjs'; |
3 3 | import { Item } from '../../../../core/shared/item.model'; |
4 4 | import { |
5 5 | DEFAULT_ITEM_TYPE, ItemViewMode, |
6 6 | rendersItemType |
7 7 | } from '../../../../shared/items/item-type-decorator'; |
8 8 | import { ItemComponent } from '../shared/item.component'; |
9 9 | import { MetadataRepresentation } from '../../../../core/shared/metadata-representation/metadata-representation.model'; |
10 - | import { filterRelationsByTypeLabel, relationsToItems } from '../shared/item-relationships-utils'; |
10 + | import { getRelatedItemsByTypeLabel } from '../shared/item-relationships-utils'; |
11 11 | |
12 12 | @rendersItemType('Publication', ItemViewMode.Full) |
13 13 | @rendersItemType(DEFAULT_ITEM_TYPE, ItemViewMode.Full) |
14 14 | @Component({ |
15 15 | selector: 'ds-publication', |
16 16 | styleUrls: ['./publication.component.scss'], |
17 17 | templateUrl: './publication.component.html', |
18 18 | changeDetection: ChangeDetectionStrategy.OnPush, |
19 19 | }) |
20 20 | export class PublicationComponent extends ItemComponent implements OnInit { |
39 39 | journalIssues$: Observable<Item[]>; |
40 40 | |
41 41 | ngOnInit(): void { |
42 42 | super.ngOnInit(); |
43 43 | |
44 44 | if (this.resolvedRelsAndTypes$) { |
45 45 | |
46 46 | this.authors$ = this.buildRepresentations('Person', 'dc.contributor.author'); |
47 47 | |
48 48 | this.projects$ = this.resolvedRelsAndTypes$.pipe( |
49 - | filterRelationsByTypeLabel('isProjectOfPublication'), |
50 - | relationsToItems(this.item.id) |
49 + | getRelatedItemsByTypeLabel(this.item.id, 'isProjectOfPublication') |
51 50 | ); |
52 51 | |
53 52 | this.orgUnits$ = this.resolvedRelsAndTypes$.pipe( |
54 - | filterRelationsByTypeLabel('isOrgUnitOfPublication'), |
55 - | relationsToItems(this.item.id) |
53 + | getRelatedItemsByTypeLabel(this.item.id, 'isOrgUnitOfPublication') |
56 54 | ); |
57 55 | |
58 56 | this.journalIssues$ = this.resolvedRelsAndTypes$.pipe( |
59 - | filterRelationsByTypeLabel('isJournalIssueOfPublication'), |
60 - | relationsToItems(this.item.id) |
57 + | getRelatedItemsByTypeLabel(this.item.id, 'isJournalIssueOfPublication') |
61 58 | ); |
62 59 | |
63 60 | } |
64 61 | } |
65 62 | } |