diff --git a/src/app/national/national.component.ts b/src/app/national/national.component.ts index 4ef9e3f..b27f7e3 100644 --- a/src/app/national/national.component.ts +++ b/src/app/national/national.component.ts @@ -11,8 +11,6 @@ import {CustomFilterService} from "../openaireLibrary/shared/customFilter.servic import {StakeholderBaseComponent} from "../openaireLibrary/monitor-admin/utils/stakeholder-base.component"; import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service"; import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields"; -import {RouterHelper} from "../openaireLibrary/utils/routerHelper.class"; -import {StringUtils} from "../openaireLibrary/utils/string-utils.class"; import {ConfigurationService} from "../openaireLibrary/utils/configuration/configuration.service"; import {Session} from "../openaireLibrary/login/utils/helper.class"; import {properties as beta} from "../../environments/environment.beta"; @@ -22,49 +20,56 @@ import {UserManagementService} from "../openaireLibrary/services/user-management selector: 'national', template: `
- -
-
-
-
-
-
-

{{entities.country}} {{entities.stakeholder}}

+ +
+
+
+
+
+
+

{{ entities.country }} {{ entities.stakeholder }}

+
+
+ +
+
-
-
- -
-
- -
-
-

- No {{entities.country}} {{entities.stakeholder}} yet. -

+ +
+
+ +
+
+

+ No {{ entities.country }} {{ entities.stakeholder }} yet. +

- ` }) diff --git a/src/app/national/national.module.ts b/src/app/national/national.module.ts index d229aa0..ce80496 100644 --- a/src/app/national/national.module.ts +++ b/src/app/national/national.module.ts @@ -8,6 +8,7 @@ import {IconsModule} from "../openaireLibrary/utils/icons/icons.module"; import {IconsService} from "../openaireLibrary/utils/icons/icons.service"; import {open_access} from "../openaireLibrary/utils/icons/icons"; import {SandboxGuard} from "../shared/sandbox.guard"; +import {OaIndicatorModule} from "../shared/oa-indicator/oa-indicator.module"; const routes: Route[] = [ { @@ -19,7 +20,7 @@ const routes: Route[] = [ ]; @NgModule({ - imports: [CommonModule, RouterModule.forChild(routes), LoadingModule, RoleVerificationModule, IconsModule], + imports: [CommonModule, RouterModule.forChild(routes), LoadingModule, RoleVerificationModule, IconsModule, OaIndicatorModule], declarations: [NationalComponent], exports: [NationalComponent], }) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 4231b65..fb34dd4 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 4231b65880df19494dbde5ecbbbc17af63f9ca9b +Subproject commit fb34dd415e3b9eaf6149d930c378b60e7975c110 diff --git a/src/app/repository/repository.component.ts b/src/app/repository/repository.component.ts index e97da93..154714e 100644 --- a/src/app/repository/repository.component.ts +++ b/src/app/repository/repository.component.ts @@ -24,88 +24,112 @@ import {properties as beta} from "../../environments/environment.beta"; template: `
-
-
-
-
-
-
-
- - - OpenAIRE placeholder logo - -
-
-
{{stakeholder.name}}
- -
- - -
-
- -
- Website URL: - +
+
+
+ - -
+
+ +
+
+

{{ entities.datasources }}

-
-

{{entities.datasources}}

-
-
- -
- -
- +
+ +
+
` }) diff --git a/src/app/repository/repository.module.ts b/src/app/repository/repository.module.ts index 57ea18b..1ec962c 100644 --- a/src/app/repository/repository.module.ts +++ b/src/app/repository/repository.module.ts @@ -11,6 +11,7 @@ import {IconsService} from "../openaireLibrary/utils/icons/icons.service"; import {open_access} from "../openaireLibrary/utils/icons/icons"; import {LogoUrlPipeModule} from "../openaireLibrary/utils/pipes/logoUrlPipe.module"; import {SandboxGuard} from "../shared/sandbox.guard"; +import {OaIndicatorModule} from "../shared/oa-indicator/oa-indicator.module"; const routes: Route[] = [ { @@ -23,7 +24,7 @@ const routes: Route[] = [ ]; @NgModule({ - imports: [CommonModule, RouterModule.forChild(routes), LoadingModule, RoleVerificationModule, IconsModule, EntityMetadataModule, LogoUrlPipeModule], + imports: [CommonModule, RouterModule.forChild(routes), LoadingModule, RoleVerificationModule, IconsModule, EntityMetadataModule, LogoUrlPipeModule, OaIndicatorModule], declarations: [RepositoryComponent], providers: [SearchDataprovidersService], exports: [RepositoryComponent], diff --git a/src/app/researcher/researcher.component.ts b/src/app/researcher/researcher.component.ts index 3310e76..f1d49a7 100644 --- a/src/app/researcher/researcher.component.ts +++ b/src/app/researcher/researcher.component.ts @@ -46,12 +46,8 @@ import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields
-
-
-
- - Open Access -
+
+
@@ -85,7 +81,6 @@ import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields }) export class ResearcherComponent extends ResearcherBaseComponent implements OnInit { totalResults: number; - openResults: number; loading: boolean = false; stakeholder; isSearch: boolean = false; @@ -149,9 +144,6 @@ export class ResearcherComponent extends ResearcherBaseComponent implements OnI this.stakeholder = stakeholder; })); - this.subscriptions.push(this._searchResearchResultsService.numOfResearchOutcomes(this.param + ' and (resultbestaccessright exact "Open Access") and (peerreviewed exact "true")', properties, null).subscribe(res => { - this.openResults = +res; - })); } } } @@ -178,9 +170,4 @@ export class ResearcherComponent extends ResearcherBaseComponent implements OnI this.layoutService.setRootClass(null); LinksResolver.resetProperties(); } - - getPercentage(){ - let num = (this.openResults/this.totalResults)*100; - return num == 100?100:num.toPrecision(2); - } } diff --git a/src/app/researcher/researcher.module.ts b/src/app/researcher/researcher.module.ts index 9870f2a..d2d090f 100644 --- a/src/app/researcher/researcher.module.ts +++ b/src/app/researcher/researcher.module.ts @@ -9,6 +9,7 @@ import {IconsModule} from '../openaireLibrary/utils/icons/icons.module'; import {IconsService} from '../openaireLibrary/utils/icons/icons.service'; import {open_access} from '../openaireLibrary/utils/icons/icons'; import {SandboxGuard} from "../shared/sandbox.guard"; +import {OaIndicatorModule} from "../shared/oa-indicator/oa-indicator.module"; const routes: Route[] = [ { @@ -22,7 +23,7 @@ const routes: Route[] = [ ]; @NgModule({ - imports: [CommonModule, RouterModule.forChild(routes), SearchOrcidServiceModule, SearchResearchResultsServiceModule, LoadingModule, IconsModule], + imports: [CommonModule, RouterModule.forChild(routes), SearchOrcidServiceModule, SearchResearchResultsServiceModule, LoadingModule, IconsModule, OaIndicatorModule], declarations: [ResearcherComponent], exports: [ResearcherComponent], }) diff --git a/src/app/rfo/rfo.component.ts b/src/app/rfo/rfo.component.ts index 5da1c71..b391997 100644 --- a/src/app/rfo/rfo.component.ts +++ b/src/app/rfo/rfo.component.ts @@ -25,26 +25,37 @@ import {properties as beta} from "../../environments/environment.beta";
-
-
-
-
- - - OpenAIRE placeholder logo - +
+
+
+
+ + + OpenAIRE placeholder logo + +
+ +
-
- -

{{stakeholder.name}}

+
+
-
-
-

Research Funding Organisations ({{entities.funders}})

+

Research Funding Organisations + ({{ entities.funders }})

- ` }) diff --git a/src/app/rfo/rfo.module.ts b/src/app/rfo/rfo.module.ts index 728c823..1dd8dc8 100644 --- a/src/app/rfo/rfo.module.ts +++ b/src/app/rfo/rfo.module.ts @@ -9,6 +9,7 @@ import {LogoUrlPipeModule} from "../openaireLibrary/utils/pipes/logoUrlPipe.modu import {IconsService} from "../openaireLibrary/utils/icons/icons.service"; import {open_access} from "../openaireLibrary/utils/icons/icons"; import {SandboxGuard} from "../shared/sandbox.guard"; +import {OaIndicatorModule} from "../shared/oa-indicator/oa-indicator.module"; const routes: Route[] = [ { @@ -21,7 +22,7 @@ const routes: Route[] = [ ]; @NgModule({ - imports: [CommonModule, RouterModule.forChild(routes), LoadingModule, RoleVerificationModule, IconsModule, LogoUrlPipeModule], + imports: [CommonModule, RouterModule.forChild(routes), LoadingModule, RoleVerificationModule, IconsModule, LogoUrlPipeModule, OaIndicatorModule], declarations: [RfoComponent], exports: [RfoComponent], }) diff --git a/src/app/rpo/rpo.component.ts b/src/app/rpo/rpo.component.ts index 2266a0e..5d91c54 100644 --- a/src/app/rpo/rpo.component.ts +++ b/src/app/rpo/rpo.component.ts @@ -43,6 +43,9 @@ import {UserManagementService} from "../openaireLibrary/services/user-management
+
+ +

Research Performing Organisations ({{entities.organizations}})

diff --git a/src/app/rpo/rpo.module.ts b/src/app/rpo/rpo.module.ts index a8fc9d8..1e228eb 100644 --- a/src/app/rpo/rpo.module.ts +++ b/src/app/rpo/rpo.module.ts @@ -9,6 +9,7 @@ import {LogoUrlPipeModule} from "../openaireLibrary/utils/pipes/logoUrlPipe.modu import {IconsService} from "../openaireLibrary/utils/icons/icons.service"; import {open_access} from "../openaireLibrary/utils/icons/icons"; import {SandboxGuard} from "../shared/sandbox.guard"; +import {OaIndicatorModule} from "../shared/oa-indicator/oa-indicator.module"; const routes: Route[] = [ { @@ -21,7 +22,7 @@ const routes: Route[] = [ ]; @NgModule({ - imports: [CommonModule, RouterModule.forChild(routes), LoadingModule, RoleVerificationModule, IconsModule, LogoUrlPipeModule], + imports: [CommonModule, RouterModule.forChild(routes), LoadingModule, RoleVerificationModule, IconsModule, LogoUrlPipeModule, OaIndicatorModule], declarations: [RpoComponent], exports: [RpoComponent], }) diff --git a/src/app/shared/irish.ts b/src/app/shared/irish.ts index 51e8c4f..fa6ad58 100644 --- a/src/app/shared/irish.ts +++ b/src/app/shared/irish.ts @@ -2,7 +2,7 @@ import {Portal} from "../openaireLibrary/utils/entities/adminTool/portal"; import {StakeholderConfiguration} from "../openaireLibrary/monitor-admin/utils/indicator-utils"; import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service"; import {Role} from "../openaireLibrary/login/utils/helper.class"; -import {Stakeholder} from "../openaireLibrary/monitor/entities/stakeholder"; +import {IndicatorPath, Stakeholder} from "../openaireLibrary/monitor/entities/stakeholder"; import {LinksResolver} from "../search/links-resolver"; export class Irish { @@ -10,7 +10,7 @@ export class Irish { public static irishAdminToolsCommunity = "irish"; public static METADATA_PREFIX = ''; - public portal: Portal = Portal.getMockCommunityInfo("noami", "Noami",['service'],['/search/advanced/services', '/search/find/services']); + public portal: Portal = Portal.getMockCommunityInfo("noami", "Noami", ['service'], ['/search/advanced/services', '/search/find/services']); constructor() { LinksResolver.resetProperties(); @@ -19,9 +19,9 @@ export class Irish { StakeholderConfiguration.ROLES.member = 'manager'; StakeholderConfiguration.ENTITIES.stakeholder = 'Monitor'; - StakeholderConfiguration.ENTITIES.stakeholders = 'Monitors'; - StakeholderConfiguration.ENTITIES.funder = 'RFO'; - StakeholderConfiguration.ENTITIES.funders = 'RFOs'; + StakeholderConfiguration.ENTITIES.stakeholders = 'Monitors'; + StakeholderConfiguration.ENTITIES.funder = 'RFO'; + StakeholderConfiguration.ENTITIES.funders = 'RFOs'; StakeholderConfiguration.ENTITIES.organization = 'RPO'; StakeholderConfiguration.ENTITIES.organizations = 'RPOs'; StakeholderConfiguration.ENTITIES.datasource = 'Repository'; @@ -36,13 +36,12 @@ export class Irish { {value: 'country', label: StakeholderConfiguration.ENTITIES.country}, {value: 'datasource', label: StakeholderConfiguration.ENTITIES.datasource}, {value: 'researcher', label: StakeholderConfiguration.ENTITIES.researcher} - ]; StakeholderConfiguration.FUNDER_TYPES = [ - {value: null, label: 'None'}, - {value: 'private', label: 'Private'}, - {value: 'government', label: 'Government'} + {value: null, label: 'None'}, + {value: 'private', label: 'Private'}, + {value: 'government', label: 'Government'} ]; StakeholderConfiguration.VISIBILITIES = [ @@ -54,10 +53,40 @@ export class Irish { LayoutService.HEADER_HEIGHT = '60px'; Role.GROUP = 'irish.'; + + /** OA Indicator */ + Irish.initializeOAIndicators(); } + public static initializeOAIndicators(): void { + StakeholderConfiguration.openAccess.set('country', { + numerator: {"type": null, "format": "NUMBER", "source": "stats-tool", "url": "raw?json=", "jsonPath": ["data", "0", "0", "0"], "chartObject": "{\"verbose\":false,\"series\":[{\"query\":{\"parameters\":[],\"select\":[{\"field\":\"publication\",\"aggregate\":\"count\"}],\"filters\":[{\"groupFilters\":[{\"field\":\"publication.indi_result_oa_with_license.oa_with_license\",\"type\":\"=\",\"values\":[\"1\"]},{\"field\":\"publication.result_refereed.refereed\",\"type\":\"=\",\"values\":[\"peerReviewed\"]}],\"op\":\"AND\"}],\"entity\":\"publication\",\"profile\":\"ie_monitor\",\"limit\":\"30\"}}]}", "parameters": {}, "filters": {}, "filtersApplied": 0}, + denominator: {"type": null, "format": "NUMBER", "source": "stats-tool", "url": "raw?json=", "jsonPath": ["data", "0", "0", "0"], "chartObject": "{\"verbose\":false,\"series\":[{\"query\":{\"parameters\":[],\"select\":[{\"field\":\"publication\",\"aggregate\":\"count\"}],\"filters\":[{\"groupFilters\":[{\"field\":\"publication.result_refereed.refereed\",\"type\":\"=\",\"values\":[\"peerReviewed\"]}],\"op\":\"AND\"}],\"entity\":\"publication\",\"profile\":\"ie_monitor\",\"limit\":\"30\"}}]}", "parameters": {}, "filters": {}, "filtersApplied": 0} + }); + StakeholderConfiguration.openAccess.set('organization', { + numerator: {"type": null, "format": "NUMBER", "source": "stats-tool", "url": "raw?json=", "jsonPath": ["data", "0", "0", "0"], "chartObject": "{\"verbose\":false,\"series\":[{\"query\":{\"parameters\":[],\"select\":[{\"field\":\"publication\",\"aggregate\":\"count\"}],\"filters\":[{\"groupFilters\":[{\"field\":\"publication.organization.id\",\"type\":\"=\",\"values\":[\"((__index_id__))\"]},{\"field\":\"publication.result_refereed.refereed\",\"type\":\"=\",\"values\":[\"peerReviewed\"]},{\"field\":\"publication.indi_result_oa_with_license.oa_with_license\",\"type\":\"=\",\"values\":[\"1\"]}],\"op\":\"AND\"}],\"entity\":\"publication\",\"profile\":\"((__profile__))\",\"limit\":\"30\"}}]}", "parameters": {}, "filters": {}, "filtersApplied": 0}, + denominator: {"type": null, "format": "NUMBER", "source": "stats-tool", "url": "raw?json=", "jsonPath": ["data", "0", "0", "0"], "chartObject": "{\"verbose\":false,\"series\":[{\"query\":{\"parameters\":[],\"select\":[{\"field\":\"publication\",\"aggregate\":\"count\"}],\"filters\":[{\"groupFilters\":[{\"field\":\"publication.organization.id\",\"type\":\"=\",\"values\":[\"((__index_id__))\"]},{\"field\":\"publication.result_refereed.refereed\",\"type\":\"=\",\"values\":[\"peerReviewed\"]}],\"op\":\"AND\"}],\"entity\":\"publication\",\"profile\":\"((__profile__))\",\"limit\":\"30\"}}]}", "parameters": {}, "filters": {}, "filtersApplied": 0} + }); + StakeholderConfiguration.openAccess.set('funder', { + numerator: {"type": null, "format": "NUMBER", "source": "stats-tool", "url": "raw?json=", "jsonPath": ["data", "0", "0", "0"], "chartObject": "{\"verbose\":false,\"series\":[{\"query\":{\"parameters\":[],\"select\":[{\"field\":\"publication\",\"aggregate\":\"count\"}],\"filters\":[{\"groupFilters\":[{\"field\":\"publication.project.funder.id\",\"type\":\"=\",\"values\":[\"((__index_id__))\"]},{\"field\":\"publication.indi_result_oa_with_license.oa_with_license\",\"type\":\"=\",\"values\":[\"1\"]}],\"op\":\"AND\"}],\"entity\":\"publication\",\"profile\":\"((__profile__))\",\"limit\":\"30\"}}]}", "parameters": {}, "filters": {}, "filtersApplied": 0}, + denominator: {"type": null, "format": "NUMBER", "source": "stats-tool", "url": "raw?json=", "jsonPath": ["data", "0", "0", "0"], "chartObject": "{\"verbose\":false,\"series\":[{\"query\":{\"parameters\":[],\"select\":[{\"field\":\"publication\",\"aggregate\":\"count\"}],\"filters\":[{\"groupFilters\":[{\"field\":\"publication.project.funder.id\",\"type\":\"=\",\"values\":[\"((__index_id__))\"]},{\"field\":\"publication.result_refereed.refereed\",\"type\":\"=\",\"values\":[\"peerReviewed\"]}],\"op\":\"AND\"}],\"entity\":\"publication\",\"profile\":\"((__profile__))\",\"limit\":\"30\"}}]}", "parameters": {}, "filters": {}, "filtersApplied": 0} + }); + StakeholderConfiguration.openAccess.set('researcher', { + numerator: {"type": null, "format": "NUMBER", "source": "stats-tool", "url": "raw?json=", "jsonPath": ["data", "0", "0", "0"], "chartObject": "{\"verbose\":false,\"series\":[{\"query\":{\"parameters\":[],\"select\":[{\"field\":\"publication\",\"aggregate\":\"count\"}],\"filters\":[{\"groupFilters\":[{\"field\":\"publication.result_orcid.orcid\",\"type\":\"=\",\"values\":[\"((__index_id__))\"]},{\"field\":\"publication.result_refereed.refereed\",\"type\":\"=\",\"values\":[\"peerReviewed\"]},{\"field\":\"publication.indi_result_oa_with_license.oa_with_license\",\"type\":\"=\",\"values\":[\"1\"]}],\"op\":\"AND\"}],\"entity\":\"publication\",\"profile\":\"((__profile__))\",\"limit\":\"30\"}}]}", "parameters": {"statsProfile": "openaire_stats"}, "filters": {}, "filtersApplied": 0}, + denominator: {"type": null, "format": "NUMBER", "source": "stats-tool", "url": "raw?json=", "jsonPath": ["data", "0", "0", "0"], "chartObject": "{\"verbose\":false,\"series\":[{\"query\":{\"parameters\":[],\"select\":[{\"field\":\"publication\",\"aggregate\":\"count\"}],\"filters\":[{\"groupFilters\":[{\"field\":\"publication.result_orcid.orcid\",\"type\":\"=\",\"values\":[\"((__index_id__))\"]},{\"field\":\"publication.result_refereed.refereed\",\"type\":\"=\",\"values\":[\"peerReviewed\"]}],\"op\":\"AND\"}],\"entity\":\"publication\",\"profile\":\"((__profile__))\",\"limit\":\"30\"}}]}", "parameters": {"statsProfile": "openaire_stats"}, "filters": {}, "filtersApplied": 0} + }); + StakeholderConfiguration.openAccess.set('datasource', { + numerator: {"type": null, "format": "NUMBER", "source": "stats-tool", "url": "raw?json=", "jsonPath": ["data", "0", "0", "0"], "chartObject": "{\"verbose\":false,\"series\":[{\"query\":{\"parameters\":[],\"select\":[{\"field\":\"publication\",\"aggregate\":\"count\"}],\"filters\":[{\"groupFilters\":[{\"field\":\"publication.datasource.id\",\"type\":\"=\",\"values\":[\"((__index_id__))\"]},{\"field\":\"publication.result_refereed.refereed\",\"type\":\"=\",\"values\":[\"peerReviewed\"]},{\"field\":\"publication.indi_result_oa_with_license.oa_with_license\",\"type\":\"=\",\"values\":[\"1\"]}],\"op\":\"AND\"}],\"entity\":\"publication\",\"profile\":\"((__profile__))\",\"limit\":\"30\"}}]}", "parameters": {}, "filters": {}, "filtersApplied": 0}, + denominator: {"type": null, "format": "NUMBER", "source": "stats-tool", "url": "raw?json=", "jsonPath": ["data", "0", "0", "0"], "chartObject": "{\"verbose\":false,\"series\":[{\"query\":{\"parameters\":[],\"select\":[{\"field\":\"publication\",\"aggregate\":\"count\"}],\"filters\":[{\"groupFilters\":[{\"field\":\"publication.datasource.id\",\"type\":\"=\",\"values\":[\"((__index_id__))\"]},{\"field\":\"publication.result_refereed.refereed\",\"type\":\"=\",\"values\":[\"peerReviewed\"]}],\"op\":\"AND\"}],\"entity\":\"publication\",\"profile\":\"((__profile__))\",\"limit\":\"30\"}}]}", "parameters": {}, "filters": {}, "filtersApplied": 0} + }); + } } export class StakeholderPublication extends Stakeholder { publications: number; } + +export interface OAIndicator { + numerator: IndicatorPath; + denominator: IndicatorPath; +} diff --git a/src/app/shared/oa-indicator/oa-indicator.component.ts b/src/app/shared/oa-indicator/oa-indicator.component.ts new file mode 100644 index 0000000..b632559 --- /dev/null +++ b/src/app/shared/oa-indicator/oa-indicator.component.ts @@ -0,0 +1,66 @@ +import {Component, Input, OnInit} from "@angular/core"; +import {Stakeholder} from "../../openaireLibrary/monitor/entities/stakeholder"; +import {StatisticsService} from "../../openaireLibrary/monitor-admin/utils/services/statistics.service"; +import {IndicatorStakeholderBaseComponent} from "../../openaireLibrary/monitor-admin/utils/stakeholder-base.component"; +import {OAIndicator} from "../irish"; +import {zip} from "rxjs"; + +@Component({ + selector: "oa-indicator", + template: ` + +
+
+ + Open Access +
+
+ ` +}) +export class OaIndicatorComponent extends IndicatorStakeholderBaseComponent implements OnInit { + @Input() + public stakeholder: Stakeholder; + public percentage: number = 0; + + constructor(private statisticsService: StatisticsService) { + super(); + } + + ngOnInit(): void { + this.initPercentage(); + } + + public initPercentage(): void { + let OAIndicator: OAIndicator = this.stakeholderUtils.openAccess.get(this.stakeholder.type); + if(OAIndicator) { + this.subscriptions.push(zip( + this.statisticsService.getNumbers(this.indicatorUtils.getSourceType(OAIndicator.numerator.source), this.indicatorUtils.getFullUrl(this.stakeholder, OAIndicator.numerator)), + this.statisticsService.getNumbers(this.indicatorUtils.getSourceType(OAIndicator.denominator.source), this.indicatorUtils.getFullUrl(this.stakeholder, OAIndicator.denominator))).subscribe(res => { + let numerator = this.calculate(res[0], OAIndicator.numerator.jsonPath); + let denominator = this.calculate(res[1], OAIndicator.denominator.jsonPath); + if (denominator > 0) { + this.percentage = Math.round(numerator * 100 / denominator); + } + })); + } + } + + public calculate(response: any, jsonPath: string[]) { + let result = JSON.parse(JSON.stringify(response)); + jsonPath.forEach(path => { + if (result) { + result = result[path]; + } + }); + if (typeof result === 'string' || typeof result === 'number') { + result = Number(result); + if (result === Number.NaN) { + result = 0; + } + } else { + result = 0; + } + return result; + } +} diff --git a/src/app/shared/oa-indicator/oa-indicator.module.ts b/src/app/shared/oa-indicator/oa-indicator.module.ts new file mode 100644 index 0000000..458c3db --- /dev/null +++ b/src/app/shared/oa-indicator/oa-indicator.module.ts @@ -0,0 +1,11 @@ +import {NgModule} from "@angular/core"; +import {CommonModule} from "@angular/common"; +import {OaIndicatorComponent} from "./oa-indicator.component"; +import {IconsModule} from "../../openaireLibrary/utils/icons/icons.module"; + +@NgModule({ + declarations: [OaIndicatorComponent], + imports: [CommonModule, IconsModule], + exports: [OaIndicatorComponent] +}) +export class OaIndicatorModule {}