diff --git a/landingPages/dataProvider/dataProvider.component.html b/landingPages/dataProvider/dataProvider.component.html index 2bd0a011..c1084fa7 100644 --- a/landingPages/dataProvider/dataProvider.component.html +++ b/landingPages/dataProvider/dataProvider.component.html @@ -79,7 +79,7 @@ - + Share @@ -90,93 +90,121 @@
- - - -
-
- - - - - -
-
- - - - - - - - - + + +
- {{country}} + + + + +
- - - -
- Thematic
-
-
--> - - - - - -
- + + + + + + + + + + + + + + +
+ +
+
+
+
+
+
+
+
+
+
+
+
Downloads
+
Views
+
+
+
{{totalDownloads | number}}
+
{{totalViews | number}}
+
+
+
+
+ Metrics badge +
+
+
@@ -220,6 +248,9 @@ || fetchSoftware.searchUtils.totalResults > 0 || fetchOrps.searchUtils.totalResults > 0)" [tabTitle]="'Related '+openaireEntities.DATASOURCES" [tabId]="'relatedDatasources'"> + + @@ -436,6 +467,93 @@ + + +
+ +
    + +
  • +
    +
    +
    +
    + OpenAIRE UsageCounts +
    + Usage by + UsageCounts +
    +
    + + + + + + + + + + + + + +
    + + + Downloads + + {{totalDownloads | number}} +
    + + + Views + + {{totalViews | number}} +
    +
    +
    +
    +
  • + +
  • +
    +
    +
    +
    {{formatNumber(totalDownloads)}}
    +
    Downloads
    +
    +
    +
    {{formatNumber(totalViews)}}
    +
    Views
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    + Powered by + OpenAIRE UsageCounts +
    +
  • +
