project & data landing/search page: get usage counts from index (measure field)

This commit is contained in:
Alex Martzios 2023-05-02 12:00:40 +03:00
parent 2d8be41146
commit beb43ed1b7
13 changed files with 125 additions and 103 deletions

View File

@ -189,17 +189,17 @@
<div class="uk-width-expand uk-flex uk-flex-middle"> <div class="uk-width-expand uk-flex uk-flex-middle">
<div class="uk-grid uk-grid-small uk-flex-nowrap" uk-grid uk-height-match="target: > div > .cell"> <div class="uk-grid uk-grid-small uk-flex-nowrap" uk-grid uk-height-match="target: > div > .cell">
<div> <div>
<div *ngIf="totalDownloads" class="cell uk-margin-xsmall-bottom uk-flex uk-flex-middle"><icon name="download" [ratio]="0.8" [flex]="true"></icon></div> <div *ngIf="dataProviderInfo.measure.counts[1].value" class="cell uk-margin-xsmall-bottom uk-flex uk-flex-middle"><icon [name]="dataProviderInfo.measure.counts[1].icon" [ratio]="0.8" [flex]="true"></icon></div>
<div *ngIf="totalViews" class="cell uk-flex uk-flex-middle"><icon name="visibility" [ratio]="0.8" [flex]="true"></icon></div> <div *ngIf="dataProviderInfo.measure.counts[0].value" class="cell uk-flex uk-flex-middle"><icon [name]="dataProviderInfo.measure.counts[0].icon" [ratio]="0.8" [flex]="true"></icon></div>
</div> </div>
<div> <div>
<div *ngIf="totalDownloads" class="cell uk-margin-xsmall-bottom"> <div *ngIf="dataProviderInfo.measure.counts[1].value" class="cell uk-margin-xsmall-bottom">
<a>Downloads</a> <a class="uk-text-capitalize">{{dataProviderInfo.measure.counts[1].name}}</a>
<ng-container *ngTemplateOutlet="dropInfo; context: {option: 'downloads'}"></ng-container> <ng-container *ngTemplateOutlet="dropInfo; context: {option: dataProviderInfo.measure.counts[1].name}"></ng-container>
</div> </div>
<div *ngIf="totalViews" class="cell"> <div *ngIf="dataProviderInfo.measure.counts[0].value" class="cell">
<a>Views</a> <a class="uk-text-capitalize">{{dataProviderInfo.measure.counts[0].name}}</a>
<ng-container *ngTemplateOutlet="dropInfo; context: {option: 'views'}"></ng-container> <ng-container *ngTemplateOutlet="dropInfo; context: {option: dataProviderInfo.measure.counts[0].name}"></ng-container>
</div> </div>
</div> </div>
<ng-template #dropInfo let-option=option> <ng-template #dropInfo let-option=option>
@ -209,10 +209,10 @@
</div> </div>
</ng-template> </ng-template>
<div class="uk-text-uppercase uk-text-bolder"> <div class="uk-text-uppercase uk-text-bolder">
<div *ngIf="totalDownloads" [attr.uk-tooltip]="totalDownloads >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'" <div *ngIf="dataProviderInfo.measure.counts[1].value" [attr.uk-tooltip]="dataProviderInfo.measure.counts[1].value >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'"
title="{{totalDownloads | number}}" class="cell uk-margin-xsmall-bottom">{{formatNumber(totalDownloads)}}</div> title="{{dataProviderInfo.measure.counts[1].value | number}}" class="cell uk-margin-xsmall-bottom">{{formatNumber(dataProviderInfo.measure.counts[1].value)}}</div>
<div *ngIf="totalViews" [attr.uk-tooltip]="totalViews >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'" <div *ngIf="dataProviderInfo.measure.counts[0].value" [attr.uk-tooltip]="dataProviderInfo.measure.counts[0].value >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'"
title="{{totalViews | number}}" class="cell">{{formatNumber(totalViews)}}</div> title="{{dataProviderInfo.measure.counts[0].value | number}}" class="cell">{{formatNumber(dataProviderInfo.measure.counts[0].value)}}</div>
</div> </div>
</div> </div>
</div> </div>
@ -780,14 +780,14 @@
<li class="uk-padding-remove"> <li class="uk-padding-remove">
<a href="#">Overview</a> <a href="#">Overview</a>
</li> </li>
<li *ngIf="totalDownloads ||totalViews"> <li *ngIf="dataProviderInfo.measure.counts[1].value || dataProviderInfo.measure.counts[0].value">
<a href="#" (click)="clickedUsageMetrics()">Usage</a> <a href="#" (click)="clickedUsageMetrics()">Usage</a>
</li> </li>
</ul> </ul>
<ul class="uk-switcher uk-margin-large-top"> <ul class="uk-switcher uk-margin-large-top">
<!-- overview --> <!-- overview -->
<li> <li>
<div *ngIf="totalDownloads || totalViews"> <div *ngIf="dataProviderInfo.measure.counts[1].value || dataProviderInfo.measure.counts[0].value">
<div class="uk-grid-divider" uk-grid> <div class="uk-grid-divider" uk-grid>
<div> <div>
<div class="uk-text-center uk-margin-small-bottom"> <div class="uk-text-center uk-margin-small-bottom">
@ -803,30 +803,30 @@
<div> <div>
<table class="uk-table uk-table-small"> <table class="uk-table uk-table-small">
<tbody> <tbody>
<tr *ngIf="totalDownloads"> <tr *ngIf="dataProviderInfo.measure.counts[1].value">
<td class="uk-padding-remove-top"> <td class="uk-padding-remove-top">
<icon name="download" [flex]="true" [ratio]="1.2" customClass="uk-text-background text-usage-counts"></icon> <icon [name]="dataProviderInfo.measure.counts[1].icon" [flex]="true" [ratio]="1.2" customClass="uk-text-background text-usage-counts"></icon>
</td> </td>
<td class="uk-padding-remove-top"> <td class="uk-padding-remove-top uk-text-capitalize">
Downloads {{dataProviderInfo.measure.counts[1].name}}
</td> </td>
<td class="uk-padding-remove-top uk-text-uppercase uk-text-bolder" <td class="uk-padding-remove-top uk-text-uppercase uk-text-bolder"
[attr.uk-tooltip]="totalDownloads >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'" [attr.uk-tooltip]="dataProviderInfo.measure.counts[1].value >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'"
title="{{totalDownloads | number}}"> title="{{dataProviderInfo.measure.counts[1].value | number}}">
{{formatNumber(totalDownloads)}} {{formatNumber(dataProviderInfo.measure.counts[1].value)}}
</td> </td>
</tr> </tr>
<tr *ngIf="totalViews"> <tr *ngIf="dataProviderInfo.measure.counts[0].value">
<td class="uk-padding-remove-bottom"> <td class="uk-padding-remove-bottom">
<icon name="visibility" [flex]="true" [ratio]="1.2" customClass="uk-text-background text-usage-counts"></icon> <icon [name]="dataProviderInfo.measure.counts[0].icon" [flex]="true" [ratio]="1.2" customClass="uk-text-background text-usage-counts"></icon>
</td> </td>
<td class="uk-padding-remove-bottom"> <td class="uk-padding-remove-bottom uk-text-capitalize">
Views {{dataProviderInfo.measure.counts[0].name}}
</td> </td>
<td class="uk-padding-remove-bottom uk-text-uppercase uk-text-bolder" <td class="uk-padding-remove-bottom uk-text-uppercase uk-text-bolder"
[attr.uk-tooltip]="totalViews >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'" [attr.uk-tooltip]="dataProviderInfo.measure.counts[0].value >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'"
title="{{totalViews | number}}"> title="{{dataProviderInfo.measure.counts[0].value | number}}">
{{formatNumber(totalViews)}} {{formatNumber(dataProviderInfo.measure.counts[0].value)}}
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -836,20 +836,20 @@
</div> </div>
</li> </li>
<!-- usage --> <!-- usage -->
<li *ngIf="totalDownloads || totalViews"> <li *ngIf="dataProviderInfo.measure.counts[1].value || dataProviderInfo.measure.counts[0].value">
<div class="uk-flex uk-flex-center uk-flex-middle uk-flex-wrap" [class.uk-flex-column]="isMobile"> <div class="uk-flex uk-flex-center uk-flex-middle uk-flex-wrap" [class.uk-flex-column]="isMobile">
<div class="uk-margin-large-right uk-flex uk-flex-center uk-flex-middle uk-flex-wrap" [class.uk-flex-column]="!isMobile"> <div class="uk-margin-large-right uk-flex uk-flex-center uk-flex-middle uk-flex-wrap" [class.uk-flex-column]="!isMobile">
<div *ngIf="totalDownloads" class="uk-text-center uk-margin-medium-bottom" [class.uk-margin-medium-right]="isMobile"> <div *ngIf="dataProviderInfo.measure.counts[1].value" class="uk-text-center uk-margin-medium-bottom" [class.uk-margin-medium-right]="isMobile">
<div class="uk-text-background uk-text-bold number metrics-number" <div class="uk-text-background uk-text-bold number metrics-number"
[attr.uk-tooltip]="totalDownloads >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'" [attr.uk-tooltip]="dataProviderInfo.measure.counts[1].value >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'"
title="{{totalDownloads | number}}">{{formatNumber(totalDownloads)}}</div> title="{{dataProviderInfo.measure.counts[1].value | number}}">{{formatNumber(dataProviderInfo.measure.counts[1].value)}}</div>
<div class="uk-text-bold">Downloads</div> <div class="uk-text-bold uk-text-capitalize">{{dataProviderInfo.measure.counts[1].name}}</div>
</div> </div>
<div *ngIf="totalViews" class="uk-text-center uk-margin-medium-bottom"> <div *ngIf="dataProviderInfo.measure.counts[0].value" class="uk-text-center uk-margin-medium-bottom">
<div class="uk-text-background uk-text-bold number metrics-number" <div class="uk-text-background uk-text-bold number metrics-number"
[attr.uk-tooltip]="totalViews >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'" [attr.uk-tooltip]="dataProviderInfo.measure.counts[0].value >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'"
title="{{totalViews | number}}">{{formatNumber(totalViews)}}</div> title="{{dataProviderInfo.measure.counts[0].value | number}}">{{formatNumber(dataProviderInfo.measure.counts[0].value)}}</div>
<div class="uk-text-bold">Views</div> <div class="uk-text-bold uk-text-capitalize">{{dataProviderInfo.measure.counts[0].name}}</div>
</div> </div>
</div> </div>
<ng-container *ngIf="viewsFrameUrl || downloadsFrameUrl"> <ng-container *ngIf="viewsFrameUrl || downloadsFrameUrl">

