Production release November 2023 v2 #21

Merged
konstantina.galouni merged 3 commits from develop into master 2023-11-10 18:27:48 +01:00
9 changed files with 155 additions and 90 deletions

View File

@ -19,7 +19,7 @@
<li *ngFor="let result of results"> <li *ngFor="let result of results">
<result-preview [properties]="properties" [showOrganizations]="true" <result-preview [properties]="properties" [showOrganizations]="true"
[showSubjects]="true" [result]="getResultPreview(result)" [promoteWebsiteURL]="true" [showSubjects]="true" [result]="getResultPreview(result)" [promoteWebsiteURL]="true"
[isCard]="true" deposit="true"> [isCard]="true" deposit="true" [isMobile]="isMobile">
</result-preview> </result-preview>
</li> </li>
</ul> </ul>

View File

@ -19,6 +19,7 @@ export class SearchResultsInDepositComponent {
@Input() status: number; @Input() status: number;
@Input() type: string; @Input() type: string;
@Input() properties:EnvProperties; @Input() properties:EnvProperties;
@Input() isMobile: boolean = false;
public urlParam: string; public urlParam: string;

View File

@ -1,5 +1,5 @@
import {HostedByCollectedFrom, Project, RelationResult} from "../../utils/result-preview/result-preview"; import {HostedByCollectedFrom, Project, RelationResult} from "../../utils/result-preview/result-preview";
import {Context, Measure, Metric, Reference} from "../../utils/entities/resultLandingInfo"; import {Context, Measure, Metric, MetricPerDatasource, Reference} from "../../utils/entities/resultLandingInfo";
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import {properties} from "../../../../environments/environment"; import {properties} from "../../../../environments/environment";
import {StringUtils} from "../../utils/string-utils.class"; import {StringUtils} from "../../utils/string-utils.class";
@ -878,19 +878,43 @@ export class ParsingFunctions {
if (elements && elements.length) { if (elements && elements.length) {
let bip: Metric[] = []; let bip: Metric[] = [];
let counts: Metric[] = []; let counts: Metric[] = [];
let countsPerDatasource: MetricPerDatasource[] = [];
let measure: Measure = {}; let measure: Measure = {};
let datasourcePosition: Map<string, number> = new Map<string, number>();
let views: number = 0;
let downloads: number = 0;
elements.forEach(element => { elements.forEach(element => {
if (element.id == 'views') { if (element.id == 'views') {
counts.push({name: 'views', icon: 'visibility', value: element.count, order: 0}); views += element.count;
measure.views = element.count; let datasourceId = element.datasource;
if(datasourceId) {
if(datasourcePosition.has(element.datasource)) {
countsPerDatasource[datasourcePosition.get(element.datasource)].views = element.count;
} else {
datasourcePosition.set(element.datasource, countsPerDatasource.length);
countsPerDatasource.push({"datasourceId": element.datasource, "views": element.count, "downloads": 0})
}
}
// measure.views = element.count;
} }
if (element.id == 'downloads') { if (element.id == 'downloads') {
counts.push({name: 'downloads', icon: 'download', value: element.count, order: 1}); downloads += element.count;
measure.downloads = element.count; let datasourceId = element.datasource;
if(datasourceId) {
if(datasourcePosition.has(element.datasource)) {
countsPerDatasource[datasourcePosition.get(element.datasource)].downloads = element.count;
} else {
datasourcePosition.set(element.datasource, countsPerDatasource.length);
countsPerDatasource.push({"datasourceId": element.datasource, "views": 0, "downloads": element.count})
}
}
// measure.downloads = element.count;
} }
if (element.id == 'influence_alt' || element.id == 'citation_count') { if (element.id == 'influence_alt' || element.id == 'citation_count') {
bip.push({name: 'citations', icon: 'cite', value: element.score, order: 2}); bip.push({name: 'citations', icon: 'cite', value: element.score, order: 2});
measure.citations = element.score; // measure.citations = element.score;
} }
if (element.id == 'popularity') { if (element.id == 'popularity') {
let metric: Metric = {name: 'popularity', icon: 'fire', value: null, order: 3}; let metric: Metric = {name: 'popularity', icon: 'fire', value: null, order: 3};
@ -902,14 +926,10 @@ export class ParsingFunctions {
metric.value = 'Top 1%'; metric.value = 'Top 1%';
} else if (element.class == 'C4') { } else if (element.class == 'C4') {
metric.value = 'Top 10%'; metric.value = 'Top 10%';
} else if (element.class == 'A') {
metric.value = 'Exceptional';
} else if (element.class == 'B') {
metric.value = 'Substantial';
} else { } else {
metric.value = 'Average'; metric.value = 'Average';
} }
measure.popularity = metric.value; // measure.popularity = metric.value;
bip.push(metric); bip.push(metric);
} }
if (element.id == 'influence') { if (element.id == 'influence') {
@ -922,14 +942,10 @@ export class ParsingFunctions {
metric.value = 'Top 1%'; metric.value = 'Top 1%';
} else if (element.class == 'C4') { } else if (element.class == 'C4') {
metric.value = 'Top 10%'; metric.value = 'Top 10%';
} else if (element.class == 'A') {
metric.value = 'Exceptional';
} else if (element.class == 'B') {
metric.value = 'Substantial';
} else { } else {
metric.value = 'Average'; metric.value = 'Average';
} }
measure.influence = metric.value; // measure.influence = metric.value;
bip.push(metric); bip.push(metric);
} }
if (element.id == 'impulse') { if (element.id == 'impulse') {
@ -942,17 +958,24 @@ export class ParsingFunctions {
metric.value = 'Top 1%'; metric.value = 'Top 1%';
} else if (element.class == 'C4') { } else if (element.class == 'C4') {
metric.value = 'Top 10%'; metric.value = 'Top 10%';
} else if (element.class == 'A') {
metric.value = 'Exceptional';
} else if (element.class == 'B') {
metric.value = 'Substantial';
} else { } else {
metric.value = 'Average'; metric.value = 'Average';
} }
measure.impulse = metric.value; // measure.impulse = metric.value;
bip.push(metric); bip.push(metric);
} }
}); });
if(views > 0) {
counts.push({name: 'views', icon: 'visibility', value: views, order: 0});
}
if(downloads > 0) {
counts.push({name: 'downloads', icon: 'download', value: downloads, order: 1});
}
if(countsPerDatasource && countsPerDatasource.length > 0) {
measure.countsPerDatasource = countsPerDatasource;
}
measure.bip = bip.sort((a, b) => a.order - b.order); measure.bip = bip.sort((a, b) => a.order - b.order);
measure.counts = counts.sort((a, b) => a.order - b.order); measure.counts = counts.sort((a, b) => a.order - b.order);
return measure; return measure;

View File

@ -1240,6 +1240,24 @@
</div> </div>
</ng-container> </ng-container>
</div> </div>
<div *ngIf="resultLandingInfo.measure.countsPerDatasource" class="uk-margin-medium-top uk-width-auto">
<table class="uk-table uk-table-striped">
<thead>
<tr>
<th class="uk-width-expand uk-width-1-2@xl">Data source</th>
<th class="uk-width-auto uk-text-center">Views</th>
<th class="uk-width-auto uk-text-center">Downloads</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let datasource of resultLandingInfo.measure.countsPerDatasource">
<td class="uk-text-truncate"><a [routerLink]="properties.searchLinkToDataProvider.split('?')[0]" [queryParams]="{'datasourceId': datasource.datasourceId}">{{datasource.datasourceId}}</a></td>
<td class="uk-text-center">{{datasource.views}}</td>
<td class="uk-text-center">{{datasource.downloads}}</td>
</tr>
</tbody>
</table>
</div>
<div class="uk-text-center uk-margin-large-top"> <div class="uk-text-center uk-margin-large-top">
<span class="uk-text-meta">Powered by</span> <span class="uk-text-meta">Powered by</span>
<a href='https://usagecounts.openaire.eu/' target='_blank' class="uk-link-reset"> <a href='https://usagecounts.openaire.eu/' target='_blank' class="uk-link-reset">

View File

@ -23,7 +23,7 @@
<div class = "uk-position-relative"> <div class = "uk-position-relative">
<div class = "uk-width-1-1"> <div class = "uk-width-1-1">
<result-preview [properties]="properties" [showOrcid]="false" [showOrganizations]="true" <result-preview [properties]="properties" [showOrcid]="false" [showOrganizations]="true"
[showSubjects]="true" [result]="result" [promoteWebsiteURL]="true" [showSubjects]="true" [result]="result"
[isCard]="false"> [isCard]="false">
</result-preview> </result-preview>
</div> </div>

View File

@ -10,7 +10,7 @@
<ul class="uk-margin-top uk-list uk-margin search-results "> <ul class="uk-margin-top uk-list uk-margin search-results ">
<li *ngFor="let result of results"> <li *ngFor="let result of results">
<result-preview [properties]="properties" [showOrganizations]="true" <result-preview [properties]="properties" [showOrganizations]="true"
[showSubjects]="true" [result]="getResultPreview(result)" [promoteWebsiteURL]="true" [showSubjects]="true" [result]="getResultPreview(result)"
[isCard]="true"> [isCard]="true">
</result-preview> </result-preview>
</li> </li>

View File

@ -345,7 +345,8 @@
[status]="searchUtils.status" [status]="searchUtils.status"
[type]="entityType" [type]="entityType"
[zenodoInformation]="zenodoInformation" [zenodoInformation]="zenodoInformation"
[properties]=properties> [properties]=properties
[isMobile]="mobile">
</deposit-result> </deposit-result>
<orcid-result *ngIf="usedBy == 'orcid'" <orcid-result *ngIf="usedBy == 'orcid'"
[results]="results" [results]="results"

View File

@ -30,20 +30,28 @@ export interface Context {
} }
export interface Measure { export interface Measure {
/** @deprecated*/ // /** @deprecated*/
downloads?: string; // downloads?: string;
/** @deprecated*/ // /** @deprecated*/
views?: string; // views?: string;
/** @deprecated*/ // /** @deprecated*/
influence?: string; // influence?: string;
/** @deprecated*/ // /** @deprecated*/
popularity?: string; // popularity?: string;
/** @deprecated*/ // /** @deprecated*/
citations?: string; // citations?: string;
/** @deprecated*/ // /** @deprecated*/
impulse?: string; // impulse?: string;
bip?: Metric[] bip?: Metric[]
counts?: Metric[] counts?: Metric[]
countsPerDatasource?: MetricPerDatasource[];
}
export interface MetricPerDatasource {
datasourceId: string,
// datasourceName: string,
views: number,
downloads: number
} }
export interface Metric { export interface Metric {

View File

@ -20,6 +20,19 @@
<div class="uk-margin-small-bottom"> <div class="uk-margin-small-bottom">
<!-- Title --> <!-- Title -->
<div class="uk-grid"> <div class="uk-grid">
<div [ngClass]="result.websiteURL && promoteWebsiteURL && !isMobile ? 'uk-flex uk-flex-between uk-width-1-1' : 'uk-width-expand'">
<div *ngIf="result.websiteURL && promoteWebsiteURL" class="uk-flex uk-flex-right"
[ngClass]="isMobile ? 'uk-width-1-1 uk-margin-small-bottom' : 'uk-flex-last uk-margin-left uk-width-auto'">
<span>
<a href="{{result.websiteURL}}" target="_blank" type="submit"
class="uk-float-right uk-margin-small-left uk-display-inline-block uk-text-uppercase uk-button uk-button-text">
<span class="uk-flex uk-flex-middle">
<icon name="file_upload" type="outlined" [flex]="true" class="uk-margin-small-right"></icon>
<span>Go to repository</span>
</span>
</a>
</span>
</div>
<div class="multi-line-ellipsis lines-3 uk-width-expand"> <div class="multi-line-ellipsis lines-3 uk-width-expand">
<h2 class="uk-margin-remove uk-text-break uk-inline-block uk-h6"> <h2 class="uk-margin-remove uk-text-break uk-inline-block uk-h6">
<a *ngIf="!externalUrl && result.id" (click)="onClick()" [queryParams]="addEoscPrevInParams(createParam())" <a *ngIf="!externalUrl && result.id" (click)="onClick()" [queryParams]="addEoscPrevInParams(createParam())"
@ -66,6 +79,7 @@
</div> </div>
</h2> </h2>
</div> </div>
</div>
<div *ngIf="result.hostedBy_collectedFrom && result.hostedBy_collectedFrom.length > 0" class="uk-hidden@m uk-width-auto"> <div *ngIf="result.hostedBy_collectedFrom && result.hostedBy_collectedFrom.length > 0" class="uk-hidden@m uk-width-auto">
<div class="uk-margin-small-bottom uk-flex uk-flex-middle" <div class="uk-margin-small-bottom uk-flex uk-flex-middle"
[ngClass]="(result.hostedBy_collectedFrom[0].accessRightIcon == 'open_access' ? 'open-access' : 'closed-access')" [ngClass]="(result.hostedBy_collectedFrom[0].accessRightIcon == 'open_access' ? 'open-access' : 'closed-access')"
@ -158,17 +172,17 @@
</div> </div>
</div> </div>
<!-- 5th section(deposit only) --> <!-- 5th section(deposit only) -->
<div> <!-- <div>-->
<span *ngIf="result.websiteURL && promoteWebsiteURL" class="uk-flex uk-flex-right uk-margin-small-top"> <!-- <span *ngIf="result.websiteURL && promoteWebsiteURL" class="uk-flex uk-flex-right uk-margin-small-top">-->
<a href="{{result.websiteURL}}" target="_blank" type="submit" <!-- <a href="{{result.websiteURL}}" target="_blank" type="submit"-->
class="uk-float-right uk-margin-small-left uk-display-inline-block uk-text-uppercase uk-button uk-button-text"> <!-- class="uk-float-right uk-margin-small-left uk-display-inline-block uk-text-uppercase uk-button uk-button-text">-->
<span class="uk-flex uk-flex-middle"> <!-- <span class="uk-flex uk-flex-middle">-->
<icon name="file_upload" type="outlined" [flex]="true" class="uk-margin-small-right"></icon> <!-- <icon name="file_upload" type="outlined" [flex]="true" class="uk-margin-small-right"></icon>-->
<span>Go to repository</span> <!-- <span>Go to repository</span>-->
</span> <!-- </span>-->
</a> <!-- </a>-->
</span> <!-- </span>-->
</div> <!-- </div>-->
</div> </div>
</div> </div>
<div *ngIf="(result.hostedBy_collectedFrom || hasActions || result.measure?.bip.length || result.measure?.counts.length) && !isDeletedByInferenceModal" <div *ngIf="(result.hostedBy_collectedFrom || hasActions || result.measure?.bip.length || result.measure?.counts.length) && !isDeletedByInferenceModal"