117287: Removed method calls returning observables from ItemDetailPreviewComponent

This commit is contained in:
Alexandre Vryghem
2024-11-28 22:39:08 +01:00
parent 59e5f71a73
commit 8849f140fb
2 changed files with 10 additions and 3 deletions

View File

@@ -8,7 +8,7 @@
<ds-metadata-field-wrapper [hideIfNoTextContent]="false"> <ds-metadata-field-wrapper [hideIfNoTextContent]="false">
<ds-themed-thumbnail [thumbnail]="item?.thumbnail | async"></ds-themed-thumbnail> <ds-themed-thumbnail [thumbnail]="item?.thumbnail | async"></ds-themed-thumbnail>
</ds-metadata-field-wrapper> </ds-metadata-field-wrapper>
<ng-container *ngVar="(getFiles() | async) as bitstreams"> <ng-container *ngIf="(bitstreams$ | async) as bitstreams">
<ds-metadata-field-wrapper [label]="('item.page.files' | translate)"> <ds-metadata-field-wrapper [label]="('item.page.files' | translate)">
<div *ngIf="bitstreams?.length > 0" class="file-section"> <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)"> <button class="btn btn-link" *ngFor="let file of bitstreams; let last=last;" (click)="downloadBitstreamFile(file?.uuid)">

View File

@@ -1,4 +1,4 @@
import { Component, Input } from '@angular/core'; import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { first } from 'rxjs/operators'; import { first } from 'rxjs/operators';
@@ -13,6 +13,7 @@ import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service
import { SearchResult } from '../../../search/models/search-result.model'; import { SearchResult } from '../../../search/models/search-result.model';
import { Context } from '../../../../core/shared/context.model'; import { Context } from '../../../../core/shared/context.model';
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service'; 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. * 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';
templateUrl: './item-detail-preview.component.html', templateUrl: './item-detail-preview.component.html',
animations: [fadeInOut] animations: [fadeInOut]
}) })
export class ItemDetailPreviewComponent { export class ItemDetailPreviewComponent implements OnChanges {
/** /**
* The item to display * The item to display
*/ */
@@ -62,6 +63,12 @@ export class ItemDetailPreviewComponent {
) { ) {
} }
ngOnChanges(changes: SimpleChanges): void {
if (hasValue(changes.item)) {
this.bitstreams$ = this.getFiles();
}
}
/** /**
* Perform bitstream download * Perform bitstream download
*/ */