1 |
52741
|
argiro.kok
|
import {Component, ViewChild} from '@angular/core';
|
2 |
|
|
import {ElementRef, Input} from '@angular/core';
|
3 |
|
|
import {ActivatedRoute, Router} from '@angular/router';
|
4 |
|
|
import {Title, Meta} from '@angular/platform-browser';
|
5 |
|
|
|
6 |
|
|
import {Observable} from 'rxjs/Observable';
|
7 |
|
|
|
8 |
|
|
import 'rxjs/add/operator/switch';
|
9 |
|
|
import 'rxjs/add/operator/switchMap';
|
10 |
|
|
|
11 |
|
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
12 |
|
|
|
13 |
|
|
import {DataProviderInfo} from '../../utils/entities/dataProviderInfo';
|
14 |
|
|
import {DataProviderService} from './dataProvider.service';
|
15 |
|
|
import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class';
|
16 |
|
|
import {SearchPublicationsService} from '../../services/searchPublications.service';
|
17 |
|
|
import {FetchDatasets} from '../../utils/fetchEntitiesClasses/fetchDatasets.class';
|
18 |
|
|
import {SearchDatasetsService} from '../../services/searchDatasets.service';
|
19 |
|
|
import {FetchSoftware} from '../../utils/fetchEntitiesClasses/fetchSoftware.class';
|
20 |
|
|
import {SearchSoftwareService} from '../../services/searchSoftware.service';
|
21 |
52842
|
argiro.kok
|
import {FetchOrps} from '../../utils/fetchEntitiesClasses/fetchOrps.class';
|
22 |
|
|
import {SearchOrpsService} from '../../services/searchOrps.service';
|
23 |
52741
|
argiro.kok
|
import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class';
|
24 |
|
|
import {SearchProjectsService} from '../../services/searchProjects.service';
|
25 |
|
|
import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
|
26 |
|
|
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
|
27 |
|
|
import {RelatedDatasourcesTabComponent} from './relatedDatasourcesTab.component';
|
28 |
|
|
import {ErrorCodes} from '../../utils/properties/errorCodes';
|
29 |
|
|
import {RouterHelper} from '../../utils/routerHelper.class';
|
30 |
|
|
import {PiwikService} from '../../utils/piwik/piwik.service';
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
@Component({
|
34 |
|
|
selector: 'dataprovider',
|
35 |
|
|
templateUrl: 'dataProvider.component.html',
|
36 |
|
|
})
|
37 |
|
|
|
38 |
|
|
export class DataProviderComponent {
|
39 |
|
|
@Input() piwikSiteId = null;
|
40 |
|
|
public dataProviderInfo: DataProviderInfo;
|
41 |
|
|
public datasourceId: string;
|
42 |
|
|
|
43 |
|
|
// Message variables
|
44 |
|
|
public warningMessage = "";
|
45 |
|
|
public errorMessage = "";
|
46 |
|
|
public showLoading: boolean = true;
|
47 |
|
|
|
48 |
|
|
// Variable to specify requests with either collectedFrom or hostedBy
|
49 |
|
|
public paramsForSearchLink = {};
|
50 |
|
|
|
51 |
|
|
// Metrics tab variables
|
52 |
|
|
public metricsClicked: boolean;
|
53 |
|
|
public viewsFrameUrl: string;
|
54 |
|
|
public downloadsFrameUrl: string;
|
55 |
|
|
public totalViews: number;
|
56 |
|
|
public totalDownloads: number;
|
57 |
|
|
public pageViews: number;
|
58 |
|
|
|
59 |
|
|
// Statistics tab variables
|
60 |
|
|
public statsClicked: boolean = false;
|
61 |
|
|
public docsTimelineUrl: string;
|
62 |
|
|
public docsTypesUrl:string;
|
63 |
|
|
public docsFunderUrl:string;
|
64 |
|
|
public dataProjectsUrl:string ;
|
65 |
|
|
public pubsProjectsUrl:string;
|
66 |
|
|
|
67 |
|
|
// Variables for publications, research data, projects, content providers, related content providers tabs
|
68 |
|
|
public fetchPublications : FetchPublications;
|
69 |
|
|
public fetchDatasets: FetchDatasets;
|
70 |
|
|
public fetchSoftware: FetchSoftware;
|
71 |
52842
|
argiro.kok
|
public fetchOrps: FetchOrps;
|
72 |
52741
|
argiro.kok
|
public fetchProjects: FetchProjects;
|
73 |
|
|
public fetchDataproviders: FetchDataproviders;
|
74 |
|
|
public fetchAggregatorsPublications: FetchPublications;
|
75 |
|
|
public fetchAggregatorsDatasets: FetchDatasets;
|
76 |
|
|
public fetchAggregatorsSoftware: FetchSoftware;
|
77 |
52842
|
argiro.kok
|
public fetchAggregatorsOrps: FetchOrps;
|
78 |
52741
|
argiro.kok
|
|
79 |
|
|
public loadingRelatedDatasources: boolean = true;
|
80 |
|
|
|
81 |
|
|
// Active tab variable for responsiveness - show tabs only if main request is completed
|
82 |
|
|
public activeTab: string = "";
|
83 |
|
|
public showTabs:boolean = false;
|
84 |
|
|
|
85 |
|
|
public routerHelper:RouterHelper = new RouterHelper();
|
86 |
|
|
public errorCodes:ErrorCodes = new ErrorCodes();
|
87 |
|
|
|
88 |
|
|
// Request results of each tab only the one time (first time tab is clicked)
|
89 |
|
|
private reloadPublications: boolean = true;
|
90 |
|
|
private reloadDatasets: boolean = true;
|
91 |
|
|
private reloadSoftware: boolean = true;
|
92 |
52842
|
argiro.kok
|
private reloadOrps: boolean = true;
|
93 |
52741
|
argiro.kok
|
private reloadProjects: boolean = true;
|
94 |
|
|
private reloadDataproviders: boolean = true;
|
95 |
|
|
private reloadRelatedDatasources: boolean = true;
|
96 |
|
|
|
97 |
|
|
private nativeElement : Node;
|
98 |
|
|
|
99 |
|
|
sub: any;
|
100 |
|
|
piwiksub: any;
|
101 |
|
|
subInfo: any;
|
102 |
|
|
relatedDatasourcesSub: any;
|
103 |
|
|
properties:EnvProperties;
|
104 |
|
|
|
105 |
|
|
constructor (private element: ElementRef,
|
106 |
|
|
private _dataproviderService: DataProviderService,
|
107 |
|
|
private _piwikService:PiwikService,
|
108 |
|
|
private route: ActivatedRoute,
|
109 |
|
|
private _meta: Meta,
|
110 |
|
|
private _title: Title,
|
111 |
|
|
private _router: Router,
|
112 |
|
|
private _searchPublicationsService: SearchPublicationsService,
|
113 |
|
|
private _searchDatasetsService: SearchDatasetsService,
|
114 |
|
|
private _searchSoftwareService: SearchSoftwareService,
|
115 |
52842
|
argiro.kok
|
private _searchOrpsService: SearchOrpsService,
|
116 |
52741
|
argiro.kok
|
private _searchProjectsService: SearchProjectsService,
|
117 |
|
|
private _searchDataprovidersService: SearchDataprovidersService) {
|
118 |
|
|
this.fetchPublications = new FetchPublications(this._searchPublicationsService);
|
119 |
|
|
this.fetchDatasets = new FetchDatasets(this._searchDatasetsService);
|
120 |
|
|
this.fetchSoftware = new FetchSoftware(this._searchSoftwareService);
|
121 |
52842
|
argiro.kok
|
this.fetchOrps = new FetchOrps(this._searchOrpsService);
|
122 |
52741
|
argiro.kok
|
this.fetchProjects = new FetchProjects(this._searchProjectsService);
|
123 |
|
|
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
|
124 |
|
|
|
125 |
|
|
}
|
126 |
|
|
|
127 |
|
|
ngOnInit() {
|
128 |
|
|
this.route.data
|
129 |
|
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
130 |
|
|
this.properties = data.envSpecific;
|
131 |
|
|
this.updateUrl(data.envSpecific.baseLink+this._router.url);
|
132 |
|
|
|
133 |
|
|
});
|
134 |
|
|
this.sub = this.route.queryParams.subscribe(data => {
|
135 |
|
|
this.updateTitle("Content provider");
|
136 |
|
|
this.updateDescription("Content provider, search, repositories, open access");
|
137 |
|
|
this.datasourceId = data['datasourceId'];
|
138 |
|
|
if(this.datasourceId){
|
139 |
|
|
this.getDataProviderInfo(this.datasourceId);
|
140 |
|
|
}else{
|
141 |
|
|
// console.info("Content Provider id not found");
|
142 |
|
|
}
|
143 |
|
|
|
144 |
|
|
if (typeof document !== 'undefined') {
|
145 |
|
|
this.element.nativeElement.scrollIntoView();
|
146 |
|
|
}
|
147 |
|
|
});
|
148 |
|
|
}
|
149 |
|
|
|
150 |
|
|
ngOnDestroy() {
|
151 |
53027
|
argiro.kok
|
if(this.sub){
|
152 |
|
|
this.sub.unsubscribe();
|
153 |
|
|
}
|
154 |
52741
|
argiro.kok
|
if(this.piwiksub){
|
155 |
|
|
this.piwiksub.unsubscribe();
|
156 |
|
|
}
|
157 |
|
|
if(this.subInfo) {
|
158 |
|
|
this.subInfo.unsubscribe();
|
159 |
|
|
}
|
160 |
|
|
|
161 |
|
|
if(this.relatedDatasourcesSub) {
|
162 |
|
|
this.relatedDatasourcesSub.unsubscribe();
|
163 |
|
|
}
|
164 |
|
|
}
|
165 |
|
|
private getDataProviderInfo(id:string) {
|
166 |
|
|
this.warningMessage = '';
|
167 |
|
|
this.errorMessage=""
|
168 |
|
|
this.showLoading = true;
|
169 |
|
|
|
170 |
|
|
this.dataProviderInfo = null;
|
171 |
|
|
|
172 |
|
|
this.showTabs = false ;
|
173 |
|
|
if(this.datasourceId==null || this.datasourceId==''){
|
174 |
|
|
this.showLoading = false;
|
175 |
|
|
this.warningMessage="No valid datasource id";
|
176 |
|
|
}else{
|
177 |
|
|
this.subInfo = this._dataproviderService.getDataproviderInfo(this.datasourceId, this.properties).subscribe(
|
178 |
|
|
data => {
|
179 |
|
|
this.dataProviderInfo = data;
|
180 |
|
|
|
181 |
|
|
this.getDataProviderAggregationStatus(this.dataProviderInfo.originalId);
|
182 |
|
|
|
183 |
|
|
this.initTabs();
|
184 |
|
|
this.showTabs = true ;
|
185 |
|
|
this.updateTitle(this.dataProviderInfo.title.name);
|
186 |
|
|
this.updateDescription("Content provider, search, repositories, open access,"+this.dataProviderInfo.title.name);
|
187 |
|
|
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
|
188 |
|
|
this.piwiksub = this._piwikService.trackView(this.properties, this.dataProviderInfo.title.name, this.piwikSiteId).subscribe();
|
189 |
|
|
}
|
190 |
|
|
|
191 |
|
|
this.showLoading = false;
|
192 |
|
|
|
193 |
|
|
if(this.dataProviderInfo.tabs != undefined && this.dataProviderInfo.tabs.length > 0) {
|
194 |
|
|
this.activeTab = this.dataProviderInfo.tabs[0].name;
|
195 |
|
|
}
|
196 |
|
|
},
|
197 |
|
|
err => {
|
198 |
|
|
console.log(err);
|
199 |
|
|
// console.info("error");
|
200 |
|
|
this.errorMessage = 'No dataProvider found';
|
201 |
|
|
this.showLoading = false;
|
202 |
|
|
}
|
203 |
|
|
);
|
204 |
|
|
}
|
205 |
|
|
}
|
206 |
|
|
|
207 |
|
|
private getDataProviderAggregationStatus(originalId: string) {
|
208 |
|
|
this.subInfo = this._dataproviderService.getDataproviderAggregationStatus(originalId, this.properties).subscribe(
|
209 |
|
|
data => {
|
210 |
|
|
this.dataProviderInfo.aggregationStatus = data;
|
211 |
|
|
},
|
212 |
|
|
err => {
|
213 |
|
|
console.log(err);
|
214 |
|
|
}
|
215 |
|
|
);
|
216 |
|
|
}
|
217 |
|
|
|
218 |
|
|
private updateDescription(description:string) {
|
219 |
|
|
this._meta.updateTag({content:description},"name='description'");
|
220 |
|
|
this._meta.updateTag({content:description},"property='og:description'");
|
221 |
|
|
}
|
222 |
|
|
private updateTitle(title:string) {
|
223 |
|
|
var _prefix ="OpenAIRE | ";
|
224 |
|
|
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
|
225 |
|
|
this._title.setTitle(_title);
|
226 |
|
|
this._meta.updateTag({content:_title},"property='og:title'");
|
227 |
|
|
}
|
228 |
|
|
private updateUrl(url:string) {
|
229 |
|
|
this._meta.updateTag({content:url},"property='og:url'");
|
230 |
|
|
}
|
231 |
|
|
|
232 |
|
|
private initTabs(){
|
233 |
|
|
|
234 |
|
|
if(this.dataProviderInfo.tabs != undefined && this.dataProviderInfo.tabs.length > 0) {
|
235 |
|
|
this.reloadPublications = true;
|
236 |
|
|
this.reloadDatasets = true;
|
237 |
|
|
this.reloadSoftware = true;
|
238 |
52842
|
argiro.kok
|
this.reloadOrps = true;
|
239 |
52741
|
argiro.kok
|
this.reloadProjects = true;
|
240 |
|
|
this.reloadDataproviders = true;
|
241 |
|
|
this.reloadRelatedDatasources = true;
|
242 |
|
|
this.statsClicked = false;
|
243 |
|
|
|
244 |
|
|
this.search(this.dataProviderInfo.tabs[0].content, 1, 10);
|
245 |
|
|
this.count(1, 0);
|
246 |
|
|
|
247 |
|
|
this.metricsClicked = false;
|
248 |
|
|
|
249 |
|
|
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';
|
250 |
|
|
/*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';
|
251 |
|
|
*/
|
252 |
|
|
|
253 |
|
|
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';
|
254 |
|
|
/*
|
255 |
|
|
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';
|
256 |
|
|
*/
|
257 |
|
|
|
258 |
53258
|
argiro.kok
|
this.docsTimelineUrl ='https://www.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';
|
259 |
|
|
this.docsTypesUrl = 'https://www.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';
|
260 |
|
|
this.docsFunderUrl =' https://www.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';
|
261 |
|
|
this.dataProjectsUrl ='https://www.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';
|
262 |
|
|
this.pubsProjectsUrl ='https://www.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';
|
263 |
52741
|
argiro.kok
|
|
264 |
|
|
//if({"name": "Publications", "content": "publicationsTab"} in this.dataProviderInfo.tabs) {
|
265 |
|
|
//if(this.dataProviderInfo.tabs.some(function (tab) {
|
266 |
|
|
// return tab.name === 'Publications';
|
267 |
|
|
//})) {
|
268 |
|
|
// this.relatedDataprovidersResultsType = 'publications';
|
269 |
|
|
this.fetchAggregatorsPublications = new FetchPublications(this._searchPublicationsService);
|
270 |
|
|
//} else {
|
271 |
|
|
// this.relatedDataprovidersResultsType = 'datasets';
|
272 |
|
|
this.fetchAggregatorsDatasets = new FetchDatasets(this._searchDatasetsService);
|
273 |
|
|
//}
|
274 |
|
|
this.fetchAggregatorsSoftware = new FetchSoftware(this._searchSoftwareService);
|
275 |
52842
|
argiro.kok
|
this.fetchAggregatorsOrps = new FetchOrps(this._searchOrpsService);
|
276 |
52741
|
argiro.kok
|
}
|
277 |
|
|
if(this.dataProviderInfo.resultsBy == "collectedFrom") {
|
278 |
|
|
//this.paramsForSearchLink = "?collectedFrom="+this.datasourceId+"&co=and";
|
279 |
52842
|
argiro.kok
|
this.paramsForSearchLink = this.routerHelper.createQueryParams(['collectedFrom', 'cl'], [this.datasourceId, 'and']);
|
280 |
52741
|
argiro.kok
|
} else if (this.dataProviderInfo.resultsBy == "hostedBy") {
|
281 |
|
|
//this.paramsForSearchLink = "?hostedBy="+this.datasourceId+"&ho=and";
|
282 |
52842
|
argiro.kok
|
this.paramsForSearchLink = this.routerHelper.createQueryParams(['hostedBy', 'hs'], [this.datasourceId, 'and']);
|
283 |
52741
|
argiro.kok
|
}
|
284 |
|
|
|
285 |
|
|
}
|
286 |
|
|
|
287 |
|
|
private count(page: number, size: number) {
|
288 |
|
|
for(let i=1; i<this.dataProviderInfo.tabs.length; i++) {
|
289 |
|
|
let content: string = this.dataProviderInfo.tabs[i].content;
|
290 |
|
|
|
291 |
|
|
if(content=='publicationsTab') {
|
292 |
|
|
this.countPublications(page, size);
|
293 |
|
|
} else if(content=='datasetsTab') {
|
294 |
|
|
this.countDatasets(page, size);
|
295 |
|
|
} else if(content=='softwareTab') {
|
296 |
|
|
this.countSoftware(page, size);
|
297 |
52842
|
argiro.kok
|
} else if(content=='orpsTab') {
|
298 |
|
|
this.countOrps(page, size);
|
299 |
|
|
} else if(content=='projectsTab') {
|
300 |
52741
|
argiro.kok
|
this.countProjects(page, size);
|
301 |
|
|
} else if(content=='datasourcesTab') {
|
302 |
|
|
this.countDatasources(page, size);
|
303 |
|
|
}// else if(content=='relatedDatasourcesTab') {
|
304 |
|
|
// this.countRelatedDatasources(page, size);
|
305 |
|
|
//}
|
306 |
|
|
}
|
307 |
|
|
}
|
308 |
|
|
|
309 |
|
|
public search(content: string, page: number, size: number) {
|
310 |
|
|
if(content=='publicationsTab') {
|
311 |
|
|
this.searchPublications(page, size);
|
312 |
|
|
} else if(content=='datasetsTab') {
|
313 |
|
|
this.searchDatasets(page, size);
|
314 |
|
|
} else if(content=='softwareTab') {
|
315 |
|
|
this.searchSoftware(page, size);
|
316 |
52842
|
argiro.kok
|
} else if(content=='orpsTab') {
|
317 |
|
|
this.searchOrps(page, size);
|
318 |
|
|
} else if(content=='projectsTab') {
|
319 |
52741
|
argiro.kok
|
this.searchProjects(page, size);
|
320 |
|
|
} else if(content=='datasourcesTab') {
|
321 |
|
|
this.searchDatasources(page, size);
|
322 |
|
|
} else if(content=='relatedDatasourcesTab') {
|
323 |
|
|
this.searchRelatedDatasources(1, 0);
|
324 |
|
|
} else if(content=='metricsTab') {
|
325 |
|
|
this.metricsClicked = true;
|
326 |
|
|
} else if(content=='statisticsTab') {
|
327 |
|
|
this.statsClicked = true;
|
328 |
|
|
}
|
329 |
|
|
}
|
330 |
|
|
|
331 |
|
|
private searchPublications(page: number, size: number) {
|
332 |
|
|
if( this.reloadPublications &&
|
333 |
|
|
( this.fetchPublications.searchUtils.status == this.errorCodes.LOADING ||
|
334 |
|
|
this.fetchPublications.searchUtils.status == this.errorCodes.DONE ) ) {
|
335 |
|
|
this.fetchPublications.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
|
336 |
|
|
}
|
337 |
|
|
this.reloadPublications = false;
|
338 |
|
|
}
|
339 |
|
|
|
340 |
|
|
private countPublications(page: number, size: number) {
|
341 |
|
|
this.fetchPublications.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
|
342 |
|
|
}
|
343 |
|
|
|
344 |
|
|
private searchDatasets(page: number, size: number) {
|
345 |
|
|
if( this.reloadDatasets &&
|
346 |
|
|
( this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING ||
|
347 |
|
|
this.fetchDatasets.searchUtils.status == this.errorCodes.DONE ) ) {
|
348 |
|
|
this.fetchDatasets.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
|
349 |
|
|
}
|
350 |
|
|
this.reloadDatasets = false;
|
351 |
|
|
}
|
352 |
|
|
|
353 |
|
|
private countDatasets(page: number, size: number) {
|
354 |
|
|
this.fetchDatasets.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
|
355 |
|
|
}
|
356 |
|
|
|
357 |
|
|
private searchSoftware(page: number, size: number) {
|
358 |
|
|
if( this.reloadSoftware &&
|
359 |
|
|
( this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING ||
|
360 |
|
|
this.fetchSoftware.searchUtils.status == this.errorCodes.DONE ) ) {
|
361 |
|
|
this.fetchSoftware.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
|
362 |
|
|
}
|
363 |
|
|
this.reloadSoftware = false;
|
364 |
|
|
}
|
365 |
|
|
|
366 |
|
|
private countSoftware(page: number, size: number) {
|
367 |
|
|
this.fetchSoftware.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
|
368 |
|
|
}
|
369 |
|
|
|
370 |
52842
|
argiro.kok
|
private searchOrps(page: number, size: number) {
|
371 |
|
|
if( this.reloadOrps &&
|
372 |
|
|
( this.fetchOrps.searchUtils.status == this.errorCodes.LOADING ||
|
373 |
|
|
this.fetchOrps.searchUtils.status == this.errorCodes.DONE ) ) {
|
374 |
|
|
this.fetchOrps.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
|
375 |
|
|
}
|
376 |
|
|
this.reloadOrps = false;
|
377 |
|
|
}
|
378 |
|
|
|
379 |
|
|
private countOrps(page: number, size: number) {
|
380 |
|
|
this.fetchOrps.getResultsForDataproviders(this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
|
381 |
|
|
}
|
382 |
|
|
|
383 |
52741
|
argiro.kok
|
private searchProjects(page: number, size: number) {
|
384 |
|
|
if( this.reloadProjects &&
|
385 |
|
|
( this.fetchProjects.searchUtils.status == this.errorCodes.LOADING ||
|
386 |
|
|
this.fetchProjects.searchUtils.status == this.errorCodes.DONE ) ) {
|
387 |
|
|
this.fetchProjects.getResultsForDataproviders(this.datasourceId, page, size, this.properties);
|
388 |
|
|
}
|
389 |
|
|
this.reloadProjects = false;
|
390 |
|
|
}
|
391 |
|
|
|
392 |
|
|
private countProjects(page: number, size: number) {
|
393 |
|
|
this.fetchProjects.getResultsForDataproviders(this.datasourceId, page, size, this.properties);
|
394 |
|
|
}
|
395 |
|
|
|
396 |
|
|
private searchDatasources(page: number, size: number) {
|
397 |
|
|
if( this.reloadDataproviders &&
|
398 |
|
|
( this.fetchDataproviders.searchUtils.status == this.errorCodes.LOADING ||
|
399 |
|
|
this.fetchDataproviders.searchUtils.status == this.errorCodes.DONE ) ) {
|
400 |
|
|
this.fetchDataproviders.getResultsForDataproviders(this.datasourceId, page, size, this.properties);
|
401 |
|
|
}
|
402 |
|
|
this.reloadDataproviders = false;
|
403 |
|
|
}
|
404 |
|
|
|
405 |
|
|
private countDatasources(page: number, size: number) {
|
406 |
|
|
this.fetchDataproviders.getResultsForDataproviders(this.datasourceId, page, size, this.properties);
|
407 |
|
|
}
|
408 |
|
|
|
409 |
|
|
private searchRelatedDatasources(page: number, size: number) {
|
410 |
|
|
// Currently no counting is done for this tab. Following condition is always false
|
411 |
|
|
|
412 |
|
|
if( this.reloadRelatedDatasources &&
|
413 |
|
|
( this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.LOADING ||
|
414 |
|
|
this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.DONE )
|
415 |
|
|
&&
|
416 |
|
|
( this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.LOADING ||
|
417 |
|
|
this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.DONE )
|
418 |
|
|
&&
|
419 |
|
|
( this.fetchAggregatorsSoftware.searchUtils.status == this.errorCodes.LOADING ||
|
420 |
52842
|
argiro.kok
|
this.fetchAggregatorsSoftware.searchUtils.status == this.errorCodes.DONE )
|
421 |
|
|
&&
|
422 |
|
|
( this.fetchAggregatorsOrps.searchUtils.status == this.errorCodes.LOADING ||
|
423 |
|
|
this.fetchAggregatorsOrps.searchUtils.status == this.errorCodes.DONE )) {
|
424 |
|
|
this.relatedDatasourcesSub = Observable.merge(this.fetchAggregatorsPublications.requestComplete, this.fetchAggregatorsDatasets.requestComplete, this.fetchAggregatorsSoftware.requestComplete, this.fetchAggregatorsOrps.requestComplete)
|
425 |
52741
|
argiro.kok
|
.subscribe(
|
426 |
|
|
data => {},
|
427 |
|
|
err => {},
|
428 |
|
|
() => { this.preprocessRelatedDatasources(); }
|
429 |
|
|
)
|
430 |
|
|
|
431 |
|
|
this.fetchAggregatorsPublications.getAggregatorResults(this.datasourceId, page, size, this.properties);
|
432 |
|
|
this.fetchAggregatorsDatasets.getAggregatorResults(this.datasourceId, page, size, this.properties);
|
433 |
|
|
this.fetchAggregatorsSoftware.getAggregatorResults(this.datasourceId, page, size, this.properties);
|
434 |
52842
|
argiro.kok
|
this.fetchAggregatorsOrps.getAggregatorResults(this.datasourceId, page, size, this.properties);
|
435 |
52741
|
argiro.kok
|
} else {
|
436 |
|
|
this.loadingRelatedDatasources = false;
|
437 |
|
|
}
|
438 |
|
|
|
439 |
|
|
|
440 |
|
|
this.reloadRelatedDatasources = false;
|
441 |
|
|
}
|
442 |
|
|
|
443 |
|
|
private countRelatedDatasources(page: number, size: number) {
|
444 |
|
|
this.fetchAggregatorsPublications.getAggregatorResults(this.datasourceId, page, size, this.properties);
|
445 |
|
|
this.fetchAggregatorsDatasets.getAggregatorResults(this.datasourceId, page, size, this.properties);
|
446 |
|
|
this.fetchAggregatorsSoftware.getAggregatorResults(this.datasourceId, page, size, this.properties);
|
447 |
52842
|
argiro.kok
|
this.fetchAggregatorsOrps.getAggregatorResults(this.datasourceId, page, size, this.properties);
|
448 |
52741
|
argiro.kok
|
}
|
449 |
|
|
|
450 |
|
|
|
451 |
|
|
private preprocessRelatedDatasources() {
|
452 |
|
|
if( this.fetchAggregatorsPublications.searchUtils.status == this.errorCodes.DONE ||
|
453 |
|
|
this.fetchAggregatorsDatasets.searchUtils.status == this.errorCodes.DONE ||
|
454 |
52842
|
argiro.kok
|
this.fetchAggregatorsSoftware.searchUtils.status == this.errorCodes.DONE ||
|
455 |
|
|
this.fetchAggregatorsOrps.searchUtils.status == this.errorCodes.DONE ) {
|
456 |
|
|
this.dataProviderInfo.relatedDatasources = new Map<string, {"name": string, "countPublications": string, "countDatasets": string, "countSoftware": string, "countOrps": string}>();
|
457 |
52741
|
argiro.kok
|
}
|
458 |
|
|
for(let result of this.fetchAggregatorsPublications.results) {
|
459 |
|
|
if(!this.dataProviderInfo.relatedDatasources.has(result.id)) {
|
460 |
52842
|
argiro.kok
|
this.dataProviderInfo.relatedDatasources.set(result.id, {"name": result.name, "countPublications": result.count, "countDatasets": "0", "countSoftware": "0", "countOrps": "0"});
|
461 |
52741
|
argiro.kok
|
} else {
|
462 |
|
|
this.dataProviderInfo.relatedDatasources.get(result.id).countPublications = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countPublications + result.count)+"";
|
463 |
|
|
}
|
464 |
|
|
}
|
465 |
|
|
|
466 |
|
|
for(let result of this.fetchAggregatorsDatasets.results) {
|
467 |
|
|
if(!this.dataProviderInfo.relatedDatasources.has(result.id)) {
|
468 |
52842
|
argiro.kok
|
this.dataProviderInfo.relatedDatasources.set(result.id, {"name": result.name, "countPublications": "0", "countDatasets": result.count, "countSoftware": "0", "countOrps": "0"});
|
469 |
52741
|
argiro.kok
|
} else {
|
470 |
|
|
this.dataProviderInfo.relatedDatasources.get(result.id).countDatasets = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countDatasets + result.count)+"";
|
471 |
|
|
}
|
472 |
|
|
}
|
473 |
|
|
|
474 |
|
|
for(let result of this.fetchAggregatorsSoftware.results) {
|
475 |
|
|
if(!this.dataProviderInfo.relatedDatasources.has(result.id)) {
|
476 |
52842
|
argiro.kok
|
this.dataProviderInfo.relatedDatasources.set(result.id, {"name": result.name, "countPublications": "0", "countDatasets": "0", "countSoftware": result.count, "countOrps": "0"});
|
477 |
52741
|
argiro.kok
|
} else {
|
478 |
|
|
this.dataProviderInfo.relatedDatasources.get(result.id).countSoftware = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countSoftware + result.count)+"";
|
479 |
|
|
}
|
480 |
|
|
}
|
481 |
52842
|
argiro.kok
|
|
482 |
|
|
for(let result of this.fetchAggregatorsOrps.results) {
|
483 |
|
|
if(!this.dataProviderInfo.relatedDatasources.has(result.id)) {
|
484 |
|
|
this.dataProviderInfo.relatedDatasources.set(result.id, {"name": result.name, "countPublications": "0", "countDatasets": "0", "countSoftware": "0", "countOrps": result.count});
|
485 |
|
|
} else {
|
486 |
|
|
this.dataProviderInfo.relatedDatasources.get(result.id).countOrps = parseInt(this.dataProviderInfo.relatedDatasources.get(result.id).countOrps + result.count)+"";
|
487 |
|
|
}
|
488 |
|
|
}
|
489 |
52741
|
argiro.kok
|
this.loadingRelatedDatasources = false;
|
490 |
|
|
}
|
491 |
|
|
|
492 |
|
|
public metricsResults($event) {
|
493 |
|
|
this.totalViews = $event.totalViews;
|
494 |
|
|
this.totalDownloads = $event.totalDownloads;
|
495 |
|
|
this.pageViews = $event.pageViews;
|
496 |
|
|
}
|
497 |
|
|
}
|