diff --git a/error-interceptor.service.ts b/error-interceptor.service.ts index f0891657..4f50184d 100644 --- a/error-interceptor.service.ts +++ b/error-interceptor.service.ts @@ -11,7 +11,7 @@ import {isArray} from "util"; @Injectable() export class ErrorInterceptorService implements HttpInterceptor { - private static UNAUTHORIZED_WHITELIST = [properties.userInfoUrl]; + private static UNAUTHORIZED_WHITELIST = [properties.userInfoUrl, properties.orcidAPIURL]; constructor(private router: Router) { } diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index 13400f5a..f206906d 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -100,6 +100,12 @@ Cite this {{getTypeName()}} + +
  • + + +
  • diff --git a/landingPages/result/resultLanding.module.ts b/landingPages/result/resultLanding.module.ts index 9faca221..901c02d8 100644 --- a/landingPages/result/resultLanding.module.ts +++ b/landingPages/result/resultLanding.module.ts @@ -28,13 +28,16 @@ import {ResultPreviewModule} from "../../utils/result-preview/result-preview.mod import {FeedbackModule} from "../feedback/feedback.module"; import {TabsModule} from "../../utils/tabs/tabs.module"; import {LoadingModule} from "../../utils/loading/loading.module"; +import {OrcidModule} from "../../orcid/orcid.module"; @NgModule({ imports: [ CommonModule, FormsModule, LandingModule, SharedModule, RouterModule, CiteThisModule, PagingModule, IFrameModule, MetricsModule, AltMetricsModule, Schema2jsonldModule, SEOServiceModule, - DeletedByInferenceModule, ShowAuthorsModule, HelperModule, ResultLandingUtilsModule, AlertModalModule, AnnotationModule, LandingHeaderModule, NoLoadPaging, ResultPreviewModule, FeedbackModule, TabsModule, LoadingModule + DeletedByInferenceModule, ShowAuthorsModule, HelperModule, ResultLandingUtilsModule, AlertModalModule, + AnnotationModule, LandingHeaderModule, NoLoadPaging, ResultPreviewModule, FeedbackModule, TabsModule, LoadingModule, + OrcidModule ], declarations: [ ResultLandingComponent diff --git a/searchPages/searchUtils/searchResult.component.ts b/searchPages/searchUtils/searchResult.component.ts index a2413f03..48a7ed22 100644 --- a/searchPages/searchUtils/searchResult.component.ts +++ b/searchPages/searchUtils/searchResult.component.ts @@ -3,6 +3,8 @@ import {SearchResult} from '../../utils/entities/searchResult'; import {EnvProperties} from '../../utils/properties/env-properties'; import {ResultPreview} from "../../utils/result-preview/result-preview"; import {HttpClient} from "@angular/common/http"; +import {OrcidService} from "../../orcid/orcid.service"; +import {Session} from "../../login/utils/helper.class"; @Component({ selector: 'search-result', @@ -20,7 +22,8 @@ export class SearchResultComponent implements OnInit, OnChanges { @Input() properties: EnvProperties; @Input() showImpactFactors: boolean = false; - constructor( private http: HttpClient/*ATHENA CODE*/) { + constructor( private http: HttpClient/*ATHENA CODE*/ + , private orcidService: OrcidService) { } ngOnInit() {} @@ -35,6 +38,31 @@ export class SearchResultComponent implements OnInit, OnChanges { for(let result of this.results){ this.previewResults.push(this.getResultPreview(result)); } + + if(this.properties.environment == 'development' && Session.isLoggedIn() && this.results && this.results.length > 0) { + this.orcidService.getPutCodes(this.previewResults.map( + previewResult => { + if(previewResult.identifiers) { + let pidsArray: string[] = []; + for(let key of Array.from(previewResult.identifiers.keys())) { + pidsArray = pidsArray.concat(previewResult.identifiers.get(key)); + } + return pidsArray;//.join(); + } + })).subscribe( + putCodes => { + for (let i = 0; i < this.previewResults.length; i++) { + if(this.previewResults[i].identifiers) { + this.previewResults[i].orcidPutCodes = putCodes[i]; + console.debug(i, this.previewResults[i].orcidPutCodes); + } + } + }, error => { + + } + ); + } + /////////////////////// ATHENA CODE /////////////////////// // console.log(data[1]); let dois = encodeURIComponent(this.results.map((result) => result.DOIs).join(",")); diff --git a/searchPages/searchUtils/searchResults.module.ts b/searchPages/searchUtils/searchResults.module.ts index 94ce2e92..6ab0eeef 100644 --- a/searchPages/searchUtils/searchResults.module.ts +++ b/searchPages/searchUtils/searchResults.module.ts @@ -9,6 +9,7 @@ import {ApprovedByCommunityModule} from '../../connect/approvedByCommunity/appro import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module"; import {HighlightModule} from "./highlight/highlight.module"; import {ResultPreviewModule} from "../../utils/result-preview/result-preview.module"; +import {OrcidService} from "../../orcid/orcid.service"; @NgModule({ imports: [ @@ -21,6 +22,7 @@ import {ResultPreviewModule} from "../../utils/result-preview/result-preview.mod SearchResultComponent ], providers:[ + OrcidService ], exports: [ SearchResultComponent diff --git a/services/servicesUtils/customOptions.class.ts b/services/servicesUtils/customOptions.class.ts index 3c6934f7..a7e55ead 100644 --- a/services/servicesUtils/customOptions.class.ts +++ b/services/servicesUtils/customOptions.class.ts @@ -4,7 +4,7 @@ import {HttpHeaders} from "@angular/common/http"; export class CustomOptions { - public static registryOptions(): any { + public static registryOptions(): {} { return { headers: new HttpHeaders({ 'Content-Type': 'application/json', diff --git a/utils/entities/searchResult.ts b/utils/entities/searchResult.ts index ba2432ec..60db7563 100644 --- a/utils/entities/searchResult.ts +++ b/utils/entities/searchResult.ts @@ -4,6 +4,7 @@ export class SearchResult { title: ResultTitle; id: string; DOIs: string[]=[]; + identifiers: Map; //publications & datasets & orp & software & projects & dataproviders: description: string; @@ -30,6 +31,7 @@ export class SearchResult { //projects: acronym: string; code: string; + // callIdentifier?: string; // currently not parsed funderShortname: string; budget?: string; contribution?: string; diff --git a/utils/properties/env-properties.ts b/utils/properties/env-properties.ts index 5edfab7a..57f9ae36 100644 --- a/utils/properties/env-properties.ts +++ b/utils/properties/env-properties.ts @@ -30,6 +30,7 @@ export interface EnvProperties { searchDataciteAPIURL?: string; searchOrcidURL?: string; orcidURL?: string; + orcidAPIURL?: string; doiURL?: string; pmcURL?: string; pmidURL?: string; diff --git a/utils/result-preview/result-preview.component.html b/utils/result-preview/result-preview.component.html index fa2f623b..03101963 100644 --- a/utils/result-preview/result-preview.component.html +++ b/utils/result-preview/result-preview.component.html @@ -262,9 +262,11 @@ -
    + - + View more details
    + + + + + diff --git a/utils/result-preview/result-preview.component.ts b/utils/result-preview/result-preview.component.ts index a015affc..e7e60bc0 100644 --- a/utils/result-preview/result-preview.component.ts +++ b/utils/result-preview/result-preview.component.ts @@ -4,6 +4,7 @@ import {EnvProperties} from "../properties/env-properties"; import {RouterHelper} from "../routerHelper.class"; import {AlertModal} from "../modal/alert"; import {properties} from "../../../../environments/environment"; +import {Session} from "../../login/utils/helper.class"; @Component({ selector: 'result-preview', @@ -22,8 +23,12 @@ export class ResultPreviewComponent implements OnInit{ public type: string; public beforeTitle: string[] = []; public dataProviderUrl = properties.searchLinkToDataProvider.split('?')[0]; - + public loggedIn: boolean = false; + ngOnInit(): void { + if (Session.isLoggedIn()) { + this.loggedIn = true; + } if (this.result.resultType === "publication") { this.urlParam = "articleId"; this.url = properties.searchLinkToPublication.split('?')[0]; diff --git a/utils/result-preview/result-preview.module.ts b/utils/result-preview/result-preview.module.ts index a772d949..62101edc 100644 --- a/utils/result-preview/result-preview.module.ts +++ b/utils/result-preview/result-preview.module.ts @@ -4,9 +4,10 @@ import {ResultPreviewComponent} from "./result-preview.component"; import {RouterModule} from "@angular/router"; import {ShowAuthorsModule} from "../authors/showAuthors.module"; import {ResultLandingUtilsModule} from "../../landingPages/landing-utils/resultLandingUtils.module"; +import {OrcidModule} from "../../orcid/orcid.module"; @NgModule({ - imports: [CommonModule, RouterModule, ShowAuthorsModule, ResultLandingUtilsModule], + imports: [CommonModule, RouterModule, ShowAuthorsModule, ResultLandingUtilsModule, OrcidModule], declarations: [ResultPreviewComponent], exports: [ResultPreviewComponent] }) diff --git a/utils/result-preview/result-preview.ts b/utils/result-preview/result-preview.ts index 267450f8..f4a5e505 100644 --- a/utils/result-preview/result-preview.ts +++ b/utils/result-preview/result-preview.ts @@ -90,6 +90,7 @@ export class ResultPreview { languages: string[]; identifiers: Map; //key is the classname hostedBy_collectedFrom: HostedByCollectedFrom[]; + orcidPutCodes: string[]; //datasets & orp & software: publisher: string; @@ -178,10 +179,11 @@ export class ResultPreview { resultPreview.subjects = result.subjects; resultPreview.resultType = type; //impact factor; - if(result.DOIs && result.DOIs.length > 0) { - resultPreview.identifiers = new Map(); - resultPreview.identifiers.set("doi", result.DOIs); - } + // if(result.DOIs && result.DOIs.length > 0) { + // resultPreview.identifiers = new Map(); + // resultPreview.identifiers.set("doi", result.DOIs); + // } + resultPreview.identifiers = result.identifiers; return resultPreview; }