From dce2d5c3a6063a63d161b50076517037da64edeb Mon Sep 17 00:00:00 2001 From: argirok Date: Fri, 22 Dec 2023 11:21:14 +0200 Subject: [PATCH] Menu item My research monitor: add services in constructor and build the static user menu even when there are 0 results for the researcher --- src/app/app.component.ts | 12 +++++++++--- src/app/app.module.ts | 4 +++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 5ce3320..9d36681 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -12,7 +12,9 @@ import {LayoutService} from "./openaireLibrary/dashboard/sharedComponents/sideba import {StakeholderUtils} from "./openaireLibrary/monitor-admin/utils/indicator-utils"; import {ResearcherBaseComponent} from "./shared/researcher-base.component"; import {UserProfileService} from "./openaireLibrary/services/userProfile.service"; -import {app} from "../../server"; +import {SearchOrcidService} from "./openaireLibrary/claims/claim-utils/service/searchOrcid.service"; +import {SearchResearchResultsService} from "./openaireLibrary/services/searchResearchResults.service"; +import {Identifier} from "./openaireLibrary/utils/string-utils.class"; @Component({ selector: 'app-root', @@ -79,7 +81,9 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit { private configurationService: ConfigurationService, private customFilterService: CustomFilterService, private userManagementService: UserManagementService, - private userProfileService:UserProfileService + private userProfileService:UserProfileService, + protected _searchOrcidService: SearchOrcidService, + protected _searchResearchResultsService: SearchResearchResultsService ) { super(); this.configurationService.initStaticPortal(this.irish.portal); @@ -141,12 +145,14 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit { this.userMenuItems = []; // this.user.orcid = '0000-0003-4768-182X'; if(this.user.orcid) { - this.authorId = this.user.orcid; + this.authorId = Identifier.getRawORCID(this.user.orcid); this.results = { success: (res: string | number) => { if(+res > 0) { this.userMenuItems.push(new MenuItem("my-researcher", "My Researcher Monitor", "", "/researcher/" + this.authorId, false, [], null, {}, null, null, null, null)); this.staticUserItems(); + }else{ + this.staticUserItems(); } } } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 783fd71..73bb9a0 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -18,6 +18,7 @@ import {SearchResearchResultsServiceModule} from "./openaireLibrary/services/sea import {SearchOrcidService} from "./openaireLibrary/claims/claim-utils/service/searchOrcid.service"; import {LoginGuard} from "./openaireLibrary/login/loginGuard.guard"; import {HasConsentGuard} from "./shared/hasConsent.guard"; +import {SearchOrcidServiceModule} from "./openaireLibrary/claims/claim-utils/service/searchOrcidService.module"; @NgModule({ declarations: [ @@ -34,7 +35,8 @@ import {HasConsentGuard} from "./shared/hasConsent.guard"; BottomModule, AppRoutingModule, CookieLawModule, - SearchResearchResultsServiceModule + SearchResearchResultsServiceModule, + SearchOrcidServiceModule ], providers: [ SearchOrcidService,