From f22a0bc8061125f6352b15efeb70e7c43a001310 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 20 Apr 2023 20:06:53 +0300 Subject: [PATCH] [Library | develop & Eosc Explore | develop]: Added font-family "Inter" to align with Marketplace | Updated how back button "Go to search" is build - combine referrer and the new url parameter "pv", which is expected to have the previous url path and params. 1. /assets: Added /media/fonts/inter folder with the "Inter" font-family. 2. eosc-custom.less: Override the default font family to use 'Inter', sans-serif. 3. routerHelper.class.ts: Added method "addQueryParam()" to add a query parameter in already existing or not object with parameters. 4. search-tab.component.ts & searchResult.component & projects-in-modal.component.ts & result/deletedByInference/deletedByInference.component.ts & organization/deletedByInference/deletedByInference.component.ts: Added @Input() prevPath: string = ""; and pass it to the appropriate children components. 5. result-preview.component & fundedBy.component.ts & availableOn.component.ts & relatedDatasourcesTab.component.ts: Added @Input() prevPath: string = ""; and method "addEoscPrevInParams()" and call it when building queryParams of internal links. 6. metrics.component.ts: Added @Input() prevPath: string = ""; and use it when building internal urls. 7. resultLanding.component.ts & project.component.ts & organization.component.ts & dataProvider.component.ts: a. Added fields public referrer: string; and public prevPath: string; b. Read "pv" url property and get referrer. c. Added methods "addEoscPrevInParams()" and "eoscBackLink()". 8. resultLanding.component.html & project.component.html & organization.component.html & dataProvider.component.html: a. Update "Go to Search" back link. b. Call "addEoscPrevInParams()" method when building queryParams of internal links. c. Pass "prevPath" to the appropriate children components. --- .../dataProvider/dataProvider.component.html | 20 ++++++------- .../dataProvider/dataProvider.component.ts | 26 +++++++++++++++++ .../relatedDatasourcesTab.component.ts | 10 ++++++- .../landing-utils/availableOn.component.ts | 14 ++++++++-- .../landing-utils/fundedBy.component.ts | 12 +++++++- .../metrics/metrics.component.ts | 3 +- .../projects-in-modal.component.ts | 3 +- .../deletedByInference.component.ts | 4 ++- .../organization/organization.component.html | 16 +++++------ .../organization/organization.component.ts | 18 ++++++++++++ landingPages/project/project.component.html | 23 +++++++++------ landingPages/project/project.component.ts | 26 +++++++++++++++++ .../deletedByInference.component.ts | 4 ++- .../result/resultLanding.component.html | 24 ++++++++-------- .../result/resultLanding.component.ts | 28 ++++++++++++++++++- .../searchUtils/searchResult.component.html | 2 +- .../searchUtils/searchResult.component.ts | 1 + .../result-preview.component.html | 4 +-- .../result-preview.component.ts | 8 ++++++ utils/routerHelper.class.ts | 9 ++++++ utils/tabs/contents/search-tab.component.ts | 3 +- 21 files changed, 208 insertions(+), 50 deletions(-) diff --git a/landingPages/dataProvider/dataProvider.component.html b/landingPages/dataProvider/dataProvider.component.html index a20df43e..324fba5d 100644 --- a/landingPages/dataProvider/dataProvider.component.html +++ b/landingPages/dataProvider/dataProvider.component.html @@ -4,7 +4,7 @@ @@ -395,7 +395,7 @@ + [properties]="properties" [prevPath]="prevPath"> @@ -405,7 +405,7 @@ + [properties]="properties" [prevPath]="prevPath"> @@ -420,7 +420,7 @@ [fetchResults]="fetchAggregatorsResults" [collectedFromName]="dataProviderInfo.title.name" [properties]=properties - [modal]="relatedDatasourcesModal"> + [modal]="relatedDatasourcesModal" [prevPath]="prevPath"> @@ -477,7 +477,7 @@ [attr.uk-tooltip]="organization.acronym && organization.name ? 'pos:right; delay:10' : 'cls: uk-invisible'" [title]="organization.name"> {{(organization.acronym) ? organization.acronym : ''}} {{(!organization.acronym && organization.name) ? organization.name : ''}} diff --git a/landingPages/dataProvider/dataProvider.component.ts b/landingPages/dataProvider/dataProvider.component.ts index ab95e40a..7cfaea24 100644 --- a/landingPages/dataProvider/dataProvider.component.ts +++ b/landingPages/dataProvider/dataProvider.component.ts @@ -38,6 +38,9 @@ declare var ResizeObserver; }) export class DataProviderComponent { + public referrer: string; + public prevPath: string; + @Input() type: string = "dataprovider"; private typeQueryPathParam: string = "datasources"; @Input() piwikSiteId = null; @@ -182,6 +185,14 @@ export class DataProviderComponent { this.subscriptions.push(this.route.queryParams.subscribe(data => { this.stickyHeader = false; this.updateDescription(""); + + if(data["pv"]) { + this.prevPath = data["pv"]; + } + if((typeof document !== 'undefined') && document.referrer) { + this.referrer = document.referrer; + } + // this.datasourceId = data['datasourceId']; if (data['datasourceId']) { this.datasourceId = data['datasourceId']; @@ -831,4 +842,19 @@ export class DataProviderComponent { this.descriptionModal.alertTitle = "Description"; this.descriptionModal.open(); } + + public addEoscPrevInParams(obj) { + if(properties.adminToolsPortalType == "eosc" && this.prevPath) { + return this.routerHelper.addQueryParam("pv", this.prevPath, obj); + } + return obj; + } + + public get eoscBackLink() { + if(this.prevPath && this.referrer && ((this.referrer == "https://eosc-search-service.grid.cyfronet.pl/") || (this.referrer == "https://beta.search.marketplace.eosc-portal.eu/") || (this.referrer == "https://search.marketplace.eosc-portal.eu/"))) { + return this.referrer+atob(this.prevPath); + } else { + return "https://"+(this.properties.environment == "beta" ? "beta" : "")+"search.marketplace.eosc-portal.eu/"; + } + } } diff --git a/landingPages/dataProvider/relatedDatasourcesTab.component.ts b/landingPages/dataProvider/relatedDatasourcesTab.component.ts index c4671349..1ed36512 100644 --- a/landingPages/dataProvider/relatedDatasourcesTab.component.ts +++ b/landingPages/dataProvider/relatedDatasourcesTab.component.ts @@ -40,7 +40,7 @@ import {OpenaireEntities} from "../../utils/properties/searchFields"; - {{result.name}} @@ -73,6 +73,7 @@ import {OpenaireEntities} from "../../utils/properties/searchFields"; }) export class RelatedDatasourcesTabComponent { + @Input() prevPath: string = ""; @Input() dataproviderId: string; // @Input() fetchPublications : FetchResearchResults; // @Input() fetchDatasets : FetchResearchResults; @@ -137,4 +138,11 @@ export class RelatedDatasourcesTabComponent { this.modal.cancel(); } } + + public addEoscPrevInParams(obj) { + if(properties.adminToolsPortalType == "eosc" && this.prevPath) { + return this.routerHelper.addQueryParam("pv", this.prevPath, obj); + } + return obj; + } } diff --git a/landingPages/landing-utils/availableOn.component.ts b/landingPages/landing-utils/availableOn.component.ts index 48536226..58ed625b 100644 --- a/landingPages/landing-utils/availableOn.component.ts +++ b/landingPages/landing-utils/availableOn.component.ts @@ -1,6 +1,7 @@ import {Component, EventEmitter, Input, Output} from '@angular/core'; import {HostedByCollectedFrom} from "../../utils/result-preview/result-preview"; import {properties} from "../../../../environments/environment"; +import {RouterHelper} from "../../utils/routerHelper.class"; @Component({ selector: 'availableOn', @@ -49,7 +50,7 @@ import {properties} from "../../../../environments/environment";
Providers: + [queryParams]="addEoscPrevInParams({datasourceId: instance.collectedNamesAndIds.get(collectedName)})" class="uk-link-text"> {{collectedName}};
@@ -80,6 +81,7 @@ import {properties} from "../../../../environments/environment"; }) export class AvailableOnComponent { + @Input() prevPath: string = ""; @Input() availableOn: HostedByCollectedFrom[]; @Input() viewAll: boolean = false; @Output() viewAllClicked = new EventEmitter(); @@ -87,7 +89,8 @@ export class AvailableOnComponent { public threshold: number = 1; public dataProviderUrl = properties.searchLinkToDataProvider.split('?')[0]; public title: string = "Download from"; - + public routerHelper:RouterHelper = new RouterHelper(); + constructor() { } @@ -122,4 +125,11 @@ export class AvailableOnComponent { public isUrl(str: string): boolean { return str.startsWith('http://') || str.startsWith('https://') || str.startsWith('//') || str.startsWith('www.'); } + + public addEoscPrevInParams(obj) { + if(properties.adminToolsPortalType == "eosc" && this.prevPath) { + return this.routerHelper.addQueryParam("pv", this.prevPath, obj); + } + return obj; + } } diff --git a/landingPages/landing-utils/fundedBy.component.ts b/landingPages/landing-utils/fundedBy.component.ts index 634998e1..5f0e3cea 100644 --- a/landingPages/landing-utils/fundedBy.component.ts +++ b/landingPages/landing-utils/fundedBy.component.ts @@ -2,6 +2,7 @@ import {Component, EventEmitter, Input, Output} from '@angular/core'; import {Project} from "../../utils/result-preview/result-preview"; import {properties} from "../../../../environments/environment"; import {HelperFunctions} from '../../utils/HelperFunctions.class'; +import {RouterHelper} from "../../utils/routerHelper.class"; @Component({ selector: 'fundedBy', @@ -33,7 +34,7 @@ import {HelperFunctions} from '../../utils/HelperFunctions.class'; Project
+ [queryParams]="addEoscPrevInParams({projectId: item.id})" [routerLink]="url"> {{item['acronym'] ? item['acronym'] : item['title']}} @@ -72,6 +73,7 @@ import {HelperFunctions} from '../../utils/HelperFunctions.class'; }) export class FundedByComponent { + @Input() prevPath: string = ""; @Input() fundedByProjects: Project[]; @Input() viewAll: boolean = false; @Output() viewAllClicked = new EventEmitter(); @@ -81,6 +83,7 @@ export class FundedByComponent { public title: string = "Funded by"; @Input() provenanceActionVocabulary = null; public provenancesCalculated: boolean[] = []; + public routerHelper:RouterHelper = new RouterHelper(); public viewAllClick() { if(this.fundedByProjects.length <= this.threshold*2) { @@ -104,4 +107,11 @@ export class FundedByComponent { } return item.provenanceAction; } + + public addEoscPrevInParams(obj) { + if(properties.adminToolsPortalType == "eosc" && this.prevPath) { + return this.routerHelper.addQueryParam("pv", this.prevPath, obj); + } + return obj; + } } diff --git a/landingPages/landing-utils/metrics/metrics.component.ts b/landingPages/landing-utils/metrics/metrics.component.ts index be072205..61b0dfdf 100644 --- a/landingPages/landing-utils/metrics/metrics.component.ts +++ b/landingPages/landing-utils/metrics/metrics.component.ts @@ -77,7 +77,7 @@ import {OpenaireEntities} from "../../../utils/properties/searchFields"; - + {{metrics.infos.get(key).name}} @@ -128,6 +128,7 @@ import {OpenaireEntities} from "../../../utils/properties/searchFields"; }) export class MetricsComponent { + @Input() prevPath: string = ""; @Output() metricsResults = new EventEmitter(); @Input() id: string; @Input() entityType: string; diff --git a/landingPages/landing-utils/projects-in-modal.component.ts b/landingPages/landing-utils/projects-in-modal.component.ts index a2b055e7..cf49af6c 100644 --- a/landingPages/landing-utils/projects-in-modal.component.ts +++ b/landingPages/landing-utils/projects-in-modal.component.ts @@ -39,7 +39,7 @@ import {OpenaireEntities} from '../../utils/properties/searchFields'; + [showLoading]="true" [properties]="properties" [prevPath]="prevPath">
  • - +
- + Go to Search @@ -176,7 +176,7 @@
+ [organizationId]="organizationId" [properties]=properties [prevPath]="prevPath">
+ [properties]="properties" [prevPath]="prevPath">
+ [properties]="properties" [prevPath]="prevPath">
+ [properties]="properties" [prevPath]="prevPath">
+ [properties]="properties" [prevPath]="prevPath">
+ [properties]="properties" [prevPath]="prevPath">
@@ -247,7 +247,7 @@ [id]="organizationInfo.objIdentifier" [ids]="organizationInfo.deletedByInferenceIds" [modal]="AlertModalDeletedByInference" - [type]="'organizations'"> + [type]="'organizations'" [prevPath]="prevPath"> diff --git a/landingPages/organization/organization.component.ts b/landingPages/organization/organization.component.ts index 3a7e257f..8e6410b1 100644 --- a/landingPages/organization/organization.component.ts +++ b/landingPages/organization/organization.component.ts @@ -34,6 +34,9 @@ declare var ResizeObserver; templateUrl: 'organization.component.html', }) export class OrganizationComponent { + public referrer: string; + public prevPath: string; + @Input() piwikSiteId = null; @Input() communityId = null; @@ -167,6 +170,13 @@ export class OrganizationComponent { this.updateTitle("Organization"); this.updateDescription(""); + if(params["pv"]) { + this.prevPath = params["pv"]; + } + if((typeof document !== 'undefined') && document.referrer) { + this.referrer = document.referrer; + } + this.organizationId = params['organizationId']; if (this.organizationId && StringUtils.isOpenAIREID(this.organizationId)) { @@ -805,4 +815,12 @@ export class OrganizationComponent { public scroll() { HelperFunctions.scroll(); } + + public get eoscBackLink() { + if(this.prevPath && this.referrer && ((this.referrer == "https://eosc-search-service.grid.cyfronet.pl/") || (this.referrer == "https://beta.search.marketplace.eosc-portal.eu/") || (this.referrer == "https://search.marketplace.eosc-portal.eu/"))) { + return this.referrer+atob(this.prevPath); + } else { + return "https://"+(this.properties.environment == "beta" ? "beta" : "")+"search.marketplace.eosc-portal.eu/"; + } + } } diff --git a/landingPages/project/project.component.html b/landingPages/project/project.component.html index 813953a2..d5134ff0 100644 --- a/landingPages/project/project.component.html +++ b/landingPages/project/project.component.html @@ -4,7 +4,7 @@ @@ -419,16 +419,23 @@ + [properties]="properties" [prevPath]="prevPath">
+ [properties]="properties" resultType="DMPs" [prevPath]="prevPath">
- + View all in OpenAIRE + + View all @@ -592,7 +599,7 @@ [attr.uk-tooltip]="organization.acronym && organization.name ? 'pos:right; delay:10' : 'cls: uk-invisible'" [title]="organization.name"> {{(organization.acronym) ? organization.acronym : ''}} {{(!organization.acronym && organization.name) ? organization.name : ''}} diff --git a/landingPages/project/project.component.ts b/landingPages/project/project.component.ts index 0c9fcb22..bdb839bf 100644 --- a/landingPages/project/project.component.ts +++ b/landingPages/project/project.component.ts @@ -38,6 +38,9 @@ declare var ResizeObserver; }) export class ProjectComponent { + public referrer: string; + public prevPath: string; + @Input() piwikSiteId = null; @Input() communityId = null; public projectInfo: ProjectInfo; @@ -210,6 +213,14 @@ export class ProjectComponent { this.updateTitle(title); this.updateDescription(description); + + if(params["pv"]) { + this.prevPath = params["pv"]; + } + if((typeof document !== 'undefined') && document.referrer) { + this.referrer = document.referrer; + } + this.projectId = params['projectId']; var grantId = params['grantId']; var funder = params['funder']; @@ -965,4 +976,19 @@ export class ProjectComponent { this.descriptionModal.alertTitle = "Description"; this.descriptionModal.open(); } + + public addEoscPrevInParams(obj) { + if(properties.adminToolsPortalType == "eosc" && this.prevPath) { + return this.routerHelper.addQueryParam("pv", this.prevPath, obj); + } + return obj; + } + + public get eoscBackLink() { + if(this.prevPath && this.referrer && ((this.referrer == "https://eosc-search-service.grid.cyfronet.pl/") || (this.referrer == "https://beta.search.marketplace.eosc-portal.eu/") || (this.referrer == "https://search.marketplace.eosc-portal.eu/"))) { + return this.referrer+atob(this.prevPath); + } else { + return "https://"+(this.properties.environment == "beta" ? "beta" : "")+"search.marketplace.eosc-portal.eu/"; + } + } } diff --git a/landingPages/result/deletedByInference/deletedByInference.component.ts b/landingPages/result/deletedByInference/deletedByInference.component.ts index 52cd3781..608de6e4 100644 --- a/landingPages/result/deletedByInference/deletedByInference.component.ts +++ b/landingPages/result/deletedByInference/deletedByInference.component.ts @@ -26,7 +26,8 @@ import {HelperFunctions} from "../../../utils/HelperFunctions.class";
  • - +
- + Go to Search @@ -23,7 +23,8 @@ [pageViews]="pageViews" [id]="id" [entityType]="'results'" [entity]="title" [viewsFrameUrl]="viewsFrameUrl" [downloadsFrameUrl]="downloadsFrameUrl" - (metricsResults)="metricsResults($event)" [properties]=properties> + (metricsResults)="metricsResults($event)" [properties]=properties + [prevPath]="prevPath"> @@ -330,7 +331,7 @@ [{{getReferenceIdName(id)}} OpenAIRE] @@ -480,7 +481,8 @@
- +
@@ -489,7 +491,7 @@
- +
@@ -507,22 +509,22 @@ [id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']" [ids]="resultLandingInfo.deletedByInferenceIds" [modal]="AlertModalDeletedByInference" - [resultType]="type" [type]="openaireEntities.PUBLICATIONS"> + [resultType]="type" [type]="openaireEntities.PUBLICATIONS" [prevPath]="prevPath"> + [resultType]="'dataset'" [type]="openaireEntities.DATASETS" [prevPath]="prevPath"> + [resultType]="type" [type]="openaireEntities.SOFTWARE" [prevPath]="prevPath"> + [resultType]="'other'" [type]="openaireEntities.OTHER" [prevPath]="prevPath"> + [isCard]="true" [prevPath]="prevPath"> diff --git a/searchPages/searchUtils/searchResult.component.ts b/searchPages/searchUtils/searchResult.component.ts index 79402ff3..f0b6a3ff 100644 --- a/searchPages/searchUtils/searchResult.component.ts +++ b/searchPages/searchUtils/searchResult.component.ts @@ -12,6 +12,7 @@ import {properties} from "../../../../environments/environment"; templateUrl: 'searchResult.component.html' }) export class SearchResultComponent implements OnInit, OnChanges { + @Input() prevPath: string = ""; @Input() results: SearchResult[]; previewResults:ResultPreview[]; @Input() status: number; diff --git a/utils/result-preview/result-preview.component.html b/utils/result-preview/result-preview.component.html index 23c67d02..e115d92e 100644 --- a/utils/result-preview/result-preview.component.html +++ b/utils/result-preview/result-preview.component.html @@ -37,7 +37,7 @@

-
@@ -273,7 +273,7 @@ Provider: + [queryParams]="addEoscPrevInParams({datasourceId: from.collectedNamesAndIds.get(collectedName)})" (click)="onClick();"> {{collectedName}}; diff --git a/utils/result-preview/result-preview.component.ts b/utils/result-preview/result-preview.component.ts index a53f4506..bd9e2011 100644 --- a/utils/result-preview/result-preview.component.ts +++ b/utils/result-preview/result-preview.component.ts @@ -15,6 +15,7 @@ import {HelperFunctions} from "../HelperFunctions.class"; styleUrls: ['result-preview.component.less'] }) export class ResultPreviewComponent implements OnInit, OnChanges { + @Input() prevPath: string = ""; @Input() result: ResultPreview; @Input() properties: EnvProperties; public openaireEntities = OpenaireEntities; @@ -176,4 +177,11 @@ export class ResultPreviewComponent implements OnInit, OnChanges { return this.result.resultType == "publication" || this.result.resultType == "dataset" || this.result.resultType == "software" || this.result.resultType == "other" || this.result.resultType == "result"; } + + public addEoscPrevInParams(obj) { + if(properties.adminToolsPortalType == "eosc" && this.prevPath) { + return this.routerHelper.addQueryParam("pv", this.prevPath, obj); + } + return obj; + } } diff --git a/utils/routerHelper.class.ts b/utils/routerHelper.class.ts index 39c9710e..257bfa80 100644 --- a/utils/routerHelper.class.ts +++ b/utils/routerHelper.class.ts @@ -5,6 +5,15 @@ export class RouterHelper { //Use this class function to create queryParams Objects in format {key1:value1} or {key1:value1,key2:value2,key3:value3,...} for multiple parameters constructor(){} // Link + + public addQueryParam(key:string,value:string, obj){ + if(!obj) { + obj = {}; + } + obj[key] = value; + return obj; + } + public createQueryParam(key:string,value:string){ var obj ={}; obj[key]=value; diff --git a/utils/tabs/contents/search-tab.component.ts b/utils/tabs/contents/search-tab.component.ts index 198f4cbc..ee55b587 100644 --- a/utils/tabs/contents/search-tab.component.ts +++ b/utils/tabs/contents/search-tab.component.ts @@ -43,7 +43,7 @@ import {StringUtils} from "../../string-utils.class"; + [type]="resultType" [showEnermaps]="showEnermaps" [prevPath]="prevPath"> @@ -57,6 +57,7 @@ import {StringUtils} from "../../string-utils.class"; }) export class SearchTabComponent { + @Input() prevPath: string = ""; @Input() public fetch; @Input() public resultType: string; @Input() public params: any;