From 64595c73825bbe4b3f66152f9d1def80f20e609c Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 13 May 2021 15:48:01 +0000 Subject: [PATCH] [Trunk | Library]: 1. result-preview.ts: In Project interface, added optional boolean field "validated" (parsed in landing pages to show validated projects by funders). 2. parsingFunctions.class.ts: In method "parseFundingByProjects()" added parsing for "validated" field. 3. fundedBy.component.ts: ticket #6228 - Show "Validated by funder" message if "validate" field is true. 4. dataProvider.component.ts: [Bug fix] In method "getDataProviderAggregationStatus()" set "aggregationStatusIsInitialized" to true on success and on error (not on complete, because after error it never completes and keeps on loading). 5. orcid.component.ts: [Bug fix] a. In method "getToken()" set "showLoading" to false on success and on error (after error there is no complete). b. In method "getPersonalDetails()" move "setTimeout" from complete to error. 6. showPublisher.component.ts: [Bug fix] Add "UTC" in pipe when showing published date ({{publishDate | date: 'dd MMM yyyy' : 'UTC'}}). 7. timeout-interceptor.service.ts: Timeout only GET requests. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@61003 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../dataProvider/dataProvider.component.ts | 5 ++--- .../landing-utils/fundedBy.component.ts | 6 ++++-- .../landing-utils/parsingFunctions.class.ts | 7 +++++-- .../landing-utils/showPublisher.component.ts | 2 +- orcid/orcid.component.ts | 20 +++++++++---------- timeout-interceptor.service.ts | 4 ++++ utils/result-preview/result-preview.ts | 1 + 7 files changed, 26 insertions(+), 19 deletions(-) diff --git a/landingPages/dataProvider/dataProvider.component.ts b/landingPages/dataProvider/dataProvider.component.ts index a2f370ae..8a6ec709 100644 --- a/landingPages/dataProvider/dataProvider.component.ts +++ b/landingPages/dataProvider/dataProvider.component.ts @@ -271,13 +271,12 @@ export class DataProviderComponent { this.subscriptions.push(this._dataproviderService.getDataproviderAggregationStatus(originalId, this.properties).subscribe( data => { this.dataProviderInfo.aggregationStatus = data; + this.aggregationStatusIsInitialized = true; }, err => { //console.log(err); - this.handleError("Error getting content provider aggregation status for id: " + this.datasourceId, err); - }, - () => { this.aggregationStatusIsInitialized = true; + this.handleError("Error getting content provider aggregation status for id: " + this.datasourceId, err); } )); } diff --git a/landingPages/landing-utils/fundedBy.component.ts b/landingPages/landing-utils/fundedBy.component.ts index 79f4dcb5..c1778bfd 100644 --- a/landingPages/landing-utils/fundedBy.component.ts +++ b/landingPages/landing-utils/fundedBy.component.ts @@ -47,8 +47,10 @@ import {properties} from "../../../../environments/environment"; Funding stream: {{item.funding}} -
- {{item.provenanceAction}} +
+ Validated by funder + | + {{item.provenanceAction}}
, diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index e01ad75c..fb3816a0 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -21,7 +21,7 @@ export class ParsingFunctions { let fundedByProject: Project = { "id": "", "acronym": "", "title": "", "funderShortname": "", "funderName": "", - "funding": "", "code": "", "provenanceAction": "" + "funding": "", "code": "", "provenanceAction": "", "validated": false }; if (relation.title != 'unidentified') { @@ -29,7 +29,10 @@ export class ParsingFunctions { fundedByProject['acronym'] = relation.acronym; fundedByProject['title'] = relation.title; fundedByProject['code'] = relation.code; - + if(relation.validated && relation.validated.date) { + fundedByProject['validated'] = true; + } + if (provenanceActionVocabulary != null && relation.provenanceaction in provenanceActionVocabulary) { fundedByProject['provenanceAction'] = provenanceActionVocabulary[relation.provenanceaction]; } diff --git a/landingPages/landing-utils/showPublisher.component.ts b/landingPages/landing-utils/showPublisher.component.ts index 72f67709..97f41fea 100644 --- a/landingPages/landing-utils/showPublisher.component.ts +++ b/landingPages/landing-utils/showPublisher.component.ts @@ -8,7 +8,7 @@ import {EnvProperties} from "../../utils/properties/env-properties"; || journal['volume'] || journal['eissn'] || journal['issue'])"> Published: - {{publishDate | date: 'dd MMM yyyy'}} + {{publishDate | date: 'dd MMM yyyy' : 'UTC'}} diff --git a/orcid/orcid.component.ts b/orcid/orcid.component.ts index bc064513..c5bc05fb 100644 --- a/orcid/orcid.component.ts +++ b/orcid/orcid.component.ts @@ -105,15 +105,15 @@ export class OrcidComponent { } // this.message = "Thank you for connecting your ORCID iD with OpenAIRE! Please close this window and continue!"; } + this.showLoading = false; }, error => { + this.showLoading = false; + this.gotToken = true; console.error("Error getting token from code: "+code, error); this.message = "An error occured while trying to connect your ORCID iD with OpenAIRE. Please try again!"; - }, - () => { - this.showLoading = false; } ) } @@ -147,17 +147,15 @@ export class OrcidComponent { } else { this._router.navigate([properties.searchLinkToAdvancedResults], {}); } + }, + error => { + setTimeout(() => { + this.message += "
If you are not authomatically redirected, please navigate to our search pages.
"; + }, 3000); })); } else { this.getToken(this.code); } - }, - () => { - if(this.gotToken) { - setTimeout(() => { - this.message += "
If you are not authomatically redirected, please navigate to our search pages.
"; - }, 3000); - } } )); } @@ -175,4 +173,4 @@ export class OrcidComponent { private updateUrl(url: string) { this._meta.updateTag({content: url}, "property='og:url'"); } -} \ No newline at end of file +} diff --git a/timeout-interceptor.service.ts b/timeout-interceptor.service.ts index 0ab5e486..0150af9e 100644 --- a/timeout-interceptor.service.ts +++ b/timeout-interceptor.service.ts @@ -11,6 +11,10 @@ export class TimeoutInterceptor implements HttpInterceptor { } intercept(req: HttpRequest, next: HttpHandler): Observable> { + if (req.method !== 'GET') { + return next.handle(req); + } + const timeoutValue = req.headers.get('timeout') || this.defaultTimeout; const timeoutValueNumeric = Number(timeoutValue); diff --git a/utils/result-preview/result-preview.ts b/utils/result-preview/result-preview.ts index f1bc0253..a4c2b54b 100644 --- a/utils/result-preview/result-preview.ts +++ b/utils/result-preview/result-preview.ts @@ -42,6 +42,7 @@ export interface Project { funderName: string; funding?: string; code: string; + validated?: boolean; budget?: string; contribution?: string; currency?: string;