View File

@ -712,7 +712,8 @@ export class DataProviderComponent {
public get hasMetrics(): boolean { public get hasMetrics(): boolean {
// return !(this.totalViews != null && this.totalDownloads != null) || this.totalViews > 0 || this.totalDownloads > 0; // return !(this.totalViews != null && this.totalDownloads != null) || this.totalViews > 0 || this.totalDownloads > 0;
return (this.totalViews != null && this.totalViews > 0) || (this.totalDownloads != null && this.totalDownloads > 0); // return (this.totalViews != null && this.totalViews > 0) || (this.totalDownloads != null && this.totalDownloads > 0);
return this.dataProviderInfo.measure?.counts?.length && (this.dataProviderInfo.measure?.counts[0].value > 0 || this.dataProviderInfo.measure?.counts[1].value);
} }
// public openStatistics() { // public openStatistics() {

View File

@ -364,6 +364,9 @@ export class DataProviderService {
this.dataProviderInfo.journal = null; this.dataProviderInfo.journal = null;
// this.dataProviderInfo.journal = {"journal": "", "issn": "", "lissn": "", "eissn": ""}; // this.dataProviderInfo.journal = {"journal": "", "issn": "", "lissn": "", "eissn": ""};
} }
if (data[0]?.measure) {
this.dataProviderInfo.measure = this.parsingFunctions.parseMeasures(data[0].measure);
}
return this.dataProviderInfo; return this.dataProviderInfo;
} }

