progress in landing page (new metrics, tweaks for new action-bar)

This commit is contained in:
Alex Martzios 2023-01-13 08:32:16 +02:00
parent 871c45c480
commit c1fa0889ee
5 changed files with 356 additions and 39 deletions

View File

@ -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: `
<!-- new template for downloads dropdown -->
<ng-container *ngIf="availableOn">
<a class="uk-flex uk-flex-middle uk-flex-center uk-button-link uk-text-bolder custom-external">
<a class="uk-flex uk-flex-middle uk-flex-center uk-button-link uk-text-bolder">
<span [class]="'uk-margin-xsmall-right ' + (availableOn[0].accessRightIcon == 'lock_open' ? 'uk-text-success' : 'uk-text-meta')"
uk-tooltip [title]="availableOn[0].accessRight ? availableOn[0].accessRight : 'Not available'">
<icon [name]="availableOn[0].accessRightIcon" flex="true" type="outlined"></icon>
</span>
{{availableOn[0].downloadNames.join("; ")}}
<span>{{availableOn[0].downloadNames.join("; ")}}</span>
<icon class="uk-margin-xsmall-left" [flex]="true" [name]="'expand_' + (isOpen?'less':'more')"></icon>
</a>
<!-- TODO: Dropdown for download options -->
<div #dropElement uk-drop="mode: click; pos: bottom-left;" class="download-drop uk-card uk-card-default uk-padding-small uk-padding-remove-horizontal uk-text-small">
<div *ngFor="let instance of availableOn let i=index" class="download-drop-item uk-flex uk-flex-top">
<span [class]="'uk-margin-small-right ' + (instance.accessRightIcon == 'lock_open' ? 'uk-text-success' : 'uk-text-meta')"
uk-tooltip [title]="instance.accessRight ? instance.accessRight : 'Not available'">
<icon [name]="instance.accessRightIcon" flex="true" type="outlined"></icon>
</span>
<div class="uk-width-expand uk-padding-small uk-padding-remove-left uk-padding-remove-vertical">
<span class="uk-text-emphasis">
<a *ngIf="instance.downloadUrl" [href]="instance.downloadUrl" target="_blank"
class="title uk-link-text uk-text-bold custom-external uk-display-inline-block">
{{instance.downloadNames.join("; ")}}
</a>
</span>
<div *ngIf="instance.types?.length > 0 || instance.years?.length > 0" class="uk-text-meta">
<span *ngIf="instance.types?.length > 0" class="uk-text-capitalize">{{instance.types.join(" . ")}}</span>
<span *ngIf="instance.types?.length > 0 && instance.years?.length > 0"> . </span>
<span *ngIf="instance.years?.length > 0">{{instance.years.join(" . ")}}</span>
</div>
<div *ngIf="instance.license" class="uk-text-meta uk-text-truncate" uk-tooltip [title]="instance.license">
License:
<a *ngIf="isUrl(instance.license); else elseBlock"
[href]="instance.license" target="_blank" class="custom-external uk-link-text">
{{instance.license}}
</a>
<ng-template #elseBlock> {{instance.license}}</ng-template>
</div>
<div *ngIf="instance.collectedNamesAndIds?.size > 0" class="uk-text-meta">
<span>Providers: </span>
<a *ngFor="let collectedName of getKeys(instance.collectedNamesAndIds); let i=index" [routerLink]="dataProviderUrl"
[queryParams]="{datasourceId: instance.collectedNamesAndIds.get(collectedName)}" class="uk-link-text">
{{collectedName}}<ng-container *ngIf="(i !== (instance.collectedNamesAndIds.size - 1))">; </ng-container>
</a>
</div>
</div>
</div>
</div>
</ng-container>
<!-- <div class="uk-margin-small-bottom uk-flex uk-flex-between">
@ -97,6 +134,7 @@ export class AvailableOnComponent {
@Input() availableOn: HostedByCollectedFrom[];
@Input() viewAll: boolean = false;
@Output() viewAllClicked = new EventEmitter();
@ViewChild("dropElement") dropElement: ElementRef;
public lessBtn: boolean = false;
public threshold: number = 1;
public dataProviderUrl = properties.searchLinkToDataProvider.split('?')[0];
@ -106,7 +144,6 @@ export class AvailableOnComponent {
}
ngOnInit() {
console.log(this.availableOn);
}
public removeUnknown(value: string): string {
@ -137,5 +174,9 @@ export class AvailableOnComponent {
public isUrl(str: string): boolean {
return str.startsWith('http://') || str.startsWith('https://') || str.startsWith('//') || str.startsWith('www.');
}
get isOpen() {
return (typeof document !== 'undefined') && this.dropElement && UIkit.drop(this.dropElement.nativeElement).isActive();
}
}

View File

@ -118,11 +118,9 @@
</span>
</a>
<!-- Divider -->
<span *ngIf="resultLandingInfo.deletedByInferenceIds" class="landing-action-bar-divider"></span>
<span *ngIf="resultLandingInfo.hostedBy_collectedFrom || resultLandingInfo.deletedByInferenceIds" class="landing-action-bar-divider"></span>
<!-- Actions -->
<a *ngIf="isRouteAvailable('participate/direct-claim')"
[title]="'<span class=\'uk-flex uk-flex-middle\'>Link this '+getTypeName()+' to ...<span class=\'material-icons uk-margin-small-left\'>east</span></span>'"
[attr.uk-tooltip]="'pos: bottom; cls: uk-active uk-text-small uk-padding-small'"
[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">
@ -130,28 +128,20 @@
<span class="uk-margin-xsmall-left">Link to</span>
</a>
<a (click)="openAddThisModal()"
[title]="'Share this '+getTypeName() + ' in your social networks'"
[attr.uk-tooltip]="'pos: bottom; cls: uk-active uk-text-small uk-padding-small'"
class="uk-flex uk-flex-middle uk-flex-center uk-button-link uk-text-bolder">
<icon flex="true" ratio="0.8" name="share" visuallyHidden="share"></icon>
<span class="uk-margin-xsmall-left">Share</span>
</a>
<a (click)="openCiteModal()"
[title]="'Cite this '+getTypeName()"
[attr.uk-tooltip]="'pos: bottom; cls: uk-active uk-text-small uk-padding-small'"
class="uk-flex uk-flex-middle uk-flex-center uk-button-link uk-text-bolder">
<icon flex="true" ratio="0.7" name="cite" visuallyHidden="cite"></icon>
<span class="uk-margin-xsmall-left">Cite</span>
</a>
<!-- TODO: Add orcid component for icon - will need changes inside the component -->
<a *ngIf="properties.adminToolsPortalType == 'explore' || properties.adminToolsPortalType == 'community' || properties.adminToolsPortalType == 'aggregator'"
class="uk-flex uk-flex-middle uk-flex-center uk-button-link uk-text-bolder">
<!-- <icon flex="true" ratio="0.8" name="orcid_add" visuallyHidden="orcid_add"></icon>
<span class="uk-margin-xsmall-left">Claim</span> -->
<ng-container *ngIf="properties.adminToolsPortalType == 'explore' || properties.adminToolsPortalType == 'community' || properties.adminToolsPortalType == 'aggregator'" >
<orcid-work [resultId]="id" [resultTitle]="resultLandingInfo.title" [resultLandingInfo]="resultLandingInfo"
[pids]="pidsArrayString" [pageType]="'landing'">
</orcid-work>
</a>
</ng-container>
<!-- TODO: EGI transfer data action -->
<a *ngIf=" properties.enableEoscDataTransfer && resultLandingInfo.resultType == 'dataset' &&
resultLandingInfo.identifiers && resultLandingInfo.identifiers.get('doi') &&
@ -303,6 +293,10 @@
[tabTitle]="'Enermaps Tool'" [tabId]="'enermaps'"
customClass="portalTab">
</my-tab>
<!-- New metrics tab -->
<my-tab *ngIf="resultLandingInfo && (hasAltMetrics || hasMetrics)"
[tabTitle]="'Metrics'" [tabId]="'metrics'">
</my-tab>
</my-tabs>
</div>
</div>
@ -459,6 +453,160 @@
</ul>
</div>
</ng-container>
<ng-container *ngIf="resultLandingInfo && (hasAltMetrics || hasMetrics)">
<div id="metrics" class="landing-section uk-padding uk-padding-remove-horizontal">
<ul class="uk-subnav uk-subnav-pill-alt uk-margin-large-bottom" uk-switcher>
<li>
<a href="#">Overview</a>
</li>
<li>
<a href="#">Impact</a>
</li>
<li>
<a href="#">Social</a>
</li>
<li>
<a href="#">Usage</a>
</li>
</ul>
<ul class="uk-switcher">
<li>
<div class="uk-flex uk-flex-wrap">
<div id="bip">
<div class="uk-grid-divider" uk-grid>
<div>
<div class="uk-text-center uk-margin-small-bottom">
<img src="assets/common-assets/logo-bip.png" loading="lazy" alt="BIP!">
</div>
<span class="uk-text-uppercase uk-text-xsmall">Impact by</span>
<span class="uk-display-block uk-text-bolder">BIP!</span>
</div>
<div>
<table class="uk-table uk-table-small">
<tbody>
<tr>
<td class="uk-padding-remove-top">
Citations
</td>
<td class="uk-padding-remove-top uk-text-uppercase uk-text-bolder">
{{resultLandingInfo.measure.citations}}
</td>
</tr>
<tr>
<td>
Popularity
</td>
<td class="uk-text-uppercase uk-text-bolder">
{{resultLandingInfo.measure.popularity}}
</td>
</tr>
<tr>
<td>
Influence
</td>
<td class="uk-text-uppercase uk-text-bolder">
{{resultLandingInfo.measure.influence}}
</td>
</tr>
<tr>
<td class="uk-padding-remove-bottom">
Impulse
</td>
<td class="uk-padding-remove-bottom uk-text-uppercase uk-text-bolder">
{{resultLandingInfo.measure.impulse}}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div id="altmetrics">
<div class="uk-grid-divider uk-margin-medium-left" uk-grid>
<div>
<div class="uk-text-center uk-margin-small-bottom">
<img src="assets/common-assets/" loading="lazy" alt="Altmetric">
</div>
<span class="uk-text-uppercase uk-text-xsmall">Social by</span>
<span class="uk-display-block uk-text-bolder">Altmetric</span>
</div>
<div>
<table class="uk-table uk-table-small">
<tbody>
<tr>
<td class="uk-padding-remove-top">
Facebook
</td>
<td class="uk-padding-remove-top uk-text-uppercase uk-text-bolder">
1
</td>
</tr>
<tr>
<td class="uk-padding-remove-bottom">
Twitter
</td>
<td class="uk-padding-remove-bottom uk-text-uppercase uk-text-bolder">
4
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div id="usagecounts">
<div class="uk-grid-divider uk-margin-medium-left" uk-grid>
<div>
<div class="uk-text-center uk-margin-small-bottom">
<img src="assets/common-assets/logo-small-usage-counts.png" loading="lazy" alt="usage counts">
</div>
<span class="uk-text-uppercase uk-text-xsmall">Usage by</span>
<span class="uk-display-block uk-text-bolder">UsageCounts</span>
</div>
<div>
<table class="uk-table uk-table-small">
<tbody>
<tr>
<td class="uk-padding-remove-top">
<icon name="download" [flex]="true" customClass="uk-text-background"></icon>
</td>
<td class="uk-padding-remove-top">
Downloads
</td>
<td class="uk-padding-remove-top uk-text-uppercase uk-text-bolder">
{{resultLandingInfo.measure.downloads}}
</td>
</tr>
<tr>
<td class="uk-padding-remove-bottom">
<icon name="visibility" [flex]="true" customClass="uk-text-background"></icon>
</td>
<td class="uk-padding-remove-bottom">
Views
</td>
<td class="uk-padding-remove-bottom uk-text-uppercase uk-text-bolder">
{{resultLandingInfo.measure.views}}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</li>
<li>
2
</li>
<li>
3
</li>
<li>
4
</li>
</ul>
</div>
</ng-container>
</div>
<div class="uk-text-xsmall uk-hidden@m"><ng-container *ngTemplateOutlet="graph_and_feedback_template"></ng-container></div>
@ -504,13 +652,40 @@
<ng-template #right_column>
<!-- new metrics box -->
<div class="uk-margin-medium-top uk-padding uk-padding-remove-vertical">
<div *ngIf="resultLandingInfo && hasMetrics"
class="uk-margin-medium-top uk-padding uk-padding-remove-vertical">
<div class="uk-card uk-card-secondary uk-flex uk-padding-small">
<div class="uk-width-3-5">
left
<div class="uk-width-expand">
<div class="uk-grid uk-grid-small" uk-grid>
<!-- <div>
<div></div>
<div></div>
<div></div>
<div>
<icon name="download" [flex]="true"></icon>
</div>
<div>
<icon name="visibility" [flex]="true"></icon>
</div>
</div> -->
<div>
<div class="uk-margin-xsmall-bottom">Citations</div>
<div class="uk-margin-xsmall-bottom">Popularity</div>
<div class="uk-margin-xsmall-bottom">Influence</div>
<div class="uk-margin-xsmall-bottom">Downloads</div>
<div class="uk-margin-xsmall-bottom">Views</div>
</div>
<div class="uk-text-uppercase uk-text-bolder">
<div class="uk-margin-xsmall-bottom">{{resultLandingInfo.measure.citations}}</div>
<div class="uk-margin-xsmall-bottom">{{resultLandingInfo.measure.popularity}}</div>
<div class="uk-margin-xsmall-bottom">{{resultLandingInfo.measure.influence}}</div>
<div class="uk-margin-xsmall-bottom">{{resultLandingInfo.measure.downloads}}</div>
<div class="uk-margin-xsmall-bottom">{{resultLandingInfo.measure.views}}</div>
</div>
</div>
</div>
<div class="uk-width-2-5">
right
<div class="uk-width-1-5">
</div>
</div>
</div>

View File

@ -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;

View File

@ -54,33 +54,47 @@ declare var UIkit: any;
<ng-container *ngIf="pageType == 'landing'">
<span *ngIf="!putCodes || putCodes.length == 0"
[attr.uk-tooltip]="'pos: bottom; cls: uk-active uk-text-small uk-padding-small'"
[title]="(!pids || !isLoggedIn) ? (!pids ? tooltipNoPid : tooltipNoLoggedInUser) : tooltipAdd">
[attr.uk-tooltip]="'pos: bottom; cls: uk-active uk-text-small uk-padding-small'"
[title]="(!pids || !isLoggedIn) ? (!pids ? tooltipNoPid : tooltipNoLoggedInUser) : tooltipAdd">
<a *ngIf="!showLoading" (click)="currentAction='add'; saveWorkPreparation();"
class="uk-flex uk-flex-middle uk-flex-center uk-button-link uk-text-bolder"
[class.uk-disabled]="showLoading || !isLoggedIn || !pids"
(mouseover)="hoverEvent($event)" (mouseout)="hoverEvent($event)">
<icon *ngIf="!hoverAdd" name="orcid_add" ratio="0.8" visuallyHidden="add"></icon>
<icon *ngIf="hoverAdd" name="add" visuallyHidden="add"></icon>
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)">
<icon name="orcid_add" ratio="1" visuallyHidden="add"></icon>
<span class="uk-margin-xsmall-left">Claim</span>
</a>
<span *ngIf="showLoading" class="uk-icon icon-button uk-icon-button-small"><loading
[top_margin]="false" [size]="'small'"></loading></span>
</span>
<span *ngIf="putCodes && putCodes.length > 0"
[attr.uk-tooltip]="'pos: bottom; cls: uk-active uk-text-small uk-padding-small'"
[title]="(!pids || !isLoggedIn) ? (!pids ? tooltipNoPid : tooltipNoLoggedInUser) : tooltipDelete">
<span *ngIf="putCodes && putCodes.length > 0"
[attr.uk-tooltip]="'pos: bottom; cls: uk-active uk-text-small uk-padding-small'"
[title]="(!pids || !isLoggedIn) ? (!pids ? tooltipNoPid : tooltipNoLoggedInUser) : tooltipDelete">
<a *ngIf="!showLoading" (click)="currentAction='delete'; deleteWorks();"
class="uk-icon-button uk-icon landing-action-button landing-action-button-orcid"
[class.uk-disabled]="showLoading || !isLoggedIn || !pids"
(mouseover)="hoverEvent($event, 'delete')" (mouseout)="hoverEvent($event, 'delete')">
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')">
<icon name="orcid_bin" ratio="1" visuallyHidden="delete"></icon>
<span class="uk-margin-xsmall-left">Remove</span>
</a>
<span *ngIf="showLoading" class="uk-icon icon-button uk-icon-button-small"><loading
[top_margin]="false" [size]="'small'"></loading></span>
</span>
<!-- Old 'remove' code -->
<!-- <span *ngIf="putCodes && putCodes.length > 0"
[attr.uk-tooltip]="'pos: bottom; cls: uk-active uk-text-small uk-padding-small'"
[title]="(!pids || !isLoggedIn) ? (!pids ? tooltipNoPid : tooltipNoLoggedInUser) : tooltipDelete">
<a *ngIf="!showLoading" (click)="currentAction='delete'; deleteWorks();"
class="uk-icon-button uk-icon landing-action-button landing-action-button-orcid"
[class.uk-disabled]="showLoading || !isLoggedIn || !pids"
(mouseover)="hoverEvent($event, 'delete')" (mouseout)="hoverEvent($event, 'delete')">
<icon *ngIf="!hoverDelete" name="orcid_bin" ratio="1.1" visuallyHidden="delete"></icon>
<icon *ngIf="hoverDelete" name="delete_outline" class="uk-text-danger" visuallyHidden="delete"></icon>
</a>
<span *ngIf="showLoading" class="uk-icon icon-button uk-icon-button-small"><loading
[top_margin]="false" [size]="'small'"></loading></span>
</span>
</span> -->
</ng-container>
<modal-alert #grantModal [overflowBody]=false (alertOutput)="openGrantWindow()">

View File

@ -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;
}