From 69550193c3ec837096c573f6f8bbcf632b42f452 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 18 Apr 2024 12:02:41 +0300 Subject: [PATCH] [master]: Fix links to search pages --- src/app/repository/repository.component.ts | 1 + src/app/researcher/researcher.component.ts | 3 +-- src/app/rfo/rfo.component.ts | 1 + src/app/rpo/rpo.component.ts | 1 + src/app/search/links-resolver.ts | 12 +++--------- src/app/shared/irish.ts | 2 +- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/app/repository/repository.component.ts b/src/app/repository/repository.component.ts index b78483f..e97da93 100644 --- a/src/app/repository/repository.component.ts +++ b/src/app/repository/repository.component.ts @@ -218,5 +218,6 @@ export class RepositoryComponent extends StakeholderBaseComponent implements OnI super.ngOnDestroy(); this.layoutService.setRootClass(null); this.setProperties(Irish.irishAdminToolsCommunity, Irish.irishAdminToolsPortalType, this.configurationService); + LinksResolver.resetProperties(); } } diff --git a/src/app/researcher/researcher.component.ts b/src/app/researcher/researcher.component.ts index 315d11f..728e372 100644 --- a/src/app/researcher/researcher.component.ts +++ b/src/app/researcher/researcher.component.ts @@ -133,8 +133,6 @@ export class ResearcherComponent extends ResearcherBaseComponent implements OnI LinksResolver.resetProperties(); LinksResolver.setSearchAndResultLanding("researcher/" + this.authorId); this.setMetadata(); - - }, error: () => { this._router.navigate([properties.errorLink]); @@ -178,6 +176,7 @@ export class ResearcherComponent extends ResearcherBaseComponent implements OnI ngOnDestroy() { super.ngOnDestroy(); this.layoutService.setRootClass(null); + LinksResolver.resetProperties(); } getPercentage(){ diff --git a/src/app/rfo/rfo.component.ts b/src/app/rfo/rfo.component.ts index b0a1b12..5da1c71 100644 --- a/src/app/rfo/rfo.component.ts +++ b/src/app/rfo/rfo.component.ts @@ -146,6 +146,7 @@ export class RfoComponent extends StakeholderBaseComponent implements OnInit { super.ngOnDestroy(); this.layoutService.setRootClass(null); this.setProperties(Irish.irishAdminToolsCommunity, Irish.irishAdminToolsPortalType, this.configurationService); + LinksResolver.resetProperties(); } get isManager() { diff --git a/src/app/rpo/rpo.component.ts b/src/app/rpo/rpo.component.ts index 9d81af3..2266a0e 100644 --- a/src/app/rpo/rpo.component.ts +++ b/src/app/rpo/rpo.component.ts @@ -147,6 +147,7 @@ export class RpoComponent extends StakeholderBaseComponent implements OnInit { super.ngOnDestroy(); this.layoutService.setRootClass(null); this.setProperties(Irish.irishAdminToolsCommunity, Irish.irishAdminToolsPortalType, this.configurationService); + LinksResolver.resetProperties(); } get isManager() { diff --git a/src/app/search/links-resolver.ts b/src/app/search/links-resolver.ts index 67298a8..3c7b5c7 100644 --- a/src/app/search/links-resolver.ts +++ b/src/app/search/links-resolver.ts @@ -58,17 +58,12 @@ export class LinksResolver { errorLink: properties.errorLink }; - public static setDefaultProperties(alias: string) { - Object.keys(this.default).forEach(field => { - this.default[field] = "/" + alias + (this.default[field]); - }); - } - public static setProperties(alias: string) { Object.keys(this.default).forEach(field => { properties[field] = "/" + alias + (this.default[field]); }); } + public static setSearchAndResultLanding(alias: string) { properties.searchLinkToResult= "/" + alias + this.default.searchLinkToResult; properties.searchLinkToPublication= "/" + alias + this.default.searchLinkToPublication; @@ -82,9 +77,8 @@ export class LinksResolver { properties.searchLinkToAdvancedOrps= "/" + alias + this.default.searchLinkToAdvancedOrps; } + public static resetProperties() { - Object.keys(this.default).forEach(field => { - properties[field] = this.default[field]; - }); + this.setProperties('national/'); } } diff --git a/src/app/shared/irish.ts b/src/app/shared/irish.ts index 3888967..51e8c4f 100644 --- a/src/app/shared/irish.ts +++ b/src/app/shared/irish.ts @@ -13,7 +13,7 @@ export class Irish { public portal: Portal = Portal.getMockCommunityInfo("noami", "Noami",['service'],['/search/advanced/services', '/search/find/services']); constructor() { - LinksResolver.setDefaultProperties('national/'); + LinksResolver.resetProperties(); StakeholderConfiguration.ROLES.manager = 'primary dashboard manager'; StakeholderConfiguration.ROLES.member = 'manager';