+
+
diff --git a/landingPages/dataProvider/dataProvider.component.ts b/landingPages/dataProvider/dataProvider.component.ts index c5df0b83..b11ba7c4 100644 --- a/landingPages/dataProvider/dataProvider.component.ts +++ b/landingPages/dataProvider/dataProvider.component.ts @@ -25,9 +25,11 @@ import {SearchResult} from "../../utils/entities/searchResult"; import {ResultPreview} from "../../utils/result-preview/result-preview"; import {IndexInfoService} from "../../utils/indexInfo.service"; import {properties} from "../../../../environments/environment"; -import {Subscriber} from "rxjs"; +import {Subscriber, Subscription, zip} from "rxjs"; import {TabComponent} from "../../utils/tabs/tab.component"; import {OpenaireEntities} from "../../utils/properties/searchFields"; +import {MetricsService} from '../../services/metrics.service'; +import {NumberUtils} from '../../utils/number-utils.class'; declare var ResizeObserver; @@ -63,7 +65,7 @@ export class DataProviderComponent { public downloadsFrameUrl: string; public totalViews: number; public totalDownloads: number; - public pageViews: number; + // public pageViews: number; // Statistics tab variables public statsClicked: boolean = false; @@ -141,6 +143,7 @@ export class DataProviderComponent { // public shouldSticky: boolean = true; subscriptions = []; + private sub: Subscription; properties: EnvProperties = properties; public openaireEntities = OpenaireEntities; @@ -157,6 +160,7 @@ export class DataProviderComponent { private helper: HelperService, private _location: Location, private indexInfoService: IndexInfoService, + private metricsService: MetricsService, private cdr: ChangeDetectorRef) { this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService); this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService); @@ -210,6 +214,7 @@ export class DataProviderComponent { } }); } + this.getMetrics(); })); } @@ -665,11 +670,23 @@ export class DataProviderComponent { public metricsResults($event) { this.totalViews = $event.totalViews; this.totalDownloads = $event.totalDownloads; - this.pageViews = $event.pageViews; + // this.pageViews = $event.pageViews; } + private getMetrics() { + let obs; + obs = zip(this.metricsService.getMetricsNumber(this.datasourceId, "usagestats.views.repository.local", this.properties), + this.metricsService.getMetricsNumber(this.datasourceId, "usagestats.downloads.repository.local", this.properties)); + this.sub = obs.subscribe(data => { + console.log(data); + this.totalViews = data[0]; + this.totalDownloads = data[1]; + this.cdr.detectChanges(); + }); + } + public get hasMetrics(): boolean { - return !(this.totalViews != null && this.totalDownloads != null && this.pageViews != null) || this.totalViews > 0 || this.totalDownloads > 0 || this.pageViews > 0; + return !(this.totalViews != null && this.totalDownloads != null) || this.totalViews > 0 || this.totalDownloads > 0; } // public openStatistics() { @@ -827,4 +844,15 @@ export class DataProviderComponent { this.descriptionModal.alertTitle = "Description"; this.descriptionModal.open(); } + + public clickedUsageMetrics() { + setTimeout( () => { + this.metricsClicked = true; + }); + } + + public formatNumber(num: number | string) { + let formatted = NumberUtils.roundNumber(+num); + return formatted.number + formatted.size; + } } diff --git a/landingPages/landing-utils/availableOn.component.ts b/landingPages/landing-utils/availableOn.component.ts index 7a7c182c..edab04cb 100644 --- a/landingPages/landing-utils/availableOn.component.ts +++ b/landingPages/landing-utils/availableOn.component.ts @@ -11,9 +11,9 @@ declare var UIkit;
- - + {{sliceString(availableOn[0].downloadNames.join("; "), 20)}} @@ -24,9 +24,9 @@ declare var UIkit;
- - +
@@ -63,7 +63,7 @@ declare var UIkit; - - + *ngIf="(openAccessMandatePublications != undefined && openAccessMandatePublications) || (openAccessMandateDatasets != undefined && openAccessMandateDatasets)"> + + @@ -38,25 +38,25 @@ import {OpenaireEntities} from "src/app/openaireLibrary/utils/properties/searchF + [flex]="true" [ratio]="0.8"> + [flex]="true" [ratio]="0.8"> + type="outlined" [flex]="true" [ratio]="0.8"> + [flex]="true" [ratio]="0.8"> + [flex]="true" [ratio]="0.8"> + [flex]="true" [ratio]="0.8"> + [flex]="true" [ratio]="0.8"> {{entityType}} - + {{removeUnknown(types, true).join(' , ')}} @@ -120,8 +120,7 @@ import {OpenaireEntities} from "src/app/openaireLibrary/utils/properties/searchF - - + diff --git a/landingPages/landing-utils/landing-header/landing-header.module.ts b/landingPages/landing-utils/landing-header/landing-header.module.ts index 069a17b5..6ae684c9 100644 --- a/landingPages/landing-utils/landing-header/landing-header.module.ts +++ b/landingPages/landing-utils/landing-header/landing-header.module.ts @@ -5,9 +5,10 @@ import {LandingModule} from "../landing.module"; import {ShowAuthorsModule} from "../../../utils/authors/showAuthors.module"; import {IconsModule} from "src/app/openaireLibrary/utils/icons/icons.module"; import {ShowPublisherModule} from "../showPublisher.module"; +import {RouterModule} from "@angular/router"; @NgModule({ - imports: [CommonModule, LandingModule, ShowAuthorsModule, IconsModule, ShowPublisherModule], + imports: [CommonModule, LandingModule, ShowAuthorsModule, IconsModule, ShowPublisherModule, RouterModule], declarations: [LandingHeaderComponent], exports: [LandingHeaderComponent] }) diff --git a/landingPages/project/project.component.html b/landingPages/project/project.component.html index 265c6b80..47104db2 100644 --- a/landingPages/project/project.component.html +++ b/landingPages/project/project.component.html @@ -152,7 +152,7 @@
-
+
-
- +
+ Metrics badge +
+
@@ -386,6 +384,9 @@ [tabTitle]="openaireEntities.OTHER" [tabNumber]="fetchOrps.searchUtils.totalResults" [tabId]="'other'"> + + @@ -500,6 +501,92 @@
+ +
+ +
    + +
  • +
    +
    +
    +
    + OpenAIRE UsageCounts +
    + Usage by + UsageCounts +
    +
    + + + + + + + + + + + + + +
    + + + Downloads + + {{totalDownloads | number}} +
    + + + Views + + {{totalViews | number}} +
    +
    +
    +
    +
  • + +
  • +
    +
    +
    +
    {{formatNumber(totalDownloads)}}
    +
    Downloads
    +
    +
    +
    {{formatNumber(totalViews)}}
    +
    Views
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    + Powered by + OpenAIRE UsageCounts +
    +
  • +
+
+
diff --git a/landingPages/project/project.component.ts b/landingPages/project/project.component.ts index 56622846..d3fc955b 100644 --- a/landingPages/project/project.component.ts +++ b/landingPages/project/project.component.ts @@ -25,10 +25,12 @@ import {StringUtils} from "../../utils/string-utils.class"; import {ResultPreview} from "../../utils/result-preview/result-preview"; import {SearchResult} from "../../utils/entities/searchResult"; import {IndexInfoService} from "../../utils/indexInfo.service"; -import {Subscriber} from "rxjs"; +import {Subscriber, zip, Subscription} from "rxjs"; import {properties} from "../../../../environments/environment"; import {Option} from "../../sharedComponents/input/input.component"; import {OpenaireEntities} from "../../utils/properties/searchFields"; +import {MetricsService} from '../../services/metrics.service'; +import {NumberUtils} from '../../utils/number-utils.class'; declare var ResizeObserver; @@ -50,7 +52,7 @@ export class ProjectComponent { public downloadsFrameUrl: string; public totalViews: number; public totalDownloads: number; - public pageViews: number; + // public pageViews: number; // Statistics tab variables public statsClicked: boolean; @@ -160,6 +162,7 @@ export class ProjectComponent { // public shouldSticky: boolean = true; subscriptions = []; + private sub: Subscription; properties: EnvProperties; public openaireEntities = OpenaireEntities; @@ -176,6 +179,7 @@ export class ProjectComponent { private _reportsService: ReportsService, private htmlService: HtmlProjectReportService, private indexInfoService: IndexInfoService, + private metricsService: MetricsService, private cdr: ChangeDetectorRef) {} ngOnInit() { @@ -230,6 +234,8 @@ export class ProjectComponent { this.downloadURLAPI = this.properties.csvAPIURL; this.createClipboard(); + + this.getMetrics(); })); } @@ -552,11 +558,22 @@ export class ProjectComponent { public metricsResults($event) { this.totalViews = $event.totalViews; this.totalDownloads = $event.totalDownloads; - this.pageViews = $event.pageViews; + // this.pageViews = $event.pageViews; } + private getMetrics() { + let obs; + obs = zip(this.metricsService.getMetricsNumber(this.projectId, "usagestats.projects.views", this.properties), + this.metricsService.getMetricsNumber(this.projectId, "usagestats.projects.downloads", this.properties)); + this.sub = obs.subscribe(data => { + this.totalViews = data[0]; + this.totalDownloads = data[1]; + this.cdr.detectChanges(); + }); + } + public get hasMetrics(): boolean { - return !(this.totalViews != null && this.totalDownloads != null && this.pageViews != null) || this.totalViews > 0 || this.totalDownloads > 0||this.pageViews > 0; + return !(this.totalViews != null && this.totalDownloads != null) || this.totalViews > 0 || this.totalDownloads > 0; } public viewAllOrganizationsClick() { @@ -961,4 +978,15 @@ export class ProjectComponent { this.descriptionModal.alertTitle = "Description"; this.descriptionModal.open(); } + + public clickedUsageMetrics() { + setTimeout( () => { + this.metricsClicked = true; + }); + } + + public formatNumber(num: number | string) { + let formatted = NumberUtils.roundNumber(+num); + return formatted.number + formatted.size; + } } diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index e336fcdd..1fd5e19a 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -115,7 +115,7 @@ - + View all {{resultLandingInfo.deletedByInferenceIds.length}} versions @@ -127,17 +127,17 @@ [queryParams]="routerHelper.createQueryParams(['id','type','linkTo'],[id,type,'project'])" routerLinkActive="router-link-active" routerLink="/participate/direct-claim" class="uk-flex uk-flex-middle uk-flex-center uk-button-link uk-text-bolder"> - + Link to - + Share - + Cite @@ -464,14 +464,14 @@ Social
  • - Usage + Usage
    • -
      +
      @@ -486,18 +486,18 @@ - + Citations - {{resultLandingInfo.measure.citations}} + {{resultLandingInfo.measure.citations | number}} - + Popularity @@ -508,7 +508,7 @@ - + Influence @@ -519,7 +519,7 @@ - + Impulse @@ -533,10 +533,10 @@
      -
      +
      -
      +
      @@ -548,26 +548,26 @@
      - + - + @@ -585,7 +585,7 @@
      - + Downloads - {{resultLandingInfo.measure.downloads}} + {{resultLandingInfo.measure.downloads | number}}
      - + Views - {{resultLandingInfo.measure.views}} + {{resultLandingInfo.measure.views | number}}
      - + Citations @@ -596,7 +596,7 @@
      - + Popularity @@ -607,7 +607,7 @@
      - + Influence @@ -618,7 +618,7 @@
      - + Impulse @@ -630,12 +630,12 @@
      -
      - +
      -
      +
      Powered by BIP! @@ -649,22 +649,29 @@
    • -
      - Stats +
      +
      +
      {{formatNumber(resultLandingInfo.measure.downloads)}}
      +
      Downloads
      +
      +
      +
      {{formatNumber(resultLandingInfo.measure.views)}}
      +
      Views
      +
      -
      -
      - + +
      + +
      +
      +
      -
      - -
      -
      +
      -
      +
      Powered by OpenAIRE UsageCounts
      @@ -701,13 +708,13 @@
      - +
      @@ -720,15 +727,15 @@
      -
      -
      +
      +
      -
      -
      -
      -
      -
      +
      +
      +
      +
      +
      Citations
      @@ -738,11 +745,11 @@
      Views
      -
      {{resultLandingInfo.measure.citations}}
      +
      {{resultLandingInfo.measure.citations | number}}
      {{resultLandingInfo.measure.popularity}}
      {{resultLandingInfo.measure.influence}}
      -
      {{resultLandingInfo.measure.downloads}}
      -
      {{resultLandingInfo.measure.views}}
      +
      {{resultLandingInfo.measure.downloads | number}}
      +
      {{resultLandingInfo.measure.views | number}}
      @@ -801,123 +808,125 @@
      -
      -
      - - {{resultLandingInfo.hostedBy_collectedFrom[0].accessRight}} -
      - - -
      - -
      - + +
      +
      + + {{resultLandingInfo.hostedBy_collectedFrom[0].accessRight}}
      - -
      - + + +
      + +
      + +
      + +
      + +
      + +
      + +
      - -
      - +
      +
      + +
      + Summary + +
      +
      +
      + +
      + References + +
      +
      +
      + +
      + Related Research + +
      +
      +
      + +
      + External Databases + +
      +
      +
      + +
      + Enermaps Tool + +
      +
      +
      + +
      + Compatible EOSC Services + +
      +
      + +
      + Funded by + +
      +
      +
      + +
      + Related to Research Communities + +
      +
      +
      -
      -
      - -
      - Summary - +
      +
      + -
      - - -
      - References - + -
      - - -
      - Related Research - + -
      - - -
      - External Databases - -
      -
      -
      - -
      - Enermaps Tool - -
      -
      -
      - -
      - Compatible EOSC Services - -
      -
      - -
      - Funded by - -
      -
      -
      - -
      - Related to Research Communities - -
      -
      -
      -
      -
      - +
      diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index 75ba17d1..20d77189 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -25,6 +25,7 @@ import {ConnectHelper} from "../../connect/connectHelper"; import {UserManagementService} from "../../services/user-management.service"; import {OpenaireEntities} from "../../utils/properties/searchFields"; import {Option} from "../../sharedComponents/input/input.component"; +import {NumberUtils} from '../../utils/number-utils.class'; declare var ResizeObserver; @@ -912,4 +913,15 @@ export class ResultLandingComponent { this.descriptionModal.alertTitle = "Abstract"; this.descriptionModal.open(); } + + public clickedUsageMetrics() { + setTimeout( () => { + this.metricsClicked = true; + }); + } + + public formatNumber(num: number | string) { + let formatted = NumberUtils.roundNumber(+num); + return formatted.number + formatted.size; + } } diff --git a/landingPages/result/resultLanding.service.ts b/landingPages/result/resultLanding.service.ts index d8ff3308..ee715a76 100644 --- a/landingPages/result/resultLanding.service.ts +++ b/landingPages/result/resultLanding.service.ts @@ -413,11 +413,12 @@ export class ResultLandingService { this.resultLandingInfo.measure = {"downloads": null, "views": null, "popularity": null, "influence": null, "citations": null, "impulse": null}; for (let i = 0; i < data[0].measure.length; i++) { if (data[0].measure[i].id == 'downloads') { - // this.resultLandingInfo.measure['downloads'] = data[0].measure[i].count; - this.resultLandingInfo.measure['downloads'] = data[0].measure[i].count == 0 ? ' - ' : data[0].measure[i].count; + // this.resultLandingInfo.measure['downloads'] = data[0].measure[i].count == 0 ? ' - ' : data[0].measure[i].count; + this.resultLandingInfo.measure['downloads'] = data[0].measure[i].count; } if (data[0].measure[i].id == 'views') { - this.resultLandingInfo.measure['views'] = data[0].measure[i].count == 0 ? ' - ' : data[0].measure[i].count; + // this.resultLandingInfo.measure['views'] = data[0].measure[i].count == 0 ? ' - ' : data[0].measure[i].count; + this.resultLandingInfo.measure['views'] = data[0].measure[i].count; } if (data[0].measure[i].id == 'influence') { if (data[0].measure[i].class == 'C1') { @@ -454,7 +455,8 @@ export class ResultLandingService { } } if (data[0].measure[i].id == 'influence_alt') { - this.resultLandingInfo.measure['citations'] = data[0].measure[i].score == 0 ? ' - ' : data[0].measure[i].score; + // this.resultLandingInfo.measure['citations'] = data[0].measure[i].score == 0 ? ' - ' : data[0].measure[i].score; + this.resultLandingInfo.measure['citations'] = data[0].measure[i].score; } if (data[0].measure[i].id == 'impulse') { if (data[0].measure[i].class == 'C1') {