Menu item My research monitor: add services in constructor and build the static user menu even when there are 0 results for the researcher

This commit is contained in:
argirok 2023-12-22 11:21:14 +02:00
parent 614445441a
commit dce2d5c3a6
2 changed files with 12 additions and 4 deletions

View File

@ -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();
}
}
}

View File

@ -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,