Files
dspace-angular/src/app/entity-groups/journal-entities/item-pages/journal-issue/journal-issue.component.ts

42 lines
1.4 KiB
TypeScript

import { Component } from '@angular/core';
import { Observable } from 'rxjs';
import { Item } from '../../../../core/shared/item.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';
@rendersItemType('JournalIssue', ItemViewMode.Full)
@Component({
selector: 'ds-journal-issue',
styleUrls: ['./journal-issue.component.scss'],
templateUrl: './journal-issue.component.html'
})
/**
* The component for displaying metadata and relations of an item of the type Journal Issue
*/
export class JournalIssueComponent extends ItemComponent {
/**
* The volumes related to this journal issue
*/
volumes$: Observable<Item[]>;
/**
* The publications related to this journal issue
*/
publications$: Observable<Item[]>;
ngOnInit(): void {
super.ngOnInit();
if (isNotEmpty(this.resolvedRelsAndTypes$)) {
this.volumes$ = this.resolvedRelsAndTypes$.pipe(
getRelatedItemsByTypeLabel(this.item.id, 'isJournalVolumeOfIssue')
);
this.publications$ = this.resolvedRelsAndTypes$.pipe(
getRelatedItemsByTypeLabel(this.item.id, 'isPublicationOfJournalIssue')
);
}
}
}