View File

@ -322,17 +322,17 @@
<div class="uk-width-expand uk-flex uk-flex-middle"> <div class="uk-width-expand uk-flex uk-flex-middle">
<div class="uk-grid uk-grid-small uk-flex-nowrap" uk-grid uk-height-match="target: > div > .cell"> <div class="uk-grid uk-grid-small uk-flex-nowrap" uk-grid uk-height-match="target: > div > .cell">
<div> <div>
<div *ngIf="totalDownloads" class="cell uk-margin-xsmall-bottom uk-flex uk-flex-middle"><icon name="download" [ratio]="0.8" [flex]="true"></icon></div> <div *ngIf="projectInfo.measure.counts[1].value" class="cell uk-margin-xsmall-bottom uk-flex uk-flex-middle"><icon [name]="projectInfo.measure.counts[1].icon" [ratio]="0.8" [flex]="true"></icon></div>
<div *ngIf="totalViews" class="cell uk-flex uk-flex-middle"><icon name="visibility" [ratio]="0.8" [flex]="true"></icon></div> <div *ngIf="projectInfo.measure.counts[0].value" class="cell uk-flex uk-flex-middle"><icon [name]="projectInfo.measure.counts[0].icon" [ratio]="0.8" [flex]="true"></icon></div>
</div> </div>
<div> <div>
<div *ngIf="totalDownloads" class="cell uk-margin-xsmall-bottom"> <div *ngIf="projectInfo.measure.counts[1].value" class="cell uk-margin-xsmall-bottom">
<a>Downloads</a> <a class="uk-text-capitalize">{{projectInfo.measure.counts[1].name}}</a>
<ng-container *ngTemplateOutlet="dropInfo; context: {option: 'downloads'}"></ng-container> <ng-container *ngTemplateOutlet="dropInfo; context: {option: projectInfo.measure.counts[1].name}"></ng-container>
</div> </div>
<div *ngIf="totalViews" class="cell"> <div *ngIf="projectInfo.measure.counts[0].value" class="cell">
<a>Views</a> <a class="uk-text-capitalize">{{projectInfo.measure.counts[0].name}}</a>
<ng-container *ngTemplateOutlet="dropInfo; context: {option: 'views'}"></ng-container> <ng-container *ngTemplateOutlet="dropInfo; context: {option: projectInfo.measure.counts[0].name}"></ng-container>
</div> </div>
</div> </div>
<ng-template #dropInfo let-option=option> <ng-template #dropInfo let-option=option>
@ -342,10 +342,10 @@
</div> </div>
</ng-template> </ng-template>
<div class="uk-text-uppercase uk-text-bolder"> <div class="uk-text-uppercase uk-text-bolder">
<div *ngIf="totalDownloads" [attr.uk-tooltip]="totalDownloads >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'" <div *ngIf="projectInfo.measure.counts[1].value" [attr.uk-tooltip]="projectInfo.measure.counts[1].value >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'"
title="{{totalDownloads | number}}" class="cell uk-margin-xsmall-bottom">{{formatNumber(totalDownloads)}}</div> title="{{projectInfo.measure.counts[1].value | number}}" class="cell uk-margin-xsmall-bottom">{{formatNumber(projectInfo.measure.counts[1].value)}}</div>
<div *ngIf="totalViews" [attr.uk-tooltip]="totalViews >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'" <div *ngIf="projectInfo.measure.counts[0].value" [attr.uk-tooltip]="projectInfo.measure.counts[0].value >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'"
title="{{totalViews | number}}" class="cell">{{formatNumber(totalViews)}}</div> title="{{projectInfo.measure.counts[0].value | number}}" class="cell">{{formatNumber(projectInfo.measure.counts[0].value)}}</div>
</div> </div>
</div> </div>
</div> </div>
@ -843,14 +843,14 @@
<li class="uk-padding-remove"> <li class="uk-padding-remove">
<a href="#">Overview</a> <a href="#">Overview</a>
</li> </li>
<li *ngIf="totalDownloads ||totalViews"> <li *ngIf="projectInfo.measure.counts[1].value || projectInfo.measure.counts[0].value">
<a href="#" (click)="clickedUsageMetrics()">Usage</a> <a href="#" (click)="clickedUsageMetrics()">Usage</a>
</li> </li>
</ul> </ul>
<ul class="uk-switcher uk-margin-large-top"> <ul class="uk-switcher uk-margin-large-top">
<!-- overview --> <!-- overview -->
<li> <li>
<div *ngIf="totalDownloads || totalViews"> <div *ngIf="projectInfo.measure.counts[1].value || projectInfo.measure.counts[0].value">
<div class="uk-grid-divider" uk-grid> <div class="uk-grid-divider" uk-grid>
<div> <div>
<div class="uk-text-center uk-margin-small-bottom"> <div class="uk-text-center uk-margin-small-bottom">
@ -866,30 +866,30 @@
<div> <div>
<table class="uk-table uk-table-small"> <table class="uk-table uk-table-small">
<tbody> <tbody>
<tr *ngIf="totalDownloads"> <tr *ngIf="projectInfo.measure.counts[1].value">
<td class="uk-padding-remove-top"> <td class="uk-padding-remove-top">
<icon name="download" [flex]="true" [ratio]="1.2" customClass="uk-text-background text-usage-counts"></icon> <icon [name]="projectInfo.measure.counts[1].icon" [flex]="true" [ratio]="1.2" customClass="uk-text-background text-usage-counts"></icon>
</td> </td>
<td class="uk-padding-remove-top"> <td class="uk-padding-remove-top uk-text-capitalize">
Downloads {{projectInfo.measure.counts[1].name}}
</td> </td>
<td class="uk-padding-remove-top uk-text-uppercase uk-text-bolder" <td class="uk-padding-remove-top uk-text-uppercase uk-text-bolder"
[attr.uk-tooltip]="totalDownloads >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'" [attr.uk-tooltip]="projectInfo.measure.counts[1].value >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'"
title="{{totalDownloads | number}}"> title="{{projectInfo.measure.counts[1].value | number}}">
{{formatNumber(totalDownloads)}} {{formatNumber(projectInfo.measure.counts[1].value)}}
</td> </td>
</tr> </tr>
<tr *ngIf="totalViews"> <tr *ngIf="projectInfo.measure.counts[0].value">
<td class="uk-padding-remove-bottom"> <td class="uk-padding-remove-bottom">
<icon name="visibility" [flex]="true" [ratio]="1.2" customClass="uk-text-background text-usage-counts"></icon> <icon [name]="projectInfo.measure.counts[0].icon" [flex]="true" [ratio]="1.2" customClass="uk-text-background text-usage-counts"></icon>
</td> </td>
<td class="uk-padding-remove-bottom"> <td class="uk-padding-remove-bottom uk-text-capitalize">
Views {{projectInfo.measure.counts[0].name}}
</td> </td>
<td class="uk-padding-remove-bottom uk-text-uppercase uk-text-bolder" <td class="uk-padding-remove-bottom uk-text-uppercase uk-text-bolder"
[attr.uk-tooltip]="totalViews >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'" [attr.uk-tooltip]="projectInfo.measure.counts[0].value >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'"
title="{{totalViews | number}}"> title="{{projectInfo.measure.counts[0].value | number}}">
{{formatNumber(totalViews)}} {{formatNumber(projectInfo.measure.counts[0].value)}}
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -899,18 +899,18 @@
</div> </div>
</li> </li>
<!-- usage --> <!-- usage -->
<li *ngIf="totalDownloads || totalViews"> <li *ngIf="projectInfo.measure.counts[1].value || projectInfo.measure.counts[0].value">
<div class="uk-flex uk-flex-center uk-flex-middle uk-flex-wrap" [class.uk-flex-column]="isMobile"> <div class="uk-flex uk-flex-center uk-flex-middle uk-flex-wrap" [class.uk-flex-column]="isMobile">
<div class="uk-margin-large-right uk-flex uk-flex-center uk-flex-middle uk-flex-wrap" [class.uk-flex-column]="!isMobile"> <div class="uk-margin-large-right uk-flex uk-flex-center uk-flex-middle uk-flex-wrap" [class.uk-flex-column]="!isMobile">
<div *ngIf="totalDownloads" class="uk-text-center uk-margin-medium-bottom" [class.uk-margin-medium-right]="isMobile"> <div *ngIf="projectInfo.measure.counts[1].value" class="uk-text-center uk-margin-medium-bottom" [class.uk-margin-medium-right]="isMobile">
<div class="uk-text-background uk-text-bold number metrics-number" [attr.uk-tooltip]="totalDownloads >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'" <div class="uk-text-background uk-text-bold number metrics-number" [attr.uk-tooltip]="projectInfo.measure.counts[1].value >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'"
title="{{totalDownloads | number}}">{{formatNumber(totalDownloads)}}</div> title="{{projectInfo.measure.counts[1].value | number}}">{{formatNumber(projectInfo.measure.counts[1].value)}}</div>
<div class="uk-text-bold">Downloads</div> <div class="uk-text-bold uk-text-capitalize">{{projectInfo.measure.counts[1].name}}</div>
</div> </div>
<div *ngIf="totalViews" class="uk-text-center uk-margin-medium-bottom"> <div *ngIf="projectInfo.measure.counts[0].value" class="uk-text-center uk-margin-medium-bottom">
<div class="uk-text-background uk-text-bold number metrics-number" [attr.uk-tooltip]="totalViews >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'" <div class="uk-text-background uk-text-bold number metrics-number" [attr.uk-tooltip]="projectInfo.measure.counts[0].value >= 1000 ? 'cls: uk-active' : 'cls: uk-invisible'"
title="{{totalViews | number}}">{{formatNumber(totalViews)}}</div> title="{{projectInfo.measure.counts[0].value | number}}">{{formatNumber(projectInfo.measure.counts[0].value)}}</div>
<div class="uk-text-bold">Views</div> <div class="uk-text-bold uk-text-capitalize">{{projectInfo.measure.counts[0].name}}</div>
</div> </div>
</div> </div>
<ng-container *ngIf="viewsFrameUrl || downloadsFrameUrl"> <ng-container *ngIf="viewsFrameUrl || downloadsFrameUrl">

