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

84 lines
7.1 KiB
TypeScript

import {Component, Input} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {FetchResearchResults} from '../../utils/fetchEntitiesClasses/fetchResearchResults.class';
import {ErrorCodes} from '../../utils/properties/errorCodes';
import {EnvProperties} from '../../utils/properties/env-properties';
@Component({
selector: 'statisticsTab',
template: `
<errorMessages [status]="[fetchPublications.searchUtils.status, fetchDatasets.searchUtils.status,
fetchSoftware.searchUtils.status, fetchOther.searchUtils.status]"
[type]="'statistics'" tab_error_class=true></errorMessages>
<!-- <ng-container *ngIf="(fetchPublications.searchUtils.status == errorCodes.DONE -->
<!-- || fetchDatasets.searchUtils.status == errorCodes.DONE-->
<!-- || fetchSoftware.searchUtils.status == errorCodes.DONE-->
<!-- || fetchOther.searchUtils.status == errorCodes.DONE)">-->
<ng-container *ngIf="fetchPublications.searchUtils.totalResults > 0 || (fetchDatasets.searchUtils.totalResults > 0 ||
fetchSoftware.searchUtils.totalResults > 0 || fetchOther.searchUtils.totalResults > 0)">
<div class="uk-padding uk-padding-remove-top">
<span class="uk-text-bold uk-text-small">Research outcomes Timeline</span>
<i-frame [url]=docsTimelineUrl ></i-frame>
</div>
<div class="uk-padding uk-padding-remove-top">
<span class="uk-text-bold uk-text-small">Research outcomes Types</span>
<i-frame [url]=docsTypesUrl ></i-frame>
</div>
<!-- </ng-container>-->
<!-- <div *ngIf="fetchPublications.searchUtils.totalResults > 0 || (fetchDatasets.searchUtils.totalResults > 0-->
<!-- || fetchSoftware.searchUtils.totalResults > 0 || fetchOther.searchUtils.totalResults > 0)"-->
<div
class="uk-padding uk-padding-remove-top">
<span class="uk-text-bold uk-text-small">Funders in research outcomes of content provider</span>
<i-frame [url]=docsFunderUrl ></i-frame>
</div>
</ng-container>
<div *ngIf="fetchPublications.searchUtils.totalResults > 0 "
class="uk-padding uk-padding-remove-top">
<span class="uk-text-bold uk-text-small">Projects with most Publications</span>
<i-frame [url]=pubsProjectsUrl ></i-frame>
</div>
<div *ngIf="(fetchDatasets.searchUtils.totalResults > 0)"
class="uk-padding uk-padding-remove-top">
<span class="uk-text-bold uk-text-small">Projects with most Research Data</span>
<i-frame [url]=dataProjectsUrl></i-frame>
</div>
`
})
export class StatisticsTabComponent {
@Input() datasourceId;
@Input() fetchPublications : FetchResearchResults;
@Input() fetchDatasets : FetchResearchResults;
@Input() fetchSoftware: FetchResearchResults;
@Input() fetchOther: FetchResearchResults;
private docsTimelineUrl: string;
private docsTypesUrl:string;
private docsFunderUrl:string;
private dataProjectsUrl:string ;
private pubsProjectsUrl:string;
public errorCodes:ErrorCodes = new ErrorCodes();
constructor (private route: ActivatedRoute) {}
ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
var properties = data.envSpecific;
this.docsTimelineUrl =properties.statisticsFrameAPIURL+'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":80, "sort": "xaxis", "xStyle":{"r": -30, "s": "6", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Outcomes"], "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=90%&h=90%';
this.docsTypesUrl = properties.statisticsFrameAPIURL+'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 Outcomes"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=90%&h=90%';
this.docsFunderUrl =properties.statisticsFrameAPIURL+'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 Outcomes"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=90%&h=90%';
this.dataProjectsUrl =properties.statisticsFrameAPIURL+'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=90%&h=90%';
this.pubsProjectsUrl =properties.statisticsFrameAPIURL+'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=90%&h=90%';
});
}
ngOnDestroy() {}
}