mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 18:44:14 +00:00
Improved performance of mirador component by avoiding IIIF bundle bitstream lookup.
This commit is contained in:
@@ -10,6 +10,7 @@ import { Bitstream } from '../../../core/shared/bitstream.model';
|
|||||||
import { hasValue } from '../../../shared/empty.util';
|
import { hasValue } from '../../../shared/empty.util';
|
||||||
import { Observable } from 'rxjs/internal/Observable';
|
import { Observable } from 'rxjs/internal/Observable';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
import { of } from 'rxjs';
|
||||||
import { isPlatformBrowser } from '@angular/common';
|
import { isPlatformBrowser } from '@angular/common';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -75,6 +76,21 @@ export class MiradorViewerComponent implements OnInit {
|
|||||||
if (window.innerWidth > 768) {
|
if (window.innerWidth > 768) {
|
||||||
this.notMobile = true;
|
this.notMobile = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to set the multi property to true if the
|
||||||
|
// item is searchable or the IIIF bundle contains more
|
||||||
|
// than 3 bitstreams. The multi property controls the
|
||||||
|
// Mirador side navigation panel.
|
||||||
|
if (this.searchable) {
|
||||||
|
// If it's searchable set multi to true.
|
||||||
|
const observable = of({multi: true});
|
||||||
|
this.iframeViewerUrl = observable.pipe(
|
||||||
|
map((val) => {
|
||||||
|
this.multi = val.multi;
|
||||||
|
return this.setURL();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
} else {
|
||||||
this.iframeViewerUrl = this.bitstreamDataService
|
this.iframeViewerUrl = this.bitstreamDataService
|
||||||
.findAllByItemAndBundleName(this.item, 'IIIF', {})
|
.findAllByItemAndBundleName(this.item, 'IIIF', {})
|
||||||
.pipe(
|
.pipe(
|
||||||
@@ -83,8 +99,8 @@ export class MiradorViewerComponent implements OnInit {
|
|||||||
if (hasValue(bitstreamsRD.payload)) {
|
if (hasValue(bitstreamsRD.payload)) {
|
||||||
if (bitstreamsRD.payload.totalElements > 2) {
|
if (bitstreamsRD.payload.totalElements > 2) {
|
||||||
/* IIIF bundle contains multiple images and optionally a
|
/* IIIF bundle contains multiple images and optionally a
|
||||||
* a single json file, thus multi is true only when the count is 3 or more .
|
* a single json file, so multi is true only when the count
|
||||||
* multi=true enables the side navigation panel in Mirador. */
|
* is 3 or more. */
|
||||||
this.multi = true;
|
this.multi = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,3 +110,4 @@ export class MiradorViewerComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user