View File

@ -596,7 +596,8 @@ export class ProjectComponent {
} }
public get hasMetrics(): boolean { public get hasMetrics(): boolean {
return !(this.totalViews != null && this.totalDownloads != null) || this.totalViews > 0 || this.totalDownloads > 0; // return !(this.totalViews != null && this.totalDownloads != null) || this.totalViews > 0 || this.totalDownloads > 0;
return this.projectInfo.measure?.counts?.length && (this.projectInfo.measure?.counts[0].value > 0 || this.projectInfo.measure?.counts[1].value);
} }
public viewAllOrganizationsClick() { public viewAllOrganizationsClick() {

View File

@ -236,6 +236,10 @@ export class ProjectService {
this.projectInfo.urlInfo = "Detailed project information (CORDIS)"; this.projectInfo.urlInfo = "Detailed project information (CORDIS)";
} }
if (data[0]?.measure) {
this.projectInfo.measure = this.parsingFunctions.parseMeasures(data[0].measure);
}
return this.projectInfo; return this.projectInfo;
} }

View File

@ -169,6 +169,8 @@ export class SearchDataprovidersService {
if(resData['pid']) { if(resData['pid']) {
result.identifiers = this.parsingFunctions.parseIdentifiers(resData['pid']); result.identifiers = this.parsingFunctions.parseIdentifiers(resData['pid']);
} }
// Measure
result.measure = this.parsingFunctions.parseMeasures(resData['measure']);
results.push(result); results.push(result);
} }

