62264: Grouped logical entity types together into separate modules

This commit is contained in:
Kristof De Langhe
2019-05-09 17:51:11 +02:00
parent dcaeb71d68
commit 2166e0633c
61 changed files with 150 additions and 69 deletions

View File

@@ -0,0 +1,66 @@
import { Component, Inject, 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 {
filterRelationsByTypeLabel,
relationsToItems
} from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
@rendersItemType('Project', ItemViewMode.Full)
@Component({
selector: 'ds-project',
styleUrls: ['./project.component.scss'],
templateUrl: './project.component.html'
})
/**
* The component for displaying metadata and relations of an item of the type Project
*/
export class ProjectComponent extends ItemComponent implements OnInit {
/**
* The people related to this project
*/
people$: Observable<Item[]>;
/**
* The publications related to this project
*/
publications$: Observable<Item[]>;
/**
* The organisation units related to this project
*/
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)
);
this.publications$ = this.resolvedRelsAndTypes$.pipe(
filterRelationsByTypeLabel('isPublicationOfProject'),
relationsToItems(this.item.id, this.ids)
);
this.orgUnits$ = this.resolvedRelsAndTypes$.pipe(
filterRelationsByTypeLabel('isOrgUnitOfProject'),
relationsToItems(this.item.id, this.ids)
);
}
}
}