File tree Expand file tree Collapse file tree
shared/metadata-link-view Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,10 +75,11 @@ export const itemPageResolver: ResolveFn<RemoteData<Item>> = (
7575 map ( ( rd : RemoteData < Item > ) => {
7676 store . dispatch ( new ResolvedAction ( state . url , rd . payload ) ) ;
7777 if ( rd . hasSucceeded && hasValue ( rd . payload ) ) {
78+ const itemRoute = router . parseUrl ( getItemPageRoute ( rd . payload ) ) . toString ( ) ;
7879 // Check if custom url not empty and if the current id parameter is different from the custom url redirect to custom url
7980 if ( hasValue ( rd . payload . metadata ) && isNotEmpty ( rd . payload . metadata [ 'cris.customurl' ] ) ) {
8081 if ( route . params . id !== rd . payload . metadata [ 'cris.customurl' ] [ 0 ] . value ) {
81- const newUrl = state . url . replace ( route . params . id , rd . payload . metadata [ 'cris.customurl' ] [ 0 ] . value ) ;
82+ const newUrl = itemRoute . replace ( route . params . id , rd . payload . metadata [ 'cris.customurl' ] [ 0 ] . value ) ;
8283 router . navigateByUrl ( newUrl ) ;
8384 }
8485 } else {
@@ -88,7 +89,6 @@ export const itemPageResolver: ResolveFn<RemoteData<Item>> = (
8889 // or semicolons) and thisRoute has been encoded with that function. If we want to compare
8990 // it with itemRoute, we have to run itemRoute through Angular's version as well to ensure
9091 // the same characters are encoded the same way.
91- const itemRoute = router . parseUrl ( getItemPageRoute ( rd . payload ) ) . toString ( ) ;
9292
9393 if ( ! thisRoute . startsWith ( itemRoute ) ) {
9494 const itemId = rd . payload . uuid ;
Original file line number Diff line number Diff line change 1010 container ="body "
1111 triggers ="mouseenter ">
1212 < a rel ="noopener noreferrer " data-test ="linkToAuthority "
13- [routerLink] ="['/items/' + metadataView.authority ] ">
13+ [routerLink] ="[relatedDsoRoute ] ">
1414 < span dsEntityIcon
1515 [iconPosition] ="iconPosition "
1616 [entityType] ="metadataView.entityType "
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import {
2222 switchMap ,
2323 take ,
2424} from 'rxjs/operators' ;
25+ import { getItemPageRoute } from 'src/app/item-page/item-page-routing-paths' ;
2526
2627import { environment } from '../../../environments/environment' ;
2728import { ItemDataService } from '../../core/data/item-data.service' ;
@@ -97,6 +98,11 @@ export class MetadataLinkViewComponent implements OnInit {
9798 */
9899 relatedItem : Item ;
99100
101+ /**
102+ * Route of related item page
103+ */
104+ relatedDsoRoute : string ;
105+
100106 /**
101107 * Map all entities with the icons specified in the environment configuration file
102108 */
@@ -149,6 +155,7 @@ export class MetadataLinkViewComponent implements OnInit {
149155 private createMetadataView ( itemRD : RemoteData < Item > , metadataValue : MetadataValue ) : MetadataView {
150156 if ( itemRD . hasSucceeded ) {
151157 this . relatedItem = itemRD . payload ;
158+ this . relatedDsoRoute = this . getItemPageRoute ( this . relatedItem ) ;
152159 const entityStyleValue = this . getCrisRefMetadata ( itemRD . payload ?. entityType ) ;
153160 return {
154161 authority : metadataValue . authority ,
@@ -207,4 +214,8 @@ export class MetadataLinkViewComponent implements OnInit {
207214 return metadata ?? this . crisRefMetadata ?. default ;
208215 }
209216
217+ getItemPageRoute ( item : Item ) : string {
218+ return getItemPageRoute ( item ) ;
219+ }
220+
210221}
You can’t perform that action at this time.
0 commit comments