62339: itemIds to item remotedata in relationships

This commit is contained in:
Kristof De Langhe
2019-05-10 13:44:58 +02:00
parent 7ef769431a
commit 38625d2cd5
11 changed files with 56 additions and 118 deletions

View File

@@ -1,9 +1,7 @@
import { Component, Inject, OnInit } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { ItemDataService } from '../../../../core/data/item-data.service';
import { Item } from '../../../../core/shared/item.model';
import { ItemViewMode, rendersItemType } from '../../../../shared/items/item-type-decorator';
import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
import { isNotEmpty } from '../../../../shared/empty.util';
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
import {
@@ -36,30 +34,23 @@ export class ProjectComponent extends ItemComponent implements OnInit {
*/
orgUnits$: Observable<Item[]>;
constructor(
@Inject(ITEM) public item: Item,
private ids: ItemDataService
) {
super(item);
}
ngOnInit(): void {
super.ngOnInit();
if (isNotEmpty(this.resolvedRelsAndTypes$)) {
this.people$ = this.resolvedRelsAndTypes$.pipe(
filterRelationsByTypeLabel('isPersonOfProject'),
relationsToItems(this.item.id, this.ids)
relationsToItems(this.item.id)
);
this.publications$ = this.resolvedRelsAndTypes$.pipe(
filterRelationsByTypeLabel('isPublicationOfProject'),
relationsToItems(this.item.id, this.ids)
relationsToItems(this.item.id)
);
this.orgUnits$ = this.resolvedRelsAndTypes$.pipe(
filterRelationsByTypeLabel('isOrgUnitOfProject'),
relationsToItems(this.item.id, this.ids)
relationsToItems(this.item.id)
);
}
}