From ee5df3bf8f02254f92f9540d389d2a9dd89d60e5 Mon Sep 17 00:00:00 2001 From: argirok Date: Tue, 5 Nov 2024 13:25:19 +0200 Subject: [PATCH] [angular-16-pid-resolver | DONE | CHANGED ] add pidMRPArser in properties, remove call from crossref service --- .../claimResultSearchForm.component.html | 2 +- .../claimResultSearchForm.component.ts | 17 ++++++++--------- .../service/searchCrossref.service.ts | 8 -------- utils/properties/env-properties.ts | 2 ++ 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/claims/claim-utils/claimResultSearchForm.component.html b/claims/claim-utils/claimResultSearchForm.component.html index 6c1e0ca2..736b0aaa 100644 --- a/claims/claim-utils/claimResultSearchForm.component.html +++ b/claims/claim-utils/claimResultSearchForm.component.html @@ -33,7 +33,7 @@
  • Orcid ({{(orcidResultsNum > 0) ? (orcidResultsNum | number) : 0}})
  • -
  • PID Resolver PID Resolver ({{(pidResolverResultsNum > 0) ? (pidResolverResultsNum | number) : 0}})
  • diff --git a/claims/claim-utils/claimResultSearchForm.component.ts b/claims/claim-utils/claimResultSearchForm.component.ts index ec0aaca6..5c6117fb 100644 --- a/claims/claim-utils/claimResultSearchForm.component.ts +++ b/claims/claim-utils/claimResultSearchForm.component.ts @@ -12,6 +12,9 @@ import {forkJoin, Observable, Subscriber} from 'rxjs'; import {NewSearchPageComponent} from "../../searchPages/searchUtils/newSearchPage.component"; import {RangeFilter} from "../../utils/rangeFilter/rangeFilterHelperClasses.class"; import {OpenaireEntities, SearchFields} from "../../utils/properties/searchFields"; +import {HttpClient} from "@angular/common/http"; +import {properties} from "../../../../environments/environment"; +import {map} from "rxjs/operators"; @Component({ selector: 'claim-result-search-form', templateUrl: 'claimResultSearchForm.component.html', @@ -118,7 +121,8 @@ export class ClaimResultSearchFormComponent { constructor(private _searchDataciteService: SearchDataciteService, private _searchCrossrefService: SearchCrossrefService, private _searchOrcidService: SearchOrcidService, - private _searchResearchResultsService: SearchResearchResultsService) { + private _searchResearchResultsService: SearchResearchResultsService, + private http: HttpClient ) { const myDate = new Date(); this.todayDate = myDate.getFullYear() + "-" + (myDate.getMonth() + 1) + "-" + myDate.getDate(); this.nextDate = (myDate.getFullYear() + 100) + "-" + (myDate.getMonth() + 1) + "-" + myDate.getDate(); @@ -294,17 +298,12 @@ export class ClaimResultSearchFormComponent { private getPidResolverResults(term: string, size: number, page: number) { this.pidResolverResultsStatus = this.errorCodes.LOADING; - - this.subscriptions.push(this._searchCrossrefService.getPidResolverResults(term).subscribe( + this.subscriptions.push(this.http.get(properties.pidResolverParserAPI + encodeURIComponent(term)).subscribe( data => { if (data != null) { - this.pidResolverResults = data; - - this.pidResolverResultsNum = data.length; + this.pidResolverResults = [data]; + this.pidResolverResultsNum = 1; this.pidResolverResultsStatus = this.errorCodes.DONE; - /*if (this.crossrefResultsNum == 0) { - this.crossrefStatus = this.errorCodes.NONE; - }*/ } else { this.pidResolverResultsStatus = this.errorCodes.ERROR; } diff --git a/claims/claim-utils/service/searchCrossref.service.ts b/claims/claim-utils/service/searchCrossref.service.ts index 8fb4169b..b7665e9e 100644 --- a/claims/claim-utils/service/searchCrossref.service.ts +++ b/claims/claim-utils/service/searchCrossref.service.ts @@ -12,14 +12,6 @@ export class SearchCrossrefService { constructor( private http: HttpClient ) {} - getPidResolverResults(pid): any { - let url = "http://scoobydoo.di.uoa.gr:4001/get/" + encodeURIComponent(pid); - - return this.http.get( url) - .pipe(map(res => [res])) - //.catch(this.handleError); - - } searchCrossrefResults(term: string, size: number, page: number, properties: EnvProperties, parse: boolean = false): any { let url = properties.searchCrossrefAPIURL + '?query=' + term + '&rows=' + size + '&offset=' + (size * (page - 1)); diff --git a/utils/properties/env-properties.ts b/utils/properties/env-properties.ts index daa1534d..57bc4f75 100644 --- a/utils/properties/env-properties.ts +++ b/utils/properties/env-properties.ts @@ -162,6 +162,8 @@ export interface EnvProperties { //connect dashboards forceCacheReload?:boolean; + + pidResolverParserAPI?:string; } export function checkPropertyValues(properties:EnvProperties){