Compare commits

...

19 Commits

Author SHA1 Message Date
Konstantina Galouni 234b12be9d Updating openaireLibrary 2024-05-21 13:17:19 +03:00
Konstantina Galouni 5789293ffe Merge pull request 'Merge on-push-strategy branch into develop (on push strategy in result-preview component, i.e. search result cards)' (#15) from on-push-strategy into develop
Reviewed-on: #15
2024-05-21 12:16:29 +02:00
Konstantina Galouni 83f01d8aa1 Updating openaireLibrary & openaire-theme 2024-05-21 13:11:36 +03:00
Konstantina Galouni 0a20d80c4c Updating libraries 2024-04-30 14:47:53 +03:00
Konstantina Galouni 8a3e859132 Merge remote-tracking branch 'origin/develop' into on-push-strategy 2024-04-30 14:47:25 +03:00
Konstantina Galouni ca41e89465 [develop | DONE | CHANGED]: Updated color of selected search filter labels (not purple, but portal color).
1. newSearchPage.component.html: Replaced class "uk-label-search-filter" with "uk-label-secondary" on selected search filter labels.
2. color.less: Removed color variable @search-filter-color: #B41FD0;
3. label.less: Removed custom color variables and class "uk-label-search-filter" | Updated class "uk-label-secondary".
4. explore-custom.less: Override @uk-label-secondary: @explore-color;
2024-04-30 13:08:54 +03:00
Konstantina Galouni e563886f8a Updating openaireLibrary 2024-04-24 16:36:18 +03:00
Konstantina Galouni d1b482c189 Updating openaireLibrary 2024-04-24 16:09:14 +03:00
Konstantina Galouni 443f90d2e9 Updating openaireLibrary 2024-04-23 16:59:46 +03:00
Konstantina Galouni 8d0f711064 Updating openaireLibrary 2024-04-23 16:04:02 +03:00
Konstantina Galouni 0f639ec210 Updating openaireLibrary 2024-04-22 17:27:15 +03:00
Konstantina Galouni d9647d2a46 Updating openaireLibrary 2024-04-16 16:22:05 +03:00
Konstantina Galouni b79dbd20ec Updating libraries 2024-04-16 16:10:41 +03:00
Konstantina Galouni ccae7b03a5 [develop | DONE | CHANGED]: funders.component.ts: Added alt attribute on funders image and removed loading="lazy" | home.component.html: Updated header elements to make them as sequential as possible (SEO & PageSpeed). 2024-04-16 12:41:13 +03:00
Alex Martzios 59f3e8dae9 [develop | DONE | CHANGED] update submodules 2024-04-11 16:34:50 +03:00
Alex Martzios 09b7435243 [develop | DONE | ADDED] funders page: update cards and lists to prepare for new data to be shown 2024-04-08 19:10:44 +03:00
argirok 260b263e6f [develop | DONE | CHANGED] cache.js add compression library, reload content based on forceReload parameter or cache control headers 2024-04-03 10:20:58 +03:00
Alex Martzios d42a3973bd [develop | DONE | ADDED] update submodules for bulk deletion functionality for claims 2024-03-28 13:07:54 +02:00
Konstantina Galouni 37358b14db [develop | DONE | FIXED]: CHANGELOG.md: Spelling error fix. 2024-03-05 13:59:37 +02:00
10 changed files with 180 additions and 122 deletions

View File

@ -29,7 +29,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed ### Fixed
* z-index issue in dropdowns inside modals * z-index issue in dropdowns inside modals
* Change search tab from menu * Change search tab from menu
* Requests in bulk DOIs upload in linkinh * Requests in bulk DOIs upload in linking
* View all for search filters * View all for search filters
* Research products detailed page: Provenance label in funded by * Research products detailed page: Provenance label in funded by

View File

@ -62,7 +62,7 @@
</div> </div>
</div> </div>
<div class="uk-width-1-2@m uk-width-1-1 uk-text-center" uk-scrollspy-class> <div class="uk-width-1-2@m uk-width-1-1 uk-text-center" uk-scrollspy-class>
<img src="assets/explore-assets/funders/funders.png" loading="lazy"> <img src="assets/explore-assets/funders/funders.png" alt="Funders advertisement image">
</div> </div>
</div> </div>
</div> </div>
@ -121,88 +121,105 @@
No funders available No funders available
</div> </div>
<div class="uk-grid uk-grid-match uk-padding-small" [ngClass]="gridView ? 'uk-child-width-1-2@m uk-child-width-1-3@l' : 'uk-child-width-1-1'" <div class="uk-grid uk-grid-match uk-padding-small" [ngClass]="gridView ? 'uk-child-width-1-2@m uk-child-width-1-3@l' : 'uk-child-width-1-1'"
uk-grid uk-height-match="target: .info;"> uk-grid uk-height-match="target: .data;">
<div *ngFor="let funder of displayedFunders.slice((currentPage-1)*pageSize, currentPage*pageSize)"> <div *ngFor="let funder of displayedFunders.slice((currentPage-1)*pageSize, currentPage*pageSize)">
<!-- funder's card for GRID view --> <!-- funder's card for GRID view -->
<ng-container *ngIf="gridView || isMobile; else elseBlock"> <ng-container *ngIf="gridView || isMobile; else elseBlock">
<div class="uk-card uk-card-default uk-card-hover funder-grid"> <div class="uk-card uk-card-default uk-card-hover funder-grid">
<!-- OA % --> <!-- <div class="uk-position-top-left uk-padding-small">
<!-- <div class="percentage uk-flex uk-flex-right uk-margin-bottom">--> <span class="uk-text-xsmall">flag</span>
<div class="uk-position-top-right uk-padding-small"> </div> -->
<div *ngIf="funder.openAccessResearchProducts && funder.researchProducts" class="uk-text-center"> <!-- <div class="uk-position-top-right uk-padding-small">
<div class="uk-flex uk-flex-middle uk-flex-center"> <div class="uk-flex uk-flex-middle uk-text-xsmall uk-text-meta">
<span class="uk-margin-xsmall-right open-access"> <div class="uk-icon-bg uk-icon-bg-small">
<icon name="open_access" [flex]="true" [ratio]="1"></icon> <icon name="done" [flex]="true"></icon>
</span>
<h6 class="uk-margin-remove">{{funder.openAccessPercentage}}%</h6>
</div> </div>
<span class="uk-h6 uk-text-small">Open Access</span> <span class="uk-margin-xsmall-left">Registered</span>
</div> </div>
</div> -->
<div class="uk-card-media-top uk-margin-medium-top uk-padding-large uk-padding-remove-vertical uk-flex uk-flex-center uk-flex-middle uk-height-xsmall">
<img *ngIf="funder.logoUrl; else elseBlock" [src]="funder | logoUrl" [alt]="funder.name + ' logo'" class="uk-height-max-xsmall uk-blend-multiply" loading="lazy">
<ng-template #elseBlock>
<img src="assets/common-assets/placeholder.png" alt="OpenAIRE placeholder logo" class="uk-height-max-xsmall uk-blend-multiply" loading="lazy">
</ng-template>
</div> </div>
<div class="uk-card-body"> <div class="uk-padding-small uk-padding-remove-vertical uk-padding-remove-left uk-margin-medium-left">
<!-- funder logo --> <!-- alias -->
<div class="uk-card-media-top uk-margin-medium-top uk-padding-large uk-padding-remove-vertical uk-flex uk-flex-center uk-flex-middle uk-height-xsmall">
<img *ngIf="funder.logoUrl; else elseBlock" [src]="funder | logoUrl" [alt]="funder.name + ' logo'" class="uk-height-max-xsmall uk-blend-multiply" loading="lazy">
<ng-template #elseBlock>
<img src="assets/common-assets/placeholder.png" alt="OpenAIRE placeholder logo" class="uk-height-max-xsmall uk-blend-multiply" loading="lazy">
</ng-template>
</div>
<!-- funder alias -->
<div class="alias uk-text-uppercase uk-text-small uk-margin-top type"> <div class="alias uk-text-uppercase uk-text-small uk-margin-top type">
<ng-container *ngIf="funder.alias"> <ng-container *ngIf="funder.alias">
{{funder.alias}} {{funder.alias}}
</ng-container> </ng-container>
</div> </div>
<!-- funder name --> <div class="uk-flex">
<div class="name uk-h6 uk-margin-remove multi-line-ellipsis lines-2"> <div class="uk-width-expand name uk-h6 uk-margin-remove multi-line-ellipsis lines-2">
<ng-container *ngIf="funder.name" > <ng-container *ngIf="funder.name" >
{{funder.name}} <span>{{funder.name}}</span>
</ng-container> </ng-container>
</div>
<!-- <div class="uk-width-auto uk-margin-left">
<a href="" class="uk-flex-inline uk-flex-middle uk-text-uppercase uk-button uk-button-text custom-external">
<icon name="payment" [flex]="true"></icon>
</a>
</div> -->
</div> </div>
<div class="info uk-margin-medium-top"> </div>
<!-- Monitor dashboard --> <div class="data uk-background-muted uk-flex uk-flex-middle uk-padding-small uk-padding-remove-left uk-margin-top">
<div class="monitor-dashboard"> <div class="uk-flex uk-flex-middle uk-width-1-1 uk-child-width-1-2 uk-margin-medium-left">
<!-- PUBLIC status -->
<a *ngIf="funder.monitorDashboard && funder.monitorDashboardStatus != 'PRIVATE' && funder.monitorDashboardStatus != 'RESTRICTED'"
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text"
target="_blank" [href]="'https://'+(properties.environment =='beta' || properties.environment =='development'?'beta.':'')+'monitor.openaire.eu/dashboard/'+funder.alias">
<span class="uk-flex uk-flex-middle">
<img src="assets/common-assets/common/Symbol.png" alt="OpenAIRE logo"
class="uk-margin-xsmall-right" style="width: 17px; height: 17px;" loading="lazy">
<span class="monitor-dashboard-link uk-text-uppercase">Monitor Dashboard</span>
</span>
</a>
<!-- RESTRICTED status -->
<span *ngIf="funder.monitorDashboard && funder.monitorDashboardStatus == 'RESTRICTED'"
class="uk-flex uk-flex-middle">
<img src="assets/common-assets/common/Symbol.png" alt="OpenAIRE logo"
class="uk-margin-xsmall-right" style="width: 17px; height: 17px;" loading="lazy">
<span class="monitor-dashboard-link uk-text-uppercase uk-text-bold uk-text-small">Monitor Dashboard</span>
<icon class="uk-margin-xsmall-left" name="closed_access" [flex]="true" [ratio]="1"></icon>
</span>
</div>
<!-- Projects -->
<div> <div>
<a *ngIf="funder.projects" <!-- Projects -->
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text" <div *ngIf="funder.projects" class="uk-flex uk-flex-column" [class.uk-margin-small-bottom]="funder.researchProducts">
[routerLink]="properties.searchLinkToProjects" [queryParams]="{'funder': urlEncodeAndQuote(funder.id)}"> <span class="uk-text-meta uk-text-xsmall">
<span class="uk-flex uk-flex-middle"> Projects
<span>Projects ({{funder.projects | number}})</span>
</span> </span>
</a> <a
class="uk-link-text uk-text-large uk-text-bold"
[routerLink]="properties.searchLinkToProjects" [queryParams]="{'funder': urlEncodeAndQuote(funder.id)}">
<span>
{{funder.projects | number}}
</span>
</a>
</div>
<!-- Research products -->
<div *ngIf="funder.researchProducts" class="uk-flex uk-flex-column">
<span class="uk-text-meta uk-text-xsmall">
Research Products
</span>
<a
class="uk-link-text uk-text-large uk-text-bold"
[routerLink]="properties.searchLinkToResults" [queryParams]="{'relfunder': urlEncodeAndQuote(funder.id)}">
<span>
{{funder.researchProducts | number}}
</span>
</a>
</div>
</div> </div>
<!-- Research products --> <div class="uk-flex uk-flex-column uk-flex-middle uk-flex-center">
<div> <div class="uk-progress-semicircle uk-progress-semicircle-small" [attr.percentage]="funder.openAccessPercentage" [style]="'--percentage:' + funder.openAccessPercentage"></div>
<a *ngIf="funder.researchProducts" <div class="uk-flex uk-flex-middle uk-margin-top">
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text" <icon class="open-access" [name]="'open_access'" [flex]="true" [ratio]="0.8"></icon>
[routerLink]="properties.searchLinkToResults" [queryParams]="{'relfunder': urlEncodeAndQuote(funder.id)}"> <span class="uk-text-xsmall uk-margin-xsmall-left">Open Access</span>
<span class="uk-flex uk-flex-middle"> </div>
<span>Research Products ({{funder.researchProducts | number}})</span>
</span>
</a>
</div> </div>
</div> </div>
</div> </div>
<div class="monitor-dashboard uk-padding-small uk-padding-remove-left uk-margin-medium-left">
<a *ngIf="funder.monitorDashboard && funder.monitorDashboardStatus != 'PRIVATE' && funder.monitorDashboardStatus != 'RESTRICTED'"
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text"
target="_blank" [href]="'https://'+(properties.environment =='beta' || properties.environment =='development'?'beta.':'')+'monitor.openaire.eu/dashboard/'+funder.alias">
<span class="uk-flex uk-flex-middle">
<img src="assets/common-assets/common/Symbol.png" alt="OpenAIRE logo"
class="uk-margin-xsmall-right" style="width: 17px; height: 17px;" loading="lazy">
<span class="monitor-dashboard-link uk-text-uppercase">Monitor Dashboard</span>
</span>
</a>
<span *ngIf="funder.monitorDashboard && funder.monitorDashboardStatus == 'RESTRICTED'"
class="uk-flex uk-flex-middle">
<img src="assets/common-assets/common/Symbol.png" alt="OpenAIRE logo"
class="uk-margin-xsmall-right" style="width: 17px; height: 17px;" loading="lazy">
<span class="monitor-dashboard-link uk-text-uppercase uk-text-bold uk-text-small">Monitor Dashboard</span>
<icon class="uk-margin-xsmall-left" name="closed_access" [flex]="true" [ratio]="1"></icon>
</span>
</div>
</div> </div>
</ng-container> </ng-container>
<!-- funder's card for LIST view --> <!-- funder's card for LIST view -->
@ -216,19 +233,22 @@
<img src="assets/common-assets/placeholder.png" alt="OpenAIRE placeholder logo" class="uk-height-max-xsmall uk-blend-multiply" loading="lazy"> <img src="assets/common-assets/placeholder.png" alt="OpenAIRE placeholder logo" class="uk-height-max-xsmall uk-blend-multiply" loading="lazy">
</ng-template> </ng-template>
</div> </div>
<div class="uk-width-expand uk-margin-medium-left"> <div class="uk-width-expand uk-grid uk-grid-divider uk-child-width-1-2 uk-margin-left" uk-grid>
<div class="name uk-h6 uk-text-truncate"> <div class="uk-flex uk-flex-column uk-flex-center">
<ng-container *ngIf="funder.name"> <div class="uk-flex uk-flex-middle">
{{funder.name}} <!-- <span class="uk-text-xsmall uk-margin-small-right">flag</span> -->
</ng-container> <div class="uk-h6 uk-margin-remove uk-text-truncate">
<ng-container *ngIf="funder.alias" > <ng-container *ngIf="funder.name">
<span class="uk-text-uppercase"> <span>{{funder.name}}</span>
({{funder.alias}}) </ng-container>
</span> <ng-container *ngIf="funder.alias" >
</ng-container> <span class="uk-text-uppercase">
</div> ({{funder.alias}})
<div class="uk-grid uk-grid-divider uk-flex-nowrap" uk-grid> </span>
<div *ngIf="funder.monitorDashboard"> </ng-container>
</div>
</div>
<div *ngIf="funder.monitorDashboard" class="uk-margin-top">
<a *ngIf="funder.monitorDashboard && funder.monitorDashboardStatus != 'PRIVATE' && funder.monitorDashboardStatus != 'RESTRICTED'" <a *ngIf="funder.monitorDashboard && funder.monitorDashboardStatus != 'PRIVATE' && funder.monitorDashboardStatus != 'RESTRICTED'"
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text"
target="_blank" [href]="'https://'+(properties.environment =='beta' || properties.environment =='development'?'beta.':'')+'monitor.openaire.eu/dashboard/'+funder.alias"> target="_blank" [href]="'https://'+(properties.environment =='beta' || properties.environment =='development'?'beta.':'')+'monitor.openaire.eu/dashboard/'+funder.alias">
@ -246,44 +266,70 @@
<icon class="uk-margin-xsmall-left" name="closed_access" [flex]="true" [ratio]="1"></icon> <icon class="uk-margin-xsmall-left" name="closed_access" [flex]="true" [ratio]="1"></icon>
</span> </span>
</div> </div>
</div>
<div class="uk-flex uk-flex-middle uk-child-width-1-3">
<div> <div>
<a *ngIf="funder.projects" <div *ngIf="funder.projects" class="uk-flex uk-flex-column">
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text" <span class="uk-text-meta uk-text-xsmall">
[routerLink]="properties.searchLinkToProjects" [queryParams]="{'funder': urlEncodeAndQuote(funder.id)}"> Projects
<span class="uk-flex uk-flex-middle">
<span>Projects ({{funder.projects | number}})</span>
</span> </span>
</a> <a
class="uk-link-text uk-text-large uk-text-bold"
[routerLink]="properties.searchLinkToProjects" [queryParams]="{'funder': urlEncodeAndQuote(funder.id)}">
<span>
{{funder.projects | number}}
</span>
</a>
</div>
</div> </div>
<div> <div>
<a *ngIf="funder.researchProducts" <div *ngIf="funder.researchProducts" class="uk-flex uk-flex-column">
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text" <span class="uk-text-meta uk-text-xsmall">
[routerLink]="properties.searchLinkToResults" [queryParams]="{'relfunder': urlEncodeAndQuote(funder.id)}"> Research Products
<span class="uk-flex uk-flex-middle">
<span>Research Products ({{funder.researchProducts | number}})</span>
</span> </span>
</a> <a
class="uk-link-text uk-text-large uk-text-bold"
[routerLink]="properties.searchLinkToResults" [queryParams]="{'relfunder': urlEncodeAndQuote(funder.id)}">
<span>
{{funder.researchProducts | number}}
</span>
</a>
</div>
</div>
<div>
<div *ngIf="funder.openAccessResearchProducts && funder.researchProducts" class="uk-flex uk-flex-column">
<span class="uk-text-meta uk-text-xsmall">Open Access</span>
<div class="uk-flex uk-flex-middle">
<span class="uk-margin-xsmall-right open-access">
<icon name="open_access" [flex]="true" [ratio]="0.8"></icon>
</span>
<span class="uk-text-large uk-text-bold">{{funder.openAccessPercentage}}%</span>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="uk-width-auto uk-flex uk-flex-middle uk-flex-center"> <!-- <div class="uk-width-auto uk-flex uk-flex-column uk-flex-center uk-margin-right">
<div *ngIf="funder.openAccessResearchProducts && funder.researchProducts" class="uk-text-center"> <div class="uk-flex uk-flex-middle uk-text-xsmall uk-text-meta uk-margin-bottom">
<div class="uk-flex uk-flex-middle uk-flex-center"> <div class="uk-icon-bg uk-icon-bg-small">
<span class="uk-margin-xsmall-right open-access"> <icon name="done" [flex]="true"></icon>
<icon name="open_access" [flex]="true" [ratio]="1"></icon>
</span>
<h6 class="uk-margin-remove">{{funder.openAccessPercentage}}%</h6>
</div> </div>
<span class="uk-h6 uk-text-small">Open Access</span> <span class="uk-margin-xsmall-left">Registered</span>
</div> </div>
</div> <div>
<a href="" class="uk-flex-inline uk-flex-middle uk-text-uppercase uk-button uk-button-text custom-external">
<icon name="payment" [flex]="true"></icon>
</a>
</div>
</div> -->
</div> </div>
</div> </div>
</ng-template> </ng-template>
</div> </div>
</div> </div>
</div> </div>
<paging-no-load *ngIf="displayedFunders.length > pageSize" <paging-no-load *ngIf="displayedFunders.length > pageSize"
(pageChange)="updateCurrentPage($event)" (pageChange)="updateCurrentPage($event)"
[currentPage]="currentPage" [size]="pageSize" [currentPage]="currentPage" [size]="pageSize"

View File

@ -38,11 +38,11 @@
} }
} }
.uk-card { // .uk-card {
&.funder-grid { // &.funder-grid {
border-bottom: 4px solid fade(@funder-color, 30%); // border-bottom: 4px solid fade(@funder-color, 30%);
} // }
&.funder-list { // &.funder-list {
border-left: 4px solid fade(@funder-color, 30%); // border-left: 4px solid fade(@funder-color, 30%);
} // }
} // }

