[Library|Trunk]

update indexInfo service to get last claim date
in landing use only the service response not the properties value 


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59367 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-09-14 15:48:43 +00:00
parent 4d48dad56e
commit 7c54692d2c
5 changed files with 3 additions and 13 deletions

View File

@ -156,8 +156,6 @@ export class DataProviderComponent {
this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => { this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
if (lastIndexUpdate) { if (lastIndexUpdate) {
this.indexUpdateDate = new Date(lastIndexUpdate); this.indexUpdateDate = new Date(lastIndexUpdate);
} else if (this.properties.lastIndexUpdate) {
this.indexUpdateDate = new Date(this.properties.lastIndexUpdate);
} }
}); });
} }

View File

@ -143,8 +143,6 @@ export class OrganizationComponent {
this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => { this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
if (lastIndexUpdate) { if (lastIndexUpdate) {
this.indexUpdateDate = new Date(lastIndexUpdate); this.indexUpdateDate = new Date(lastIndexUpdate);
} else if (this.properties.lastIndexUpdate) {
this.indexUpdateDate = new Date(this.properties.lastIndexUpdate);
} }
}); });
} }

View File

@ -156,8 +156,6 @@ export class ProjectComponent {
this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => { this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
if (lastIndexUpdate) { if (lastIndexUpdate) {
this.indexUpdateDate = new Date(lastIndexUpdate); this.indexUpdateDate = new Date(lastIndexUpdate);
} else if (this.properties.lastIndexUpdate) {
this.indexUpdateDate = new Date(this.properties.lastIndexUpdate);
} }
}); });
} }

View File

@ -124,8 +124,6 @@ export class ResultLandingComponent {
this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => { this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
if (lastIndexUpdate) { if (lastIndexUpdate) {
this.indexUpdateDate = new Date(lastIndexUpdate); this.indexUpdateDate = new Date(lastIndexUpdate);
} else if (this.properties.lastIndexUpdate) {
this.indexUpdateDate = new Date(this.properties.lastIndexUpdate);
} }
}); });
} }

View File

@ -2,7 +2,7 @@ import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http'; import {HttpClient} from '@angular/common/http';
import {EnvProperties} from './properties/env-properties'; import {EnvProperties} from './properties/env-properties';
import {Observable, of} from "rxjs"; import {Observable, of} from "rxjs";
import {catchError} from "rxjs/operators"; import {catchError, map} from "rxjs/operators";
@Injectable({ @Injectable({
@ -13,11 +13,9 @@ export class IndexInfoService {
constructor(private http: HttpClient) { constructor(private http: HttpClient) {
} }
// http://beta.services.openaire.eu/openaire/info/lastLoadDate
// the date when the mining results currently in the public index have been generated: http://beta.services.openaire.eu/openaire/info/lastMiningDate
getLastIndexDate(properties: EnvProperties): Observable<any> { getLastIndexDate(properties: EnvProperties): Observable<any> {
let url = properties.indexInfoAPI + "claim_load_date"; let url = properties.indexInfoAPI;
return this.http.get(url).pipe(catchError(err => {return of(null)})); return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url).pipe(map(res => res['claim_load_date'])).pipe(catchError(err => {return of(null)}));
} }
} }