File tree Expand file tree Collapse file tree 2 files changed +45
-1
lines changed
src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector Expand file tree Collapse file tree 2 files changed +45
-1
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,11 @@ export function app() {
255255 */
256256 server . get ( '/app/client/health' , clientHealthCheck ) ;
257257
258+ /**
259+ * Redirecting old manifest
260+ */
261+ server . get ( '/json/iiif/**/manifest' , redirectManifest ) ;
262+
258263 /**
259264 * Default sending all incoming requests to ngApp() function, after first checking for a cached
260265 * copy of the page (see cacheCheck())
@@ -721,6 +726,39 @@ function healthCheck(req, res) {
721726 } ) ;
722727}
723728
729+ /*
730+ * The callback function to redirect old manifest
731+ */
732+ function redirectManifest ( req , res ) {
733+ console . info ( 'Redirecting old manifest' ) ;
734+ const url = req . url ;
735+ const regex = / j s o n \/ i i i f \/ ( [ ^ \/ ] + \/ [ ^ \/ ] + ) (?: \/ ( [ ^ \/ ] + ) ) ? \/ m a n i f e s t / ;
736+ const match = url . match ( regex ) ;
737+ let handle ;
738+ let id ;
739+
740+ if ( match ) {
741+ handle = match [ 1 ] ;
742+ const baseUrl = `${ environment . rest . baseUrl } /api/pid/find?id=${ handle } ` ;
743+ axios . get ( baseUrl )
744+ . then ( ( response ) => {
745+ if ( response . status === 200 ) {
746+ const newUrl = `${ environment . rest . baseUrl } /iiif/${ response . data . id } /manifest` ;
747+ console . info ( 'Manifest found, redirect to ' , newUrl ) ;
748+ res . redirect ( newUrl ) ;
749+ }
750+ } )
751+ . catch ( ( error ) => {
752+ res . status ( error . response . status ) . send ( {
753+ error : error . message
754+ } ) ;
755+ } ) ;
756+ } else {
757+ res . status ( 422 ) . send ( {
758+ error : 'Wrong handle'
759+ } ) ;
760+ }
761+ }
724762
725763// Webpack will replace 'require' with '__webpack_require__'
726764// '__non_webpack_require__' is a proxy to Node 'require'
Original file line number Diff line number Diff line change 11import {
22 Component ,
3+ EventEmitter ,
34 Input ,
5+ Output ,
46} from '@angular/core' ;
57import { ThemedComponent } from 'src/app/shared/theme-support/themed.component' ;
68
9+ import { DSpaceObject } from '../../../../core/shared/dspace-object.model' ;
710import { CreateItemParentSelectorComponent } from './create-item-parent-selector.component' ;
811
912/**
@@ -19,8 +22,11 @@ import { CreateItemParentSelectorComponent } from './create-item-parent-selector
1922export class ThemedCreateItemParentSelectorComponent
2023 extends ThemedComponent < CreateItemParentSelectorComponent > {
2124 @Input ( ) entityType : string ;
25+ @Input ( ) emitOnly : boolean ;
2226
23- protected inAndOutputNames : ( keyof CreateItemParentSelectorComponent & keyof this) [ ] = [ 'entityType' ] ;
27+ @Output ( ) select : EventEmitter < DSpaceObject > = new EventEmitter < DSpaceObject > ( ) ;
28+
29+ protected inAndOutputNames : ( keyof CreateItemParentSelectorComponent & keyof this) [ ] = [ 'entityType' , 'select' , 'emitOnly' ] ;
2430
2531 protected getComponentName ( ) : string {
2632 return 'CreateItemParentSelectorComponent' ;
You can’t perform that action at this time.
0 commit comments