View File

@ -81,7 +81,7 @@
<ng-container *ngFor="let type of getKeys(logos)"> <ng-container *ngFor="let type of getKeys(logos)">
<li *ngFor="let range of createRange(logos[type].length) let j=index" <li *ngFor="let range of createRange(logos[type].length) let j=index"
class="uk-width-1-1 home-logo"> class="uk-width-1-1 home-logo">
<h1 class="uk-text-center uk-margin-bottom uk-text-primary uk-h4"> <h2 class="uk-text-center uk-margin-bottom uk-text-primary uk-h4">
<span *ngIf="type=='publication' && numbersComponent.showPublications && numbers?.publicationsSize"> <span *ngIf="type=='publication' && numbersComponent.showPublications && numbers?.publicationsSize">
<span <span
class="uk-text-bold">{{numbers.publicationsSize.number|number}}{{numbers.publicationsSize.size}} class="uk-text-bold">{{numbers.publicationsSize.number|number}}{{numbers.publicationsSize.size}}
@ -119,7 +119,7 @@
funded grants</span> funded grants</span>
</span> </span>
</h1> </h2>
<div class="uk-text-center uk-flex uk-flex-center uk-margin-medium-left uk-margin-medium-right"> <div class="uk-text-center uk-flex uk-flex-center uk-margin-medium-left uk-margin-medium-right">
<ng-container *ngTemplateOutlet="_logos; context: { logo: logos[type][j], class: ' '}"></ng-container> <ng-container *ngTemplateOutlet="_logos; context: { logo: logos[type][j], class: ' '}"></ng-container>
<!-- <div--> <!-- <div-->
@ -173,9 +173,9 @@
</slider-column> </slider-column>
<slider-column type="nav" class="slider-nav"> <slider-column type="nav" class="slider-nav">
<slider-nav-item [start]="0"> <slider-nav-item [start]="0">
<h6> <h3 class="uk-h6">
<i class="uk-text-primary">Deposit</i> your research<span class="uk-text-primary">.</span> <i class="uk-text-primary">Deposit</i> your research<span class="uk-text-primary">.</span>
</h6> </h3>
<div class="uk-margin-bottom"> <div class="uk-margin-bottom">
Whether its publications, data or software, Whether its publications, data or software,
select an OpenAIRE compatible repository and select an OpenAIRE compatible repository and
@ -190,9 +190,9 @@
</div> </div>
</slider-nav-item> </slider-nav-item>
<slider-nav-item [start]="1"> <slider-nav-item [start]="1">
<h6> <h3 class="uk-h6">
<i class="uk-text-primary">Link</i> your work<span class="uk-text-primary">.</span> <i class="uk-text-primary">Link</i> your work<span class="uk-text-primary">.</span>
</h6> </h3>
<div class="uk-margin-bottom"> <div class="uk-margin-bottom">
Connect all your research. If you can't find your research Connect all your research. If you can't find your research
results in OpenAIRE, don't worry! Use our Link service, results in OpenAIRE, don't worry! Use our Link service,

