Project

General

Profile

1 49720 argiro.kok
import {Component, Input} from '@angular/core';
2
import { SearchDatasetsComponent } from '../../searchPages/simple/searchDatasets.component';
3
import { SearchPublicationsComponent } from '../../searchPages/simple/searchPublications.component';
4
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties';
5
6
@Component({
7
    selector: 'statisticsTab',
8
    template: `
9
    <div *ngIf="show">
10
      <!--div *ngIf="searchPublicationsComponent.searchUtils.status == errorCodes.NONE && DatasetsComponent.searchUtils.status == errorCodes.NONE"
11
            class="uk-alert uk-alert-primary uk-animation-fade" role="alert">No statistics available</div>
12
      <div *ngIf="searchPublicationsComponent.searchUtils.status == errorCodes.ERROR || DatasetsComponent.searchUtils.status == errorCodes.ERROR"
13
            class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
14
      <div *ngIf="searchPublicationsComponent.searchUtils.status == errorCodes.NOT_AVAILABLE || DatasetsComponent.searchUtils.status == errorCodes.NOT_AVAILABLE"
15
            class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
16
      <div *ngIf="searchPublicationsComponent.searchUtils.status == errorCodes.LOADING || DatasetsComponent.searchUtils.status == errorCodes.LOADING"
17
            class="uk-animation-fade  uk-width-1-1" role="alert"><img src="./assets/loading.gif" class="uk-align-center" alt="Loading"></div-->
18
      <errorMessages [status]="[searchPublicationsComponent.searchUtils.status, DatasetsComponent.searchUtils.status]" [type]="'statistics'"></errorMessages>
19
20
      <!--div *ngIf="searchPublicationsComponent.searchUtils.totalResults == 0 && searchDatasetsComponent.searchUtils.totalResults == 0" class = "uk-alert">
21
          No statistics available
22
      </div-->
23
      <div *ngIf="searchPublicationsComponent.searchUtils.totalResults != 0 || searchDatasetsComponent.searchUtils.totalResults != 0">
24
        <p class="uk-text-bold">Latest Documents Timeline</p>
25
        <i-frame  [url]=docsTimelineUrl width="800" height="350"></i-frame>
26
        <p class="uk-text-bold">Documents Types</p>
27
        <i-frame [url]=docsTypesUrl width="800" height="350"></i-frame>
28
      </div>
29
30
31
      <div *ngIf="(searchPublicationsComponent.searchUtils.totalResults > 0)">
32
          <div>
33
            <p class="uk-text-bold">Funders in content providers Publications</p>
34
            <i-frame  [url]=docsFunderUrl width="800" height="350"></i-frame>
35
            <p class="uk-text-bold">Projects with most Publications</p>
36
            <i-frame [url]=pubsProjectsUrl width="800" height="350"></i-frame>
37
38
      </div>
39
      <div *ngIf="(searchDatasetsComponent.searchUtils.totalResults > 0)">
40
          <div>
41
            <p class="uk-text-bold">Projects with most Research Data</p>
42
            <i-frame  [url]=dataProjectsUrl width="800" height="350"></i-frame>
43
44
          </div>
45
      </div>
46
    </div>
47
    </div>
48
    `
49
})
50
51
export class StatisticsTabComponent {
52
53
    @Input() statistics;
54
    @Input() id;
55
    @Input() searchDatasetsComponent : SearchDatasetsComponent;
56
    @Input() searchPublicationsComponent : SearchPublicationsComponent;
57
    @Input() show : boolean = false;
58
59
    private  docsTimelineUrl: string;
60
    private  docsTypesUrl:string;
61
    private  docsFunderUrl:string;
62
    private  dataProjectsUrl:string ;
63
    private  pubsProjectsUrl:string;
64
    public errorCodes:ErrorCodes = new ErrorCodes();
65
66
    constructor () {}
67
68
    ngOnInit() {
69
70
      this.docsTimelineUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcYear","dtsrcName":"'+this.id+'","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": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Documents"], "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';
71
      this.docsTypesUrl = 'https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcPubs","dtsrcName":"'+this.id+'", "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": ["Documents"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
72
      this.docsFunderUrl =' https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcPubsFund","dtsrcName":"'+this.id+'", "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": ["Documents"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
73
      this.dataProjectsUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcProjData","dtsrcName":"'+this.id+'", "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": ["Datasets"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
74
      this.pubsProjectsUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcProjPubs","dtsrcName":"'+this.id+'", "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';
75
    }
76
77
    ngOnDestroy() {}
78
}