diff --git a/connect/community/community.service.ts b/connect/community/community.service.ts index acc3b749..d8fe6975 100644 --- a/connect/community/community.service.ts +++ b/connect/community/community.service.ts @@ -122,8 +122,8 @@ export class CommunityService { } else { community.fos = []; } - if (resData.advancedConstraint != null) { - community.selectionCriteria = resData.advancedConstraint; + if (resData.advancedConstraints != null) { + community.selectionCriteria = resData.advancedConstraints; } else { community.selectionCriteria = new SelectionCriteria(); } 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..70751b2d 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+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..dc7f0052 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', @@ -47,9 +48,9 @@ import {properties} from "../../../../environments/environment"; {{instance.license}}
- Providers: + Data sources: + [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..475f280b 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+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..34e7d6e9 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+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/sharedComponents/input/input.component.ts b/sharedComponents/input/input.component.ts index 1f25ab47..5d83e1fa 100644 --- a/sharedComponents/input/input.component.ts +++ b/sharedComponents/input/input.component.ts @@ -23,14 +23,22 @@ import {properties} from "../../../../environments/environment"; import {ClickEvent} from "../../utils/click/click-outside-or-esc.directive"; import {element} from "protractor"; -export type InputType = 'text' | 'URL' | 'logoURL' | 'autocomplete' | 'autocomplete_soft' | 'textarea' | 'select' | 'chips'; +export type InputType = + 'text' + | 'URL' + | 'logoURL' + | 'autocomplete' + | 'autocomplete_soft' + | 'textarea' + | 'select' + | 'chips'; export interface Option { icon?: string, iconClass?: string, value: any, label: string, - tooltip?: string, + tooltip?: string, disabled?: boolean, hidden?: boolean } @@ -112,7 +120,7 @@ declare var UIkit;
-
{{getLabel(chip.value)}} 0; } - if(this.type === "select") { + if (this.type === "select") { if (this.optionsArray.length > this.optionsBreakpoint) { this.type = 'autocomplete'; this.showOptionsOnEmpty = true; @@ -317,11 +325,11 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang @HostListener('window:keydown.arrowLeft', ['$event']) arrowLeft(event: KeyboardEvent) { - if(this.focused) { + if (this.focused) { event.preventDefault(); - if(this.activeElement.getValue()) { + if (this.activeElement.getValue()) { let index = this.chips.toArray().indexOf(this.activeElement.getValue()); - if(index > 0) { + if (index > 0) { this.activeElement.next(this.chips.get(index - 1)); return; } @@ -331,11 +339,11 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang @HostListener('window:keydown.arrowRight', ['$event']) arrowRight(event: KeyboardEvent) { - if(this.focused) { + if (this.focused) { event.preventDefault(); - if(this.activeElement.getValue()) { + if (this.activeElement.getValue()) { let index = this.chips.toArray().indexOf(this.activeElement.getValue()); - if(index < this.chips.length - 1) { + if (index < this.chips.length - 1) { this.activeElement.next(this.chips.get(index + 1)); return; } @@ -355,7 +363,7 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang } else { this.focus(false, event); } - if(this.extendEnter) { + if (this.extendEnter) { this.extendEnter(); } } @@ -389,7 +397,7 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang } } this.activeElement.subscribe(element => { - if(element) { + if (element) { element.nativeElement.scrollIntoView({behavior: 'smooth'}); } }) @@ -404,7 +412,7 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang if (changes.value) { this.formControl.setValue(this.value); } - if(changes.validators) { + if (changes.validators) { this.updateValidators(); } if (changes.formControl || changes.validators || changes.options) { @@ -508,7 +516,7 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang } updateValidators() { - if(this.formAsArray) { + if (this.formAsArray) { this.formAsArray.controls.forEach(control => { control.setValidators(this.validators); control.updateValueAndValidity(); @@ -548,15 +556,33 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang } add(event, addChips = false) { - if (addChips && this.searchControl.value && this.searchControl.valid) { - if (event && event.stopPropagation) { - event.stopPropagation(); - } - this.formAsArray.push(new UntypedFormControl(this.searchControl.value, this.validators)); - this.formAsArray.markAsDirty(); + if (addChips && this.searchControl.value) { + this.splitSearchControl(); + } else if (!this.focused) { this.searchControl.setValue(''); + } + } + + splitSearchControl() { + let values = [this.searchControl.value]; + this.separators.forEach(separator => { + values = ([] as string[]).concat(...values.map(value => { + if (Array.isArray(value)) { + return ([] as string[]).concat(...value.map(element => element.split(separator))); + } else { + return value.split(separator); + } + })); + }); + values.forEach(value => { + let control = new UntypedFormControl(value.trim(), this.validators); + if (control.valid) { + this.formAsArray.push(control); + this.formAsArray.markAsDirty(); + } + }); + if (this.formAsArray.dirty) { this.activeElement.next(this.chips.last); - } else if(!this.focused) { this.searchControl.setValue(''); } } @@ -565,8 +591,8 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang let option = this.optionsArray.find(option => HelperFunctions.equals(option.value, value)); return (option) ? option.label : (value); } - - getTooltip(value: any): string { + + getTooltip(value: any): string { let option = this.optionsArray.find(option => HelperFunctions.equals(option.value, value)); return (option) ? (option.tooltip ? option.tooltip : option.label) : (value); } 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;