1. "fundedContent" and "indexRecords" information added in dataprovider landing page (collected from datasource api).

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51973 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2018-05-08 15:20:51 +00:00
parent 82868c0b1d
commit fb7532d5da
4 changed files with 46 additions and 3 deletions

View File

@ -26,8 +26,12 @@
<span *ngIf="dataProviderInfo.compatibility" class="uk-label custom-label label-compatibility " title="Compatibility">{{dataProviderInfo.compatibility}}</span>
<ul class="uk-list">
<li *ngIf="dataProviderInfo.aggregationStatus && dataProviderInfo.aggregationStatus.fundedContent != -1"><span class="uk-text-bold">Number of results with funding information: </span>
{{dataProviderInfo.aggregationStatus.fundedContent | number}}
</li>
<li *ngIf="dataProviderInfo.aggregationStatus && dataProviderInfo.aggregationStatus.indexRecords != -1"><span class="uk-text-bold">Number of collected full-texts: </span>
{{dataProviderInfo.aggregationStatus.indexRecords | number}}
</li>
<li *ngIf="dataProviderInfo.oaiPmhURL"><span class="uk-text-bold">OAI-PMH: </span>
<span class="uk-button-text">
<a target="_blank" href="{{dataProviderInfo.oaiPmhURL}}">

View File

@ -165,6 +165,9 @@ export class DataProviderComponent {
this.subInfo = this._dataproviderService.getDataproviderInfo(this.datasourceId, this.properties).subscribe(
data => {
this.dataProviderInfo = data;
this.getDataProviderAggregationStatus(this.dataProviderInfo.originalId);
this.initTabs();
this.showTabs = true ;
this.updateTitle(this.dataProviderInfo.title.name);
@ -189,6 +192,17 @@ export class DataProviderComponent {
}
}
private getDataProviderAggregationStatus(originalId: string) {
this.subInfo = this._dataproviderService.getDataproviderAggregationStatus(originalId, this.properties).subscribe(
data => {
this.dataProviderInfo.aggregationStatus = data;
},
err => {
console.log(err);
}
);
}
private updateDescription(description:string) {
this._meta.updateTag({content:description},"name='description'");
this._meta.updateTag({content:description},"property='og:description'");

View File

@ -1,5 +1,5 @@
import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Http, Response,Headers, RequestOptions} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import {DataProviderInfo} from '../../utils/entities/dataProviderInfo';
import 'rxjs/add/observable/of';
@ -33,6 +33,16 @@ export class DataProviderService {
}
getDataproviderAggregationStatus(original_id: string, properties:EnvProperties):any {
let headers = new Headers({'Content-Type': 'application/json', 'accept': 'application/json'});
let options = new RequestOptions({headers: headers});
return this.http.post("http://beta.services.openaire.eu:8080/openaire/ds/search/0/1?requestSortBy=id&order=ASCENDING", JSON.stringify({ "id": original_id }), options)
.map(res => <any> res.json())
.map(res => res['datasourceInfo'])
.map(res => this.parseDataproviderAggregationStatus(res));
}
private handleError (error: Response) {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
@ -40,6 +50,16 @@ export class DataProviderService {
return Observable.throw(error || 'Server error');
}
parseDataproviderAggregationStatus(data: any): any {
var aggregationStatus: {"fundedContent": string, "indexRecords": string} = null;
if(data != null && data[0] != null) {
aggregationStatus = {"fundedContent": "-1", "indexRecords": "-1"};
aggregationStatus.fundedContent = data[0].fundedContent;
aggregationStatus.indexRecords = data[0].indexRecords;
}
return aggregationStatus;
}
parseDataProviderInfo (data: any):any {
this.dataProviderInfo = new DataProviderInfo();
@ -54,6 +74,7 @@ export class DataProviderService {
}else if (originalId.indexOf("re3data_____::") != -1){
this.dataProviderInfo.r3DataURL = "http://service.re3data.org/repository/"+originalId.split("re3data_____::")[1];
}
this.dataProviderInfo.originalId = originalId;
}
}

View File

@ -7,7 +7,11 @@ export class DataProviderInfo {
oaiPmhURL: string;
openDoarURL: string;
r3DataURL: string;
originalId: string;
countries: string[];
aggregationStatus: {"fundedContent": string, "indexRecords": string}; //collected from datasource api
tabs: {"name": string, "content": string}[];
tabsInTypes = {
"publicationsTab": new Set<string>(