openaire-library/landingPages/dataProvider/dataProvider.component.ts

393 lines
25 KiB
TypeScript

import {Component, ViewChild, ElementRef} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {DataProviderService} from './dataProvider.service';
import {DataProviderInfo} from '../../utils/entities/dataProviderInfo';
import {ActivatedRoute, Router} from '@angular/router';
import { Meta} from '../../sharedComponents/metaService';
import { FetchPublications } from '../../utils/fetchEntitiesClasses/fetchPublications.class';
import { SearchPublicationsService } from '../../services/searchPublications.service';
import { FetchDatasets } from '../../utils/fetchEntitiesClasses/fetchDatasets.class';
import { SearchDatasetsService } from '../../services/searchDatasets.service';
import { FetchProjects } from '../../utils/fetchEntitiesClasses/fetchProjects.class';
import { SearchProjectsService } from '../../services/searchProjects.service';
import { FetchDataproviders } from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
import { SearchDataprovidersService } from '../../services/searchDataproviders.service';
import { RelatedDatasourcesTabComponent } from './relatedDatasourcesTab.component';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {RouterHelper} from '../../utils/routerHelper.class';
import {PiwikService} from '../../utils/piwik/piwik.service';
import{EnvProperties} from '../../utils/properties/env-properties';
import 'rxjs/add/operator/switch';
import 'rxjs/add/operator/switchMap';
@Component({
selector: 'dataprovider',
templateUrl: 'dataProvider.component.html',
})
export class DataProviderComponent {
public dataProviderInfo: DataProviderInfo;
public datasourceId: string;
// Message variables
public warningMessage = "";
public errorMessage = "";
public showLoading: boolean = true;
// Variable to specify requests with either collectedFrom or hostedBy
public paramsForSearchLink = {};
// Metrics tab variables
public metricsClicked: boolean;
public viewsFrameUrl: string;
public downloadsFrameUrl: string;
public totalViews: number;
public totalDownloads: number;
public pageViews: number;
// Statistics tab variables
public statsClicked: boolean = false;
public docsTimelineUrl: string;
public docsTypesUrl:string;
public docsFunderUrl:string;
public dataProjectsUrl:string ;
public pubsProjectsUrl:string;
// Variables for publications, research data, projects, content providers, related content providers tabs
public fetchPublications : FetchPublications;
public fetchDatasets: FetchDatasets;
public fetchProjects: FetchProjects;
public fetchDataproviders: FetchDataproviders;
public fetchAggregatorsPublications: FetchPublications;
public fetchAggregatorsDatasets: FetchDatasets;
public loadingRelatedDatasources: boolean = true;
// Active tab variable for responsiveness - show tabs only if main request is completed
public activeTab: string = "";
public showTabs:boolean = false;
public routerHelper:RouterHelper = new RouterHelper();
public errorCodes:ErrorCodes = new ErrorCodes();
// Request results of each tab only the one time (first time tab is clicked)
private reloadPublications: boolean = true;
private reloadDatasets: boolean = true;
private reloadProjects: boolean = true;
private reloadDataproviders: boolean = true;
private reloadRelatedDatasources: boolean = true;
private nativeElement : Node;
sub: any;
piwiksub: any;
subInfo: any;
relatedDatasourcesSub: any;
properties:EnvProperties;
constructor (private element: ElementRef,
private _dataproviderService: DataProviderService,
private _piwikService:PiwikService,
private route: ActivatedRoute,
private _meta: Meta,
private _router: Router,
private _searchPublicationsService: SearchPublicationsService,
private _searchDatasetsService: SearchDatasetsService,
private _searchProjectsService: SearchProjectsService,
private _searchDataprovidersService: SearchDataprovidersService) {
this.fetchPublications = new FetchPublications(this._searchPublicationsService);
this.fetchDatasets = new FetchDatasets(this._searchDatasetsService);
this.fetchProjects = new FetchProjects(this._searchProjectsService);
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
}
ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.updateUrl(data.envSpecific.baseLink+this._router.url);
});
this.sub = this.route.queryParams.subscribe(data => {
this.updateTitle("Content provider");
this.updateDescription("Content provider, search, repositories, open access");
this.datasourceId = data['datasourceId'];
if(this.datasourceId){
this.getDataProviderInfo(this.datasourceId);
}else{
// console.info("Content Provider id not found");
}
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
});
}
ngOnDestroy() {
this.sub.unsubscribe();
if(this.piwiksub){
this.piwiksub.unsubscribe();
}
if(this.subInfo) {
this.subInfo.unsubscribe();
}
if(this.relatedDatasourcesSub) {
this.relatedDatasourcesSub.unsubscribe();
}
}
private getDataProviderInfo(id:string) {
this.warningMessage = '';
this.errorMessage=""
this.showLoading = true;
this.showTabs = false ;
if(this.datasourceId==null || this.datasourceId==''){
this.showLoading = false;
this.warningMessage="No valid datasource id";
}else{
this.subInfo = this._dataproviderService.getDataproviderInfo(this.datasourceId, this.properties).subscribe(
data => {
this.dataProviderInfo = data;
this.initTabs();
this.showTabs = true ;
this.updateTitle(this.dataProviderInfo.title.name);
this.updateDescription("Content provider, search, repositories, open access,"+this.dataProviderInfo.title.name);
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, this.dataProviderInfo.title.name).subscribe();
}
this.showLoading = false;
if(this.dataProviderInfo.tabs != undefined && this.dataProviderInfo.tabs.length > 0) {
this.activeTab = this.dataProviderInfo.tabs[0].name;
}
},
err => {
console.log(err);
// console.info("error");
this.errorMessage = 'No dataProvider found';
this.showLoading = false;
}
);
}
}
private updateDescription(description:string){
this._meta.updateMeta("description", description);
this._meta.updateProperty("og:description", description);
}
private updateTitle(title:string){
var _prefix ="OpenAIRE | ";
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
this._meta.setTitle(_title );
this._meta.updateProperty("og:title",_title);
}
private updateUrl(url:string){
this._meta.updateProperty("og:url", url);
}
private initTabs(){
if(this.dataProviderInfo.tabs != undefined && this.dataProviderInfo.tabs.length > 0) {
this.reloadPublications = true;
this.reloadDatasets = true;
this.reloadProjects = true;
this.reloadDataproviders = true;
this.reloadRelatedDatasources = true;
this.statsClicked = false;
this.search(this.dataProviderInfo.tabs[0].content, 1, 10);
this.count(1, 0);
this.metricsClicked = false;
this.viewsFrameUrl = this.properties.framesAPIURL +'merge.php?com=query&data=[{"query":"dtsrcRepoViews","dtsrcName":"'+this.datasourceId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
/*this.viewsFrameUrl = this.properties.framesAPIURL+'merge.php?com=query&data=[{"query":"dtsrcOpenAIRETimeline", "dtsrcName":"'+this.datasourceId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"OpenAIRE","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]},{"query":"dtsrcRepoTimeline", "dtsrcName":"'+this.datasourceId+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column","column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true';
*/
this.downloadsFrameUrl = this.properties.framesAPIURL +'merge.php?com=query&data=[{"query":"dtsrcRepoDownloads","dtsrcName":"'+this.datasourceId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["column"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
/*
this.downloadsFrameUrl = this.properties.framesAPIURL +'merge.php?com=query&data=[{"query":"dtsrcDownloadsTimeline","dtsrcName":"'+this.datasourceId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"chart","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true';
*/
this.docsTimelineUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcYear","dtsrcName":"'+this.datasourceId+'","table": "result", "fields": [{"fld": "number", "agg": "count", "type": "line", "yaxis":1, "c":true}], "xaxis":{"name": "year", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": -30, "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [{"f":0, "text": "Yearly"}], "filters": [{"name":"year","max":"2016","min":"1997"},{"name": "result_datasources-datasource-name", "values":[""], "to": "-1"}],"having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": "Year"}&w=600&h=250';
this.docsTypesUrl = 'https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcPubs","dtsrcName":"'+this.datasourceId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
this.docsFunderUrl =' https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcPubsFund","dtsrcName":"'+this.datasourceId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
this.dataProjectsUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcProjData","dtsrcName":"'+this.datasourceId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Data"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
this.pubsProjectsUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcProjPubs","dtsrcName":"'+this.datasourceId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Publications"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
//if({"name": "Publications", "content": "publicationsTab"} in this.dataProviderInfo.tabs) {
//if(this.dataProviderInfo.tabs.some(function (tab) {
// return tab.name === 'Publications';
//})) {
// this.relatedDataprovidersResultsType = 'publications';
this.fetchAggregatorsPublications = new FetchPublications(this._searchPublicationsService);
//} else {
// this.relatedDataprovidersResultsType = 'datasets';
this.fetchAggregatorsDatasets = new FetchDatasets(this._searchDatasetsService);
//}
}
if(this.dataProviderInfo.resultsBy == "collectedFrom") {
//this.paramsForSearchLink = "?collectedFrom="+this.datasourceId+"&co=and";
this.paramsForSearchLink = this.routerHelper.createQueryParams(['collectedFrom', 'co'], [this.datasourceId, 'and']);
} else if (this.dataProviderInfo.resultsBy == "hostedBy") {
//this.paramsForSearchLink = "?hostedBy="+this.datasourceId+"&ho=and";
this.paramsForSearchLink = this.routerHelper.createQueryParams(['hostedBy', 'ho'], [this.datasourceId, 'and']);
}
}
private count(page: number, size: number) {
for(let i=1; i<this.dataProviderInfo.tabs.length; i++) {
let content: string = this.dataProviderInfo.tabs[i].content;
if(content=='publicationsTab') {
this.countPublications(page, size);
} else if(content=='datasetsTab') {
this.countDatasets(page, size);
} else if(content=='projectsTab') {
this.countProjects(page, size);
} else if(content=='datasourcesTab') {
this.countDatasources(page, size);
}// else if(content=='relatedDatasourcesTab') {
// this.countRelatedDatasources(page, size);
//}
}
}
public search(content: string, page: number, size: number) {
if(content=='publicationsTab') {
this.searchPublications(page, size);
} else if(content=='datasetsTab') {
this.searchDatasets(page, size);
} else if(content=='projectsTab') {
this.searchProjects(page, size);
} else if(content=='datasourcesTab') {
this.searchDatasources(page, size);
} else if(content=='relatedDatasourcesTab') {
this.searchRelatedDatasources(1, 0);
} else if(content=='metricsTab') {
this.metricsClicked = true;
} else if(content=='statisticsTab') {
this.statsClicked = true;
}
}
private searchPublications(page: number, size: number) {
if( this.reloadPublications &&
( this.fetchPublications.searchUtils.status == this.errorCodes.LOADING ||
this.fetchPublications.searchUtils.status == this.errorCodes.DONE ) ) {
this.fetchPublications.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
}
this.reloadPublications = false;
}
private countPublications(page: number, size: number) {
this.fetchPublications.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
}
private searchDatasets(page: number, size: number) {
if( this.reloadDatasets &&
( this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING ||
this.fetchDatasets.searchUtils.status == this.errorCodes.DONE ) ) {
this.fetchDatasets.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
}
this.reloadDatasets = false;
}
private countDatasets(page: number, size: number) {
this.fetchDatasets.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
}
private searchProjects(page: number, size: number) {
if( this.reloadProjects &&
( this.fetchProjects.searchUtils.status == this.errorCodes.LOADING ||
this.fetchProjects.searchUtils.status == this.errorCodes.DONE ) ) {
this.fetchProjects.getResultsForDataproviders(this.datasourceId, page, size, this.properties);
}
this.reloadProjects = false;
}
private countProjects(page: number, size: number) {
this.fetchProjects.getResultsForDataproviders(this.datasourceId, page, size, this.properties);
}
private searchDatasources(page: number, size: number) {
if( this.reloadDataproviders &&
( this.fetchDataproviders.searchUtils.status == this.errorCodes.LOADING ||
this.fetchDataproviders.searchUtils.status == this.errorCodes.DONE ) ) {
this.fetchDataproviders.getResultsForDataproviders(this.datasourceId, page, size, this.properties);
}
this.reloadDataproviders = false;
}
private countDatasources(page: number, size: number) {
this.fetchDataproviders.getResultsForDataproviders(this.datasourceId, page, size, this.properties);
}
private searchRelatedDatasources(page: number, size: number) {
// Currently no counting is done for this tab. Following condition is always false
if( this.reloadRelatedDatasources &&
( this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.LOADING ||
this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.DONE )
&&
( this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.LOADING ||
this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.DONE ) ) {
this.relatedDatasourcesSub = Observable.merge(this.fetchAggregatorsPublications.requestComplete, this.fetchAggregatorsDatasets.requestComplete)
.subscribe(
data => {},
err => {},
() => { this.preprocessRelatedDatasources(); }
)
this.fetchAggregatorsPublications.getAggregatorResults(this.datasourceId, page, size, this.properties);
this.fetchAggregatorsDatasets.getAggregatorResults(this.datasourceId, page, size, this.properties);
} else {
this.loadingRelatedDatasources = false;
}
this.reloadRelatedDatasources = false;
}
private countRelatedDatasources(page: number, size: number) {
this.fetchAggregatorsPublications.getAggregatorResults(this.datasourceId, page, size, this.properties);
this.fetchAggregatorsDatasets.getAggregatorResults(this.datasourceId, page, size, this.properties);
}
private preprocessRelatedDatasources() {
if( this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.DONE ||
this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.DONE ) {
this.dataProviderInfo.relatedDatasources = new Map<string, {"name": string, "countPublications": string, "countDatasets": string}>();
}
for(let result of this.fetchAggregatorsPublications.results) {
if(!this.dataProviderInfo.relatedDatasources.has(result.id)) {
this.dataProviderInfo.relatedDatasources.set(result.id, {"name": result.name, "countPublications": result.count, "countDatasets": "0"});
} else {
this.dataProviderInfo.relatedDatasources.get(result.id).countPublications = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countPublications + result.count)+"";
}
}
for(let result of this.fetchAggregatorsDatasets.results) {
if(!this.dataProviderInfo.relatedDatasources.has(result.id)) {
this.dataProviderInfo.relatedDatasources.set(result.id, {"name": result.name, "countPublications": "0", "countDatasets": result.count});
} else {
this.dataProviderInfo.relatedDatasources.get(result.id).countDatasets = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countDatasets + result.count)+"";
}
}
this.loadingRelatedDatasources = false;
}
public metricsResults($event) {
this.totalViews = $event.totalViews;
this.totalDownloads = $event.totalDownloads;
this.pageViews = $event.pageViews;
}
}