mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 06:53:03 +00:00
64574: Refactor item-pages to use paginated-lists and relationship-service
This commit is contained in:
@@ -3,9 +3,9 @@ import { Observable } from 'rxjs';
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { MetadataRepresentation } from '../../../../core/shared/metadata-representation/metadata-representation.model';
|
||||
import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator';
|
||||
import { isNotEmpty } from '../../../../shared/empty.util';
|
||||
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
|
||||
import { getRelatedItemsByTypeLabel } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
|
||||
import { RemoteData } from '../../../../core/data/remote-data';
|
||||
import { PaginatedList } from '../../../../core/data/paginated-list';
|
||||
|
||||
@rendersItemType('Project', ItemViewMode.Full)
|
||||
@Component({
|
||||
@@ -20,40 +20,28 @@ export class ProjectComponent extends ItemComponent implements OnInit {
|
||||
/**
|
||||
* The contributors related to this project
|
||||
*/
|
||||
contributors$: Observable<MetadataRepresentation[]>;
|
||||
contributors$: Observable<RemoteData<PaginatedList<MetadataRepresentation>>>;
|
||||
|
||||
/**
|
||||
* The people related to this project
|
||||
*/
|
||||
people$: Observable<Item[]>;
|
||||
people$: Observable<RemoteData<PaginatedList<Item>>>;
|
||||
|
||||
/**
|
||||
* The publications related to this project
|
||||
*/
|
||||
publications$: Observable<Item[]>;
|
||||
publications$: Observable<RemoteData<PaginatedList<Item>>>;
|
||||
|
||||
/**
|
||||
* The organisation units related to this project
|
||||
*/
|
||||
orgUnits$: Observable<Item[]>;
|
||||
orgUnits$: Observable<RemoteData<PaginatedList<Item>>>;
|
||||
|
||||
ngOnInit(): void {
|
||||
super.ngOnInit();
|
||||
this.contributors$ = this.buildRepresentations('OrgUnit', 'project.contributor.other', 'isOrgUnitOfProject');
|
||||
|
||||
if (isNotEmpty(this.resolvedRelsAndTypes$)) {
|
||||
this.contributors$ = this.buildRepresentations('OrgUnit', 'project.contributor.other');
|
||||
|
||||
this.people$ = this.resolvedRelsAndTypes$.pipe(
|
||||
getRelatedItemsByTypeLabel(this.item.id, 'isPersonOfProject')
|
||||
);
|
||||
|
||||
this.publications$ = this.resolvedRelsAndTypes$.pipe(
|
||||
getRelatedItemsByTypeLabel(this.item.id, 'isPublicationOfProject')
|
||||
);
|
||||
|
||||
this.orgUnits$ = this.resolvedRelsAndTypes$.pipe(
|
||||
getRelatedItemsByTypeLabel(this.item.id, 'isOrgUnitOfProject')
|
||||
);
|
||||
}
|
||||
this.people$ = this.relationshipService.getRelatedItemsByLabel(this.item, 'isPersonOfProject');
|
||||
this.publications$ = this.relationshipService.getRelatedItemsByLabel(this.item, 'isPublicationOfProject');
|
||||
this.orgUnits$ = this.relationshipService.getRelatedItemsByLabel(this.item, 'isOrgUnitOfProject');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user