From c1fa0889ee670084ba97f6a22e67a2d23c09d95c Mon Sep 17 00:00:00 2001 From: Alex Martzios Date: Fri, 13 Jan 2023 08:32:16 +0200 Subject: [PATCH] progress in landing page (new metrics, tweaks for new action-bar) --- .../landing-utils/availableOn.component.ts | 53 ++++- .../result/resultLanding.component.html | 211 ++++++++++++++++-- landingPages/result/resultLanding.service.ts | 78 ++++++- orcid/orcid-work.component.ts | 42 ++-- utils/entities/resultLandingInfo.ts | 11 + 5 files changed, 356 insertions(+), 39 deletions(-) diff --git a/landingPages/landing-utils/availableOn.component.ts b/landingPages/landing-utils/availableOn.component.ts index 071bd84e..916b55b2 100644 --- a/landingPages/landing-utils/availableOn.component.ts +++ b/landingPages/landing-utils/availableOn.component.ts @@ -1,20 +1,57 @@ -import {Component, EventEmitter, Input, Output} from '@angular/core'; +import {Component, ElementRef, EventEmitter, Input, Output, ViewChild} from '@angular/core'; import {HostedByCollectedFrom} from "../../utils/result-preview/result-preview"; import {properties} from "../../../../environments/environment"; +declare var UIkit; @Component({ selector: 'availableOn', template: ` - - + - {{availableOn[0].downloadNames.join("; ")}} + {{availableOn[0].downloadNames.join("; ")}} + - + +
+
+ + + +
+ + + {{instance.downloadNames.join("; ")}} + + +
+ {{instance.types.join(" . ")}} + . + {{instance.years.join(" . ")}} +
+
+ License: + + {{instance.license}} + + {{instance.license}} +
+
+ Providers: + + {{collectedName}}; + +
+
+
+
- + @@ -130,28 +128,20 @@ Link to Share Cite - - - + - + + + + @@ -459,6 +453,160 @@ + +
+ + +
+
@@ -504,13 +652,40 @@ -
+
-
- left +
+
+ +
+
Citations
+
Popularity
+
Influence
+
Downloads
+
Views
+
+
+
{{resultLandingInfo.measure.citations}}
+
{{resultLandingInfo.measure.popularity}}
+
{{resultLandingInfo.measure.influence}}
+
{{resultLandingInfo.measure.downloads}}
+
{{resultLandingInfo.measure.views}}
+
+
-
- right +
+
diff --git a/landingPages/result/resultLanding.service.ts b/landingPages/result/resultLanding.service.ts index f240ebeb..26c2ff25 100644 --- a/landingPages/result/resultLanding.service.ts +++ b/landingPages/result/resultLanding.service.ts @@ -126,7 +126,7 @@ export class ResultLandingService { } parseResultLandingInfo (data: any, subjectsVocabulary: any, properties: EnvProperties): any { - this.resultLandingInfo = new ResultLandingInfo(); + this.resultLandingInfo = new ResultLandingInfo(); // res this.resultLandingInfo.record = data[15]; @@ -408,6 +408,82 @@ export class ResultLandingService { }); } + // res['result']['metadata']['oaf:entity']['oaf:result']['measure'] + if (data[0] != null) { + if (data[0].measure?.length) { + 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; + } + if (data[0].measure[i].id == 'views') { + this.resultLandingInfo.measure['views'] = data[0].measure[i].count == 0 ? ' - ' : data[0].measure[i].count; + } + if (data[0].measure[i].id == 'influence') { + if (data[0].measure[i].class == 'C1') { + this.resultLandingInfo.measure['influence'] = 'Top 0.01%'; + } else if (data[0].measure[i].class == 'C2') { + this.resultLandingInfo.measure['influence'] = 'Top 0.1%'; + } else if (data[0].measure[i].class == 'C3') { + this.resultLandingInfo.measure['influence'] = 'Top 1%'; + } else if (data[0].measure[i].class == 'C4') { + this.resultLandingInfo.measure['influence'] = 'Top 10%'; + } else if (data[0].measure[i].class == 'C5') { + this.resultLandingInfo.measure['influence'] = 'Average/low'; + } else if (data[0].measure[i].class == 'A') { + this.resultLandingInfo.measure['influence'] = 'Exceptional'; + } else if (data[0].measure[i].class == 'B') { + this.resultLandingInfo.measure['influence'] = 'Substantial'; + } else { + this.resultLandingInfo.measure['influence'] = 'Average'; + } + } + if (data[0].measure[i].id == 'popularity') { + if (data[0].measure[i].class == 'C1') { + this.resultLandingInfo.measure['popularity'] = 'Top 0.01%'; + } else if (data[0].measure[i].class == 'C2') { + this.resultLandingInfo.measure['popularity'] = 'Top 0.1%'; + } else if (data[0].measure[i].class == 'C3') { + this.resultLandingInfo.measure['popularity'] = 'Top 1%'; + } else if (data[0].measure[i].class == 'C4') { + this.resultLandingInfo.measure['popularity'] = 'Top 10%'; + } else if (data[0].measure[i].class == 'C5') { + this.resultLandingInfo.measure['popularity'] = 'Average/low'; + } else if (data[0].measure[i].class == 'A') { + this.resultLandingInfo.measure['popularity'] = 'Exceptional'; + } else if (data[0].measure[i].class == 'B') { + this.resultLandingInfo.measure['popularity'] = 'Substantial'; + } else { + this.resultLandingInfo.measure['popularity'] = 'Average'; + } + } + if (data[0].measure[i].id == 'influence_alt') { + this.resultLandingInfo.measure['citations'] = data[0].measure[i].score == 0 ? ' - ' : data[0].measure[i].score; + } + if (data[0].measure[i].id == 'impulse') { + if (data[0].measure[i].class == 'C1') { + this.resultLandingInfo.measure['impulse'] = 'Top 0.01%'; + } else if (data[0].measure[i].class == 'C2') { + this.resultLandingInfo.measure['impulse'] = 'Top 0.1%'; + } else if (data[0].measure[i].class == 'C3') { + this.resultLandingInfo.measure['impulse'] = 'Top 1%'; + } else if (data[0].measure[i].class == 'C4') { + this.resultLandingInfo.measure['impulse'] = 'Top 10%'; + } else if (data[0].measure[i].class == 'C5') { + this.resultLandingInfo.measure['impulse'] = 'Average/low'; + } else if (data[0].measure[i].class == 'A') { + this.resultLandingInfo.measure['impulse'] = 'Exceptional'; + } else if (data[0].measure[i].class == 'B') { + this.resultLandingInfo.measure['impulse'] = 'Substantial'; + } else { + this.resultLandingInfo.measure['impulse'] = 'Average'; + } + } + } + } + } + this.resultLandingInfo.relatedResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.relatedResults); return this.resultLandingInfo; diff --git a/orcid/orcid-work.component.ts b/orcid/orcid-work.component.ts index a91d319e..5f95479d 100644 --- a/orcid/orcid-work.component.ts +++ b/orcid/orcid-work.component.ts @@ -54,33 +54,47 @@ declare var UIkit: any; + [attr.uk-tooltip]="'pos: bottom; cls: uk-active uk-text-small uk-padding-small'" + [title]="(!pids || !isLoggedIn) ? (!pids ? tooltipNoPid : tooltipNoLoggedInUser) : tooltipAdd"> - - + class="uk-flex uk-flex-middle uk-flex-center uk-button-link uk-text-bolder landing-action-button-orcid" + [class.uk-disabled]="showLoading || !isLoggedIn || !pids" + (mouseover)="hoverEvent($event)" (mouseout)="hoverEvent($event)"> + Claim - + + class="uk-flex uk-flex-middle uk-flex-center uk-button-link uk-text-bolder landing-action-button-orcid" + [class.uk-disabled]="showLoading || !isLoggedIn || !pids" + (mouseover)="hoverEvent($event, 'delete')" (mouseout)="hoverEvent($event, 'delete')"> + + Remove + + + + + + diff --git a/utils/entities/resultLandingInfo.ts b/utils/entities/resultLandingInfo.ts index c531307d..5ed2b93b 100644 --- a/utils/entities/resultLandingInfo.ts +++ b/utils/entities/resultLandingInfo.ts @@ -29,6 +29,15 @@ export interface Context { logo?: string; } +export interface Measure { + downloads: string; + views: string; + influence: string; + popularity: string; + citations: string; + impulse: string; +} + export class ResultLandingInfo { relcanId; objIdentifier: string; @@ -140,4 +149,6 @@ export class ResultLandingInfo { // SOFTWARE programmingLanguages: string[]; + + measure: Measure; }