mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
#885 fix loading bitstream format
This commit is contained in:
@@ -46,7 +46,9 @@ export class MediaViewerImageComponent implements OnInit {
|
||||
small: image.thumbnail
|
||||
? image.thumbnail
|
||||
: './assets/images/replacement_image.svg',
|
||||
medium: image.bitstream._links.content.href,
|
||||
medium: image.thumbnail
|
||||
? image.thumbnail
|
||||
: './assets/images/replacement_image.svg',
|
||||
big: image.bitstream._links.content.href,
|
||||
});
|
||||
}
|
||||
|
@@ -0,0 +1,4 @@
|
||||
.media-viewer{
|
||||
width: 340px;
|
||||
height: 279px;
|
||||
}
|
||||
|
@@ -15,8 +15,6 @@ import { MediaViewerItem } from '../../core/shared/media-viewer-item.model';
|
||||
import { VarDirective } from '../../shared/utils/var.directive';
|
||||
import { MetadataFieldWrapperComponent } from '../field-components/metadata-field-wrapper/metadata-field-wrapper.component';
|
||||
import { FileSizePipe } from '../../shared/utils/file-size-pipe';
|
||||
import { BitstreamFormat } from '../../core/shared/bitstream-format.model';
|
||||
import { BitstreamFormatDataService } from '../../core/data/bitstream-format-data.service';
|
||||
|
||||
describe('MediaViewerComponent', () => {
|
||||
let comp: MediaViewerComponent;
|
||||
@@ -57,13 +55,6 @@ describe('MediaViewerComponent', () => {
|
||||
),
|
||||
});
|
||||
|
||||
const bitstreamFormatDataService = jasmine.createSpyObj(
|
||||
'bitstreamFormatDataService',
|
||||
{
|
||||
findByBitstream: createSuccessfulRemoteDataObject$(new BitstreamFormat()),
|
||||
}
|
||||
);
|
||||
|
||||
const mockMediaViewerItem: MediaViewerItem = Object.assign(
|
||||
new MediaViewerItem(),
|
||||
{ bitstream: mockBitstream, format: 'image', thumbnail: null }
|
||||
@@ -88,10 +79,6 @@ describe('MediaViewerComponent', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: BitstreamDataService, useValue: bitstreamDataService },
|
||||
{
|
||||
provide: BitstreamFormatDataService,
|
||||
useValue: bitstreamFormatDataService,
|
||||
},
|
||||
],
|
||||
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
|
@@ -2,7 +2,6 @@ import { Component, Input, OnInit } from '@angular/core';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { filter, take } from 'rxjs/operators';
|
||||
import { BitstreamDataService } from '../../core/data/bitstream-data.service';
|
||||
import { BitstreamFormatDataService } from '../../core/data/bitstream-format-data.service';
|
||||
import { PaginatedList } from '../../core/data/paginated-list';
|
||||
import { RemoteData } from '../../core/data/remote-data';
|
||||
import { BitstreamFormat } from '../../core/shared/bitstream-format.model';
|
||||
@@ -11,6 +10,7 @@ import { Item } from '../../core/shared/item.model';
|
||||
import { MediaViewerItem } from '../../core/shared/media-viewer-item.model';
|
||||
import { getFirstSucceededRemoteDataPayload } from '../../core/shared/operators';
|
||||
import { hasValue } from '../../shared/empty.util';
|
||||
import { followLink } from '../../shared/utils/follow-link-config.model';
|
||||
|
||||
/**
|
||||
* This componenet renders the media viewers
|
||||
@@ -32,7 +32,6 @@ export class MediaViewerComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
protected bitstreamDataService: BitstreamDataService,
|
||||
protected bitstreamFormatDataService: BitstreamFormatDataService
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -44,8 +43,7 @@ export class MediaViewerComponent implements OnInit {
|
||||
this.loadRemoteData('ORIGINAL').subscribe((bitstreamsRD) => {
|
||||
this.loadRemoteData('THUMBNAIL').subscribe((thumbnailsRD) => {
|
||||
for (let index = 0; index < bitstreamsRD.payload.page.length; index++) {
|
||||
this.bitstreamFormatDataService
|
||||
.findByBitstream(bitstreamsRD.payload.page[index])
|
||||
bitstreamsRD.payload.page[index].format
|
||||
.pipe(getFirstSucceededRemoteDataPayload())
|
||||
.subscribe((format) => {
|
||||
const current = this.mediaList$.getValue();
|
||||
@@ -70,7 +68,7 @@ export class MediaViewerComponent implements OnInit {
|
||||
bundleName: string
|
||||
): Observable<RemoteData<PaginatedList<Bitstream>>> {
|
||||
return this.bitstreamDataService
|
||||
.findAllByItemAndBundleName(this.item, bundleName)
|
||||
.findAllByItemAndBundleName(this.item, bundleName, {}, followLink('format'))
|
||||
.pipe(
|
||||
filter(
|
||||
(bitstreamsRD: RemoteData<PaginatedList<Bitstream>>) =>
|
||||
|
Reference in New Issue
Block a user