diff --git a/src/app/monitor/monitor.component.html b/src/app/monitor/monitor.component.html
index 27dbbec..4ffbb67 100644
--- a/src/app/monitor/monitor.component.html
+++ b/src/app/monitor/monitor.component.html
@@ -31,5 +31,8 @@
diff --git a/src/app/monitor/monitor.component.ts b/src/app/monitor/monitor.component.ts
index c72faff..6099b4f 100644
--- a/src/app/monitor/monitor.component.ts
+++ b/src/app/monitor/monitor.component.ts
@@ -11,7 +11,7 @@ import {ErrorMessagesComponent} from '../openaireLibrary/utils/errorMessages.com
import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
import {StakeholderService} from "../services/stakeholder.service";
-import {Category, Stakeholder, SubCategory, Topic} from "../utils/entities/stakeholder";
+import {Category, Indicator, Stakeholder, SubCategory, Topic} from "../utils/entities/stakeholder";
import {MenuItem, RootMenuItem, SideMenuItem} from "../openaireLibrary/sharedComponents/menu";
@Component({
@@ -30,6 +30,8 @@ export class MonitorComponent {
public sideMenuItems: SideMenuItem[] = null;
public errorCodes: ErrorCodes;
public stakeholder: Stakeholder;
+ public numbers: Indicator[] = [];
+ public charts: Indicator[] = [];
private errorMessages: ErrorMessagesComponent;
properties: EnvProperties;
@@ -115,6 +117,7 @@ export class MonitorComponent {
}
if(this.activeSubCategory) {
this.setSideBar();
+ this.setIndicators();
return;
}
}
@@ -152,6 +155,15 @@ export class MonitorComponent {
});
}
+ private setIndicators() {
+ this.stakeholderService.getIndicators(this.activeSubCategory.numbers).subscribe( numbers => {
+ this.numbers = numbers;
+ });
+ this.stakeholderService.getIndicators(this.activeSubCategory.charts).subscribe( charts => {
+ this.charts = charts;
+ });
+ }
+
public navigateToError() {
this._router.navigate(['/error'],{queryParams: {'page': this._router.url}});
}
diff --git a/src/app/services/stakeholder.service.ts b/src/app/services/stakeholder.service.ts
index bd8a87d..cb6e723 100644
--- a/src/app/services/stakeholder.service.ts
+++ b/src/app/services/stakeholder.service.ts
@@ -1,8 +1,10 @@
import {Injectable} from "@angular/core";
import {HttpClient, HttpErrorResponse} from "@angular/common/http";
import {Observable} from "rxjs";
-import {Stakeholder} from "../utils/entities/stakeholder";
+import {Indicator, Stakeholder} from "../utils/entities/stakeholder";
import {map} from "rxjs/operators";
+import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties";
+import {response} from "express";
@Injectable()
export class StakeholderService {
@@ -26,4 +28,28 @@ export class StakeholderService {
}
}));
}
+
+ getIndicator(id: string): Observable {
+ return this.http.get('./assets/stakeholders.json').pipe(map(json => {
+ return json.indicators.filter(indicator => indicator.id === id)[0];
+ }))
+ }
+
+ getIndicators(ids: string[]): Observable {
+ return this.http.get('./assets/stakeholders.json').pipe(map(json => {
+ return json.indicators.filter(indicator => ids.indexOf(indicator.id) !== -1);
+ }))
+ }
+
+ getNumber(properties: EnvProperties, url: string, jsonPath: string[], stakeholder: Stakeholder): Observable {
+ const statsUrl = url.replace('{index_shortName}', stakeholder.index_shortName).
+ replace('{index_id}', stakeholder.index_id).
+ replace('{index_name}', stakeholder.index_name);
+ return this.http.get(properties.statisticsAPIURL + statsUrl).pipe(map(response => {
+ jsonPath.forEach(field => {
+ response = response[field];
+ });
+ return response;
+ }));
+ }
}
diff --git a/src/app/utils/entities/stakeholder.ts b/src/app/utils/entities/stakeholder.ts
index d503698..cf25c0f 100644
--- a/src/app/utils/entities/stakeholder.ts
+++ b/src/app/utils/entities/stakeholder.ts
@@ -49,7 +49,7 @@ export class Indicator {
tags:string[];
isActive: boolean;
isPublic: boolean;
- urls:IndicatorPath[];
+ indicatorPaths:IndicatorPath[];
}
export class IndicatorPath {
diff --git a/src/assets/stakeholders.json b/src/assets/stakeholders.json
index 7fe1f9d..c248383 100644
--- a/src/assets/stakeholders.json
+++ b/src/assets/stakeholders.json
@@ -235,7 +235,7 @@
"indicatorPaths": [
{
"type": "",
- "url": "/stats-api/funders/{index_shortname}",
+ "url": "/funders/{index_shortName}",
"jsonPath": [
"statistics",
"publications"
@@ -256,7 +256,7 @@
"indicatorPaths": [
{
"type": "",
- "url": "/stats-api/funders/{index_shortname}",
+ "url": "/funders/{index_shortName}",
"jsonPath": [
"statistics",
"open"
@@ -277,7 +277,7 @@
"indicatorPaths": [
{
"type": "",
- "url": "/stats-api/funders/{index_shortname}",
+ "url": "/funders/{index_shortName}",
"jsonPath": [
"statistics",
"embargo"
@@ -303,7 +303,7 @@
},
{
"type": "table",
- "url": "https://www.openaire.eu/stats/gtable.php?com=query&data={%22table%22:%22result%22,%22fields%22:[{%22fld%22:%22number%22,%22agg%22:%22count%22,%22type%22:%22pie%22,%22yaxis%22:1,%22c%22:false}],%22xaxis%22:{%22name%22:%22result_projects-project-title%22,%22agg%22:%22avg%22},%22group%22:%22%22,%22color%22:%22%22,%22type%22:%22chart%22,%22size%22:%2230%22,%22sort%22:%22count-number%22,%22yaxisheaders%22:[%22%22],%22fieldsheaders%22:[%22publications%22],%22in%22:[],%22filters%22:[{%22name%22:%22result_projects-project-funder%22,%22values%22:[%22{index_name}%22],%22to%22:%22-1%22},{%22name%22:%22type%22,%22values%22:[%22publication%22],%22to%22:%22-1%22}],%22having%22:[],%22xStyle%22:{%22r%22:-90,%22s%22:%22-%22,%22l%22:%22-%22,%22ft%22:10,%22wt%22:%22-%22},%22title%22:%22{index_shortname}%20Publications%20by%20project%20(top%2030)%22,%22subtitle%22:%22%22,%22xaxistitle%22:%22project%22,%22order%22:%22d%22}",
+ "url": "https://www.openaire.eu/stats/gtable.php?com=query&data={%22table%22:%22result%22,%22fields%22:[{%22fld%22:%22number%22,%22agg%22:%22count%22,%22type%22:%22pie%22,%22yaxis%22:1,%22c%22:false}],%22xaxis%22:{%22name%22:%22result_projects-project-title%22,%22agg%22:%22avg%22},%22group%22:%22%22,%22color%22:%22%22,%22type%22:%22chart%22,%22size%22:%2230%22,%22sort%22:%22count-number%22,%22yaxisheaders%22:[%22%22],%22fieldsheaders%22:[%22publications%22],%22in%22:[],%22filters%22:[{%22name%22:%22result_projects-project-funder%22,%22values%22:[%22{index_name}%22],%22to%22:%22-1%22},{%22name%22:%22type%22,%22values%22:[%22publication%22],%22to%22:%22-1%22}],%22having%22:[],%22xStyle%22:{%22r%22:-90,%22s%22:%22-%22,%22l%22:%22-%22,%22ft%22:10,%22wt%22:%22-%22},%22title%22:%22{index_shortName}%20Publications%20by%20project%20(top%2030)%22,%22subtitle%22:%22%22,%22xaxistitle%22:%22project%22,%22order%22:%22d%22}",
"jsonPath": []
}
]