Skip to content

Commit

Permalink
117287: Removed method calls returning observables from ItemDetailPre…
Browse files Browse the repository at this point in the history
…viewComponent
  • Loading branch information
alexandrevryghem committed Nov 28, 2024
1 parent 59e5f71 commit 5f26b95
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ds-metadata-field-wrapper [hideIfNoTextContent]="false">
<ds-themed-thumbnail [thumbnail]="item?.thumbnail | async"></ds-themed-thumbnail>
</ds-metadata-field-wrapper>
<ng-container *ngVar="(getFiles() | async) as bitstreams">
<ng-container *ngVar="(bitstreams$ | async) as bitstreams">
<ds-metadata-field-wrapper [label]="('item.page.files' | translate)">
<div *ngIf="bitstreams?.length > 0" class="file-section">
<button class="btn btn-link" *ngFor="let file of bitstreams; let last=last;" (click)="downloadBitstreamFile(file?.uuid)">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input } from '@angular/core';
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';

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

/**
* This component show metadata for the given item object in the detail view.
Expand All @@ -23,7 +24,7 @@ import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
templateUrl: './item-detail-preview.component.html',
animations: [fadeInOut]
})
export class ItemDetailPreviewComponent {
export class ItemDetailPreviewComponent implements OnChanges {
/**
* The item to display
*/
Expand Down Expand Up @@ -62,6 +63,12 @@ export class ItemDetailPreviewComponent {
) {
}

ngOnChanges(changes: SimpleChanges): void {
if (hasValue(changes.item)) {
this.bitstreams$ = this.getFiles();
}
}

/**
* Perform bitstream download
*/
Expand Down

0 comments on commit 5f26b95

Please sign in to comment.