View File

@ -254,6 +254,8 @@ export class SearchProjectsService {
if(resData.hasOwnProperty("enddate")) { if(resData.hasOwnProperty("enddate")) {
result.endYear = resData.enddate.split('-')[0]; result.endYear = resData.enddate.split('-')[0];
} }
// Measure
result.measure = this.parsingFunctions.parseMeasures(resData['measure']);
results.push(result); results.push(result);
} }

View File

@ -1,4 +1,5 @@
import {properties} from "../../../../environments/environment"; import {properties} from "../../../../environments/environment";
import {Measure} from "./resultLandingInfo";
export class DataproviderProvenance { export class DataproviderProvenance {
provenance: Map<string, {"urlPrefix": string, "name": string}>; provenance: Map<string, {"urlPrefix": string, "name": string}>;
@ -36,6 +37,7 @@ export class DataProviderInfo {
identifiers: Map<string, string[]>; //key is the classname identifiers: Map<string, string[]>; //key is the classname
fundedContent: string; // search query fundedContent: string; // search query
measure: Measure;
//collected from datasource api //collected from datasource api
// aggregationStatus: {"fundedContent": string, "indexRecords": string, "fulltexts": string, "lastUpdateDate": string}; // aggregationStatus: {"fundedContent": string, "indexRecords": string, "fulltexts": string, "lastUpdateDate": string};

View File

@ -1,25 +1,26 @@
import {Measure} from "./resultLandingInfo";
export class ProjectInfo { export class ProjectInfo {
id:string; id:string;
acronym: string; acronym: string;
title: string; title: string;
funding: {funderName: string, funderShortName: string, code: string, callIdentifier: string,
funding: {funderName: string, funderShortName: string, code: string, callIdentifier: string, fundingStream: string, budget: string, contribution: string, currency: string};
fundingStream: string, budget: string, contribution: string, currency: string}; startDate: number;
startDate: number; endDate: number;
endDate: number; currentDate: number;
currentDate: number; status: string;
status: string; openAccessMandatePublications: string;
openAccessMandatePublications: string; openAccessMandateDatasets: string;
openAccessMandateDatasets: string; // specialClause39: string;
// specialClause39: string; organizations: { "acronym": string, "name": string, "id": string }[];//Map<string, string>;
organizations: { "acronym": string, "name": string, "id": string }[];//Map<string, string>; url: string;
url: string; urlInfo: string;
urlInfo: string; description: string;
description: string; //publications: any;
//publications: any; researchData: any;
researchData: any; totalPublications: number;
totalDatasets: number;
totalPublications: number; publicationsStatus: any;
totalDatasets: number; measure: Measure;
publicationsStatus: any;
} }

View File

@ -12,10 +12,10 @@
<div class="searchFilterBoxValues "> <div class="searchFilterBoxValues ">
<form [class]="(isDisabled ? 'uk-disabled' : '') + ' uk-flex uk-flex-middle uk-flex-wrap'" [formGroup]="rangeForm"> <form [class]="(isDisabled ? 'uk-disabled' : '') + ' uk-flex uk-flex-middle uk-flex-wrap'" [formGroup]="rangeForm">
<div input [formInput]="rangeForm.get('yearFrom')" [placeholder]="{label: 'e.g. ' + yearMin, static: true}" <div input [formInput]="rangeForm.get('yearFrom')" [placeholder]="{label: 'e.g. ' + yearMin, static: true}"
inputClass="inner small" class=" uk-width-1-3"></div> inputClass="flat small" class=" uk-width-1-3"></div>
<span class="uk-margin-small-left uk-margin-small-right">-</span> <span class="uk-margin-small-left uk-margin-small-right">-</span>
<div input [formInput]="rangeForm.get('yearTo')" [placeholder]="{label: 'e.g. ' + yearMax, static: true}" <div input [formInput]="rangeForm.get('yearTo')" [placeholder]="{label: 'e.g. ' + yearMax, static: true}"
inputClass="inner small" class=" uk-width-1-3"></div> inputClass="flat small" class=" uk-width-1-3"></div>
<button type="submit" (click)="yearChanged()" <button type="submit" (click)="yearChanged()"
[ngStyle]="{'cursor': (rangeForm.valid && (rangeForm.get('yearFrom').dirty || rangeForm.get('yearTo').dirty)) ? 'pointer' : 'default'}" [ngStyle]="{'cursor': (rangeForm.valid && (rangeForm.get('yearFrom').dirty || rangeForm.get('yearTo').dirty)) ? 'pointer' : 'default'}"
class="uk-icon uk-icon-button uk-button-default uk-margin-small-left" class="uk-icon uk-icon-button uk-button-default uk-margin-small-left"

View File

@ -226,7 +226,7 @@
<a class="uk-flex uk-flex-middle uk-margin-small-left uk-link-reset"> <a class="uk-flex uk-flex-middle uk-margin-small-left uk-link-reset">
<icon class="text-usage-counts-hover" [flex]="true" [ratio]="0.8" <icon class="text-usage-counts-hover" [flex]="true" [ratio]="0.8"
[name]="result.measure.counts[0].icon"></icon> [name]="result.measure.counts[0].icon"></icon>
<span class="uk-margin-xsmall-left">{{result.measure.counts[0].value}}</span> <span class="uk-margin-xsmall-left">{{formatNumber(result.measure.counts[0].value)}}</span>
</a> </a>
<div uk-drop="pos: top-right" class="uk-card uk-card-default uk-border uk-box-no-shadow uk-padding-small"> <div uk-drop="pos: top-right" class="uk-card uk-card-default uk-border uk-box-no-shadow uk-padding-small">
<table> <table>
@ -235,7 +235,7 @@
<icon [flex]="true" [ratio]="0.7" [name]="metric.icon"></icon> <icon [flex]="true" [ratio]="0.7" [name]="metric.icon"></icon>
</td> </td>
<td class="uk-text-capitalize">{{metric.name}}</td> <td class="uk-text-capitalize">{{metric.name}}</td>
<td class="uk-text-bolder">{{metric.value}}</td> <td class="uk-text-bolder">{{metric.value | number}}</td>
</tr> </tr>
</table> </table>
<div class="uk-margin-top uk-flex uk-flex-middle uk-flex-center"> <div class="uk-margin-top uk-flex uk-flex-middle uk-flex-center">

View File

@ -7,6 +7,7 @@ import {properties} from "../../../../environments/environment";
import {Identifier, StringUtils} from "../string-utils.class"; import {Identifier, StringUtils} from "../string-utils.class";
import {OpenaireEntities} from "../properties/searchFields"; import {OpenaireEntities} from "../properties/searchFields";
import {HelperFunctions} from "../HelperFunctions.class"; import {HelperFunctions} from "../HelperFunctions.class";
import {NumberUtils} from '../../utils/number-utils.class';
@Component({ @Component({
selector: 'result-preview', selector: 'result-preview',
@ -213,4 +214,9 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
return this.result.resultType == "publication" || this.result.resultType == "dataset" || return this.result.resultType == "publication" || this.result.resultType == "dataset" ||
this.result.resultType == "software" || this.result.resultType == "other" || this.result.resultType == "result"; this.result.resultType == "software" || this.result.resultType == "other" || this.result.resultType == "result";
} }
public formatNumber(num: number | string) {
let formatted = NumberUtils.roundNumber(+num);
return formatted.number + formatted.size;
}
} }