@ -1 +1 @@
Subproject commit e0de892998d76b2236babf3439ed532e4501145d Subproject commit d6a2ba004a3f6e793fc13f05c977653b51480dc2

@ -1 +1 @@
Subproject commit 651102a5ba049b71bed8eb6a85a8d02cefcb24cc Subproject commit e48bf941bcdc567a3d09826b5686e70d43fafd46

View File

@ -48,3 +48,5 @@
color: @secondary-color; color: @secondary-color;
} }
} }
@uk-label-secondary: @explore-color;

@ -1 +1 @@
Subproject commit 37639eab68c63a506b7df10c42e3379c4a05d94d Subproject commit 9b68a23c7126afb2697fe0e0157878f5240e4956

View File

@ -6,6 +6,7 @@ const { LRUCache } = require('lru-cache');
const request = require('superagent'); const request = require('superagent');
const prom = require('prom-client'); const prom = require('prom-client');
const URL = require('url'); const URL = require('url');
let compression = require("compression");
const PropertiesReader = require('properties-reader'); const PropertiesReader = require('properties-reader');
const properties = PropertiesReader('./properties.file'); const properties = PropertiesReader('./properties.file');
const environment = properties.get("environment"); const environment = properties.get("environment");
@ -14,6 +15,7 @@ const preloadRequests = properties.get("preloadRequests").split(',');;
const cacheMaxSize = 1000; const cacheMaxSize = 1000;
let cors = require('cors'); let cors = require('cors');
app.use(cors()); app.use(cors());
app.use(compression());
const lruCache = new LRUCache({ max: cacheMaxSize }); const lruCache = new LRUCache({ max: cacheMaxSize });
const register = new prom.Registry(); const register = new prom.Registry();
prom.collectDefaultMetrics({register: register}); prom.collectDefaultMetrics({register: register});
@ -42,18 +44,25 @@ const histogram = new prom.Histogram({
let cache = () => { let cache = () => {
return (req, res, next) => { return (req, res, next) => {
if (req.query.url) { if (req.query.url) {
let key = '__express__' + req.query.url; let key = req.query.url;
const url = new URL.parse(req.query.url); const url = new URL.parse(req.query.url);
// console.log(req.headers.origin, req.headers.referrer, req.headers.origin)
const cacheControlHeader = req.headers['cache-control'];
// Log the Cache-Control header
// console.log('Cache-Control header sent by client:', cacheControlHeader);
let forceReload = req.query.forceReload && req.query.forceReload == 'true'?true:false;
forceReload = forceReload || (cacheControlHeader && (cacheControlHeader.indexOf("no-cache") || cacheControlHeader.indexOf("no-store") || cacheControlHeader.indexOf("must-revalidate")))?true:false;
const target = url.host + '/' + url.pathname.split('/')[1]; const target = url.host + '/' + url.pathname.split('/')[1];
const scheme = url.protocol.replace(':', ''); const scheme = url.protocol.replace(':', '');
if (lruCache.has(key)) { if (lruCache.has(key) && !forceReload) {
// console.log( key, "hit") // console.log( key, "hit")
const end = histogram.startTimer({scheme: scheme, target: target, cache: 'hit'}); const end = histogram.startTimer({scheme: scheme, target: target, cache: 'hit'});
res.send(JSON.parse(lruCache.get(key))); res.send(JSON.parse(lruCache.get(key)));
responses.inc({scheme: scheme, target: target, code: res.statusCode}); responses.inc({scheme: scheme, target: target, code: res.statusCode});
end(); end();
} else { } else {
// console.log( key, "miss") // console.log( key, "miss", forceReload)
const end = histogram.startTimer({scheme: scheme, target: target, cache: 'miss'}); const end = histogram.startTimer({scheme: scheme, target: target, cache: 'miss'});
res.sendResponse = res.send; res.sendResponse = res.send;
res.send = (body) => { res.send = (body) => {
@ -85,9 +94,9 @@ let cache = () => {
}; };
function isAllowedToBeCached(scheme, target){ function isAllowedToBeCached(scheme, target){
if(environment != "development"){ if(environment != "development"){
return scheme.indexOf("https")!=-1 && ( target.indexOf(".openaire.eu/") !=-1 || target.indexOf(".zenodo.org/api/") !=-1 || target.indexOf("lab.idiap.ch/enermaps" != -1)) return scheme.indexOf("https")!=-1 && ( target.indexOf(".openaire.eu/") !=-1 || target.indexOf("zenodo.org/api") !=-1 || target.indexOf("lab.idiap.ch/enermaps" != -1))
} else if(environment == "development"){ } else if(environment == "development"){
return target.indexOf(".openaire.eu/") !=-1 || target.indexOf(".di.uoa.gr") !=-1 || target.indexOf("dev-openaire.d4science.org") !=-1 || target.indexOf("lab.idiap.ch/enermaps") != -1 return target.indexOf(".openaire.eu/") !=-1 || target.indexOf(".di.uoa.gr") !=-1 || target.indexOf("zenodo.org/api") !=-1 || target.indexOf("dev-openaire.d4science.org") !=-1 || target.indexOf("lab.idiap.ch/enermaps") != -1
} }
return true; return true;
} }

View File

@ -11,6 +11,7 @@
}, },
"dependencies": { "dependencies": {
"axios": "^1.6.7", "axios": "^1.6.7",
"compression": "^1.7.4",
"cors": "^2.8.5", "cors": "^2.8.5",
"express": "^4.18.2", "express": "^4.18.2",
"lru-cache": "^10.2.0", "lru-cache": "^10.2.0",