Skip to content

Commit 8849f14

Browse files
117287: Removed method calls returning observables from ItemDetailPreviewComponent
1 parent 59e5f71 commit 8849f14

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<ds-metadata-field-wrapper [hideIfNoTextContent]="false">
99
<ds-themed-thumbnail [thumbnail]="item?.thumbnail | async"></ds-themed-thumbnail>
1010
</ds-metadata-field-wrapper>
11-
<ng-container *ngVar="(getFiles() | async) as bitstreams">
11+
<ng-container *ngIf="(bitstreams$ | async) as bitstreams">
1212
<ds-metadata-field-wrapper [label]="('item.page.files' | translate)">
1313
<div *ngIf="bitstreams?.length > 0" class="file-section">
1414
<button class="btn btn-link" *ngFor="let file of bitstreams; let last=last;" (click)="downloadBitstreamFile(file?.uuid)">

src/app/shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview.component.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Input } from '@angular/core';
1+
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
22

33
import { Observable } from 'rxjs';
44
import { first } from 'rxjs/operators';
@@ -13,6 +13,7 @@ import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service
1313
import { SearchResult } from '../../../search/models/search-result.model';
1414
import { Context } from '../../../../core/shared/context.model';
1515
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
16+
import { hasValue } from '../../../empty.util';
1617

1718
/**
1819
* This component show metadata for the given item object in the detail view.
@@ -23,7 +24,7 @@ import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
2324
templateUrl: './item-detail-preview.component.html',
2425
animations: [fadeInOut]
2526
})
26-
export class ItemDetailPreviewComponent {
27+
export class ItemDetailPreviewComponent implements OnChanges {
2728
/**
2829
* The item to display
2930
*/
@@ -62,6 +63,12 @@ export class ItemDetailPreviewComponent {
6263
) {
6364
}
6465

66+
ngOnChanges(changes: SimpleChanges): void {
67+
if (hasValue(changes.item)) {
68+
this.bitstreams$ = this.getFiles();
69+
}
70+
}
71+
6572
/**
6673
* Perform bitstream download
6774
*/

0 commit comments

Comments
 (0)