Skip to content
Snippets Groups Projects
Commit 35256aed authored by Chris Beer's avatar Chris Beer
Browse files

Provide initial configuration for manifests to display in the load window area

parent 5deee933
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,23 @@
{
loadedManifest: 'https://iiif.bodleian.ox.ac.uk/iiif/manifest/e32a277e-91e2-4a6d-8ba6-cc4bad230410.json',
thumbnailNavigationPosition: 'off',
}]
}],
manifests: {
"http://media.nga.gov/public/manifests/nga_highlights.json": { provider: "National Gallery of Art"},
"https://data.ucd.ie/api/img/manifests/ucdlib:33064": { provider: "Irish Architectural Archive"},
"https://wellcomelibrary.org/iiif/b18035723/manifest": { provider: "Wellcome Library"},
"http://dams.llgc.org.uk/iiif/2.0/4389767/manifest.json": { provider: "The National Library of Wales"},
"https://demos.biblissima.fr/iiif/metadata/florus-dispersus/manifest.json": { provider: "Biblissima"},
"http://beta.biblissima.fr/iiif/manifest/ark:/43093/desc57cb76cd3739a24a9277b6669d95b5f3a590e771": { provider: "Biblissima"},
"https://www.e-codices.unifr.ch/metadata/iiif/gau-Fragment/manifest.json": { provider: "e-codices - Virtual Manuscript Library of Switzerland"},
"https://wellcomelibrary.org/iiif/collection/b18031511": { provider: "Wellcome Library"},
"https://gallica.bnf.fr/iiif/ark:/12148/btv1b10022508f/manifest.json": { provider: "Bibliothèque nationale de France"},
"https://manifests.britishart.yale.edu/Osbornfa1": { provider: "Beinecke Rare Book and Manuscript Library, Yale University"},
"https://iiif.biblissima.fr/chateauroux/B360446201_MS0005/manifest.json": { provider: "Biblissima"},
"https://iiif.durham.ac.uk/manifests/trifle/32150/t1/m4/q7/t1m4q77fr328/manifest": { provider: "Durham University Library"},
// "https://iiif.vam.ac.uk/collections/O1023003/manifest.json": { provider: "Ocean liners"},
"http://storiiies.cogapp.com/holbein/manifest.json": { provider: "National Gallery, London"}
}
});
</script>
</body>
......
......@@ -44,7 +44,8 @@ describe('MiradorViewer', () => {
it('transforms config values to actions to dispatch to store', () => {
instance = new MiradorViewer({
id: 'mirador',
windows: [{
windows: [
{
loadedManifest: 'https://iiif.harvardartmuseums.org/manifests/object/299843',
canvasIndex: 2,
},
......@@ -54,9 +55,12 @@ describe('MiradorViewer', () => {
view: 'book',
},
],
manifests: {
'http://media.nga.gov/public/manifests/nga_highlights.json': { provider: 'National Gallery of Art' },
},
});
const { windows } = instance.store.getState();
const { windows, manifests } = instance.store.getState();
const windowIds = Object.keys(windows);
expect(Object.keys(windowIds).length).toBe(2);
expect(windows[windowIds[0]].canvasIndex).toBe(2);
......@@ -65,6 +69,10 @@ describe('MiradorViewer', () => {
expect(windows[windowIds[1]].thumbnailNavigationPosition).toBe('off');
expect(windows[windowIds[0]].view).toBe('single');
expect(windows[windowIds[1]].view).toBe('book');
const manifestIds = Object.keys(manifests);
expect(Object.keys(manifestIds).length).toBe(2);
expect(manifests['http://media.nga.gov/public/manifests/nga_highlights.json'].provider).toBe('National Gallery of Art');
});
});
});
......@@ -63,6 +63,12 @@ class MiradorViewer {
thumbnailNavigationPosition,
}));
});
Object.keys(mergedConfig.manifests || {}).forEach((manifestId) => {
this.store.dispatch(
actions.fetchManifest(manifestId, mergedConfig.manifests[manifestId]),
);
});
}
/**
......
......@@ -7,10 +7,11 @@ import ActionTypes from './action-types';
* @param {String} manifestId
* @memberof ActionCreators
*/
export function requestManifest(manifestId) {
export function requestManifest(manifestId, properties) {
return {
type: ActionTypes.REQUEST_MANIFEST,
manifestId,
properties,
};
}
......@@ -50,9 +51,9 @@ export function receiveManifestFailure(manifestId, error) {
* @param {String} manifestId
* @memberof ActionCreators
*/
export function fetchManifest(manifestId) {
export function fetchManifest(manifestId, properties) {
return ((dispatch) => {
dispatch(requestManifest(manifestId));
dispatch(requestManifest(manifestId, properties));
return fetch(manifestId)
.then(response => response.json())
.then(json => dispatch(receiveManifest(manifestId, json)))
......
......@@ -10,6 +10,8 @@ export const manifestsReducer = (state = {}, action) => {
return {
...state,
[action.manifestId]: {
...state[action.manifestId],
...action.properties,
id: action.manifestId,
isFetching: true,
},
......@@ -18,6 +20,7 @@ export const manifestsReducer = (state = {}, action) => {
return {
...state,
[action.manifestId]: {
...state[action.manifestId],
id: action.manifestId,
manifestation: manifesto.create(action.manifestJson),
isFetching: false,
......@@ -27,6 +30,7 @@ export const manifestsReducer = (state = {}, action) => {
return {
...state,
[action.manifestId]: {
...state[action.manifestId],
id: action.manifestId,
error: action.error,
isFetching: false,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment