From af95b395bd24f102b3ec967c05b5a6d0bd2fbc57 Mon Sep 17 00:00:00 2001 From: Alex Martzios Date: Mon, 2 Oct 2023 12:18:29 +0300 Subject: [PATCH 1/4] search page: add view more option for partners, projects, match styling for authors as well --- .../entity-metadata.component.ts | 111 +++++++++++++++++- utils/authors/showAuthors.component.ts | 2 +- 2 files changed, 106 insertions(+), 7 deletions(-) diff --git a/landingPages/landing-utils/entity-metadata.component.ts b/landingPages/landing-utils/entity-metadata.component.ts index aba2fc82..caad8627 100644 --- a/landingPages/landing-utils/entity-metadata.component.ts +++ b/landingPages/landing-utils/entity-metadata.component.ts @@ -1,4 +1,4 @@ -import {Component, Input} from "@angular/core"; +import {Component, Input, ViewChild} from "@angular/core"; import {EnvProperties} from "../../utils/properties/env-properties"; import {properties} from "../../../../environments/environment"; import {OpenaireEntities} from "../../utils/properties/searchFields"; @@ -151,12 +151,32 @@ import {RouterHelper} from "../../utils/routerHelper.class"; Thematic - - {{projectNames.slice(0,3).join(', ')}} + + {{showInline ? projectNames.join(', ') : projectNames.slice(0, projectsLimit).join(', ')}} + + + +{{projects.length - projectsLimit | number}} projects + + + View less + + - - {{organizationNames.slice(0, 3).join(', ')}} + + {{showInline ? organizationNames.join(', ') : organizationNames.slice(0, organizationsLimit).join(', ')}} + + + +{{organizations.length - organizationsLimit | number}} partners + + + View less + + @@ -169,10 +189,37 @@ import {RouterHelper} from "../../utils/routerHelper.class"; {{relationName}} + + + + +
+ +
+ {{item.name}}{{i == organizations.length - 1 ? '' : ','}} +
+
+
+
+ + +
+ +
+ {{item['funderShortname'] ? item['funderShortname'] : item['funderName']}} + [no funder available] + | {{ item['acronym'] ? item['acronym'] : item['title']}} + {{i == projects.length - 1 ? '' : ','}} +
+
+
+
`, styleUrls: ['entity-metadata.component.less'] }) export class EntityMetadataComponent { + @Input() isMobile: boolean = false; @Input() entityType: string; @Input() types: string[]; @Input() year: string; // search result @@ -204,6 +251,14 @@ export class EntityMetadataComponent { @Input() subjects: string[]; @Input() prevPath: string = ""; + @ViewChild('partnersModal') partnersModal; + @ViewChild('projectsModal') projectsModal; + + organizationsLimit: number = 5; + projectsLimit: number = 3; + showInline: boolean = false; + lessBtn: boolean = false; + properties: EnvProperties = properties; public openaireEntities = OpenaireEntities; public routerHelper: RouterHelper = new RouterHelper(); @@ -260,4 +315,48 @@ export class EntityMetadataComponent { } return obj; } -} + + public viewAllPartnersClick() { + if(this.organizations.length <= this.organizationsLimit * 2) { + this.showInline = true; + this.lessBtn = true; + } else { + this.openPartnersModal(); + } + } + + public openPartnersModal() { + if (this.isMobile) { + this.partnersModal.okButton = false; + this.partnersModal.title = "Partners"; + this.partnersModal.open(); + } else { + this.partnersModal.cancelButton = false; + this.partnersModal.okButton = false; + this.partnersModal.alertTitle = "Partners"; + this.partnersModal.open(); + } + } + + public viewAllProjectsClick() { + if(this.projects.length <= this.projectsLimit * 2) { + this.showInline = true; + this.lessBtn = true; + } else { + this.openProjectsModal(); + } + } + + public openProjectsModal() { + if (this.isMobile) { + this.projectsModal.okButton = false; + this.projectsModal.title = "Projects"; + this.projectsModal.open(); + } else { + this.projectsModal.cancelButton = false; + this.projectsModal.okButton = false; + this.projectsModal.alertTitle = "Projects"; + this.projectsModal.open(); + } + } +} \ No newline at end of file diff --git a/utils/authors/showAuthors.component.ts b/utils/authors/showAuthors.component.ts index a9987197..42296345 100644 --- a/utils/authors/showAuthors.component.ts +++ b/utils/authors/showAuthors.component.ts @@ -109,7 +109,7 @@ import {properties} from "../../../../environments/environment"; +{{authors.length - authorsLimit | number}} more
- + +{{authors.length - authorsLimit | number}} Authors From edf8ae835c66c52f1c2282bc01eff53dcd945766 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 2 Oct 2023 13:13:22 +0300 Subject: [PATCH 2/4] [Library | develop] fos/fos.component.ts & landing-utilts/fos.component.ts & searchFields.ts: Restored checks for environment to use fos or foslabel field - foslabel not yet introduced in current prod index. --- fos/fos.component.ts | 3 ++- landingPages/landing-utils/fos.component.ts | 6 ++++-- utils/properties/searchFields.ts | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/fos/fos.component.ts b/fos/fos.component.ts index c02b6bed..043e7bd5 100644 --- a/fos/fos.component.ts +++ b/fos/fos.component.ts @@ -216,6 +216,7 @@ export class FosComponent implements OnInit, OnDestroy { } public buildFosQueryParam(fos) { - return {'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}; + // return {'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}; + return (properties.environment !== 'production' ? ({'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}) : ({'fos': this.urlEncodeAndQuote(fos.id)})); } } diff --git a/landingPages/landing-utils/fos.component.ts b/landingPages/landing-utils/fos.component.ts index 4dfc59e6..ba95bdc8 100644 --- a/landingPages/landing-utils/fos.component.ts +++ b/landingPages/landing-utils/fos.component.ts @@ -121,10 +121,12 @@ export class FosComponent { } public buildFosQueryParam(fos) { - return {'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}; + // return {'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}; + return (properties.environment !== 'production' ? ({'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}) : ({'fos': this.urlEncodeAndQuote(fos.id)})); } public buildFosHrefParam(fos): string { - return ('foslabel='+this.urlEncodeAndQuote(fos.id+"||"+fos.label)); + // return ('foslabel='+this.urlEncodeAndQuote(fos.id+"||"+fos.label)); + return (properties.environment !== 'production' ? ('foslabel='+this.urlEncodeAndQuote(fos.id+"||"+fos.label)) : ('fos='+this.urlEncodeAndQuote(fos.id))); } } diff --git a/utils/properties/searchFields.ts b/utils/properties/searchFields.ts index 7ae0fcda..65ca6a4b 100644 --- a/utils/properties/searchFields.ts +++ b/utils/properties/searchFields.ts @@ -14,7 +14,7 @@ export class SearchFields { // Remove Collected From Filter "collectedfrom","collectedfrom" public RESULT_REFINE_FIELDS = [ - "resultbestaccessright", "instancetypename", "foslabel", "relfunder", + "resultbestaccessright", "instancetypename", properties.environment!='production'?"foslabel":'fos', "relfunder", "relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id", "relproject", "sdg", "country", "resultlanguagename", "resulthostingdatasource", "community"]; From 1c5a0b22a8bd977eb77edded7f00ad3b56edccf6 Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 5 Oct 2023 14:31:37 +0300 Subject: [PATCH 3/4] restrict links to user roles management to portal Admins --- login/user.component.html | 8 ++++---- login/user.component.ts | 7 ++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/login/user.component.html b/login/user.component.html index a69412e4..45cb0d51 100644 --- a/login/user.component.html +++ b/login/user.component.html @@ -17,13 +17,13 @@
Roles {{getTheRolesFormatted(user.role)}}
- diff --git a/login/user.component.ts b/login/user.component.ts index e279b7b6..f95adf67 100644 --- a/login/user.component.ts +++ b/login/user.component.ts @@ -100,12 +100,9 @@ export class UserComponent { return formattedRoles.join(", "); } - get isCurator() { - return Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user); + get isPortalAdministrator() { + return Session.isPortalAdministrator(this.user); } - get isUserManager() { - return Session.isUserManager(this.user); - } } From 445441572d30bb2c6cd889abfb62bc225e87de98 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Fri, 6 Oct 2023 12:22:00 +0300 Subject: [PATCH 4/4] [Library & Explore | develop]: Added software heritage as pid for research products. 1. environments/: Added in all environments, property: swhURL: "https://archive.softwareheritage.org/". 2. env-properties.ts: Added property swhURL?: string; 3. string-utils.class.ts: Added method "isValidSwhId()" and swhid in checks and definitions. 4. resultLandingInfo.ts: Added swhid in accepted types of interface Id. 5. resultLanding.component.ts: Added check for swhid in "getReferenceIdName()" and "getReferenceUrl()". 6. parsingFunctions.class.ts: Added pid[i].classid == "swhid" check in "parseIdentifiers()". 7. showIdentifiers.component.ts: Added "swhid" in display of pids. --- landingPages/landing-utils/parsingFunctions.class.ts | 6 ++++-- .../landing-utils/showIdentifiers.component.ts | 4 +++- landingPages/result/resultLanding.component.ts | 4 ++++ utils/entities/resultLandingInfo.ts | 2 +- utils/properties/env-properties.ts | 1 + utils/string-utils.class.ts | 12 ++++++++++-- 6 files changed, 23 insertions(+), 6 deletions(-) diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index fd2c3b12..faeaaada 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -514,7 +514,8 @@ export class ParsingFunctions { let identifiers = new Map(); if (pid.hasOwnProperty("classid") && pid['classid'] != "") { - if (pid.classid == "doi" || pid.classid == "pmc" || pid.classid == "handle" || pid.classid == "pmid" || pid.classid == "re3data") { + if (pid.classid == "doi" || pid.classid == "pmc" || pid.classid == "handle" || pid.classid == "pmid" || pid.classid == "re3data" + || pid.classid == "swhid") { if (!identifiers.has(pid.classid)) { identifiers.set(pid.classid, new Array()); } @@ -522,7 +523,8 @@ export class ParsingFunctions { } } else { for (let i = 0; i < pid.length; i++) { - if (pid[i].classid == "doi" || pid[i].classid == "pmc" || pid[i].classid == "handle" || pid[i].classid == "pmid" || pid[i].classid == "re3data") { + if (pid[i].classid == "doi" || pid[i].classid == "pmc" || pid[i].classid == "handle" || pid[i].classid == "pmid" || pid[i].classid == "re3data" + || pid[i].classid == "swhid") { if (!identifiers.has(pid[i].classid)) { identifiers.set(pid[i].classid, new Array()); } diff --git a/landingPages/landing-utils/showIdentifiers.component.ts b/landingPages/landing-utils/showIdentifiers.component.ts index e4644c34..8a0b4680 100644 --- a/landingPages/landing-utils/showIdentifiers.component.ts +++ b/landingPages/landing-utils/showIdentifiers.component.ts @@ -26,7 +26,7 @@ import {properties} from "../../../../environments/environment"; {{key}}: - {{item}} @@ -124,6 +124,8 @@ export class ShowIdentifiersComponent implements AfterViewInit { return properties.handleURL; } else if(key == "re3data") { return properties.r3DataURL; + } else if(key == "swhid") { + return properties.swhURL; } } diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index 932901d7..9ba1309b 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -825,6 +825,8 @@ export class ResultLandingComponent { return this.properties.pmidURL + id.value; } else if (id.type === "handle") { return this.properties.handleURL + id.value; + } else if (id.type === "swhid") { + return this.properties.swhURL + id.value; } else { return null; } @@ -839,6 +841,8 @@ export class ResultLandingComponent { return 'PubMed'; } else if (id.type === "handle") { return 'Handle.NET'; + } else if(id.type == "swhid") { + return 'Software Heritage'; } else { return null; } diff --git a/utils/entities/resultLandingInfo.ts b/utils/entities/resultLandingInfo.ts index 0ae3866f..30e1e76b 100644 --- a/utils/entities/resultLandingInfo.ts +++ b/utils/entities/resultLandingInfo.ts @@ -8,7 +8,7 @@ import { } from "../result-preview/result-preview"; export interface Id { - type: "pmid" | "doi" | "pmc" | "handle" | "openaire"; + type: "pmid" | "doi" | "pmc" | "handle" | "openaire" | "swhid"; value: string; trust: number } diff --git a/utils/properties/env-properties.ts b/utils/properties/env-properties.ts index af367504..4a2ccd68 100644 --- a/utils/properties/env-properties.ts +++ b/utils/properties/env-properties.ts @@ -44,6 +44,7 @@ export interface EnvProperties { cordisURL?: string; openDoarURL?: string; r3DataURL?: string; + swhURL?: string; fairSharingURL?: string, eoscMarketplaceURL?: string, sherpaURL?: string; diff --git a/utils/string-utils.class.ts b/utils/string-utils.class.ts index d05bc57e..dff363ff 100644 --- a/utils/string-utils.class.ts +++ b/utils/string-utils.class.ts @@ -149,7 +149,7 @@ export class DOI { } export class Identifier { - class: "doi" | "pmc" | "pmid" | "handle" | "ORCID" | "re3data" = null; + class: "doi" | "pmc" | "pmid" | "handle" | "ORCID" | "re3data" | "swhid" = null; id: string; public static getDOIsFromString(str: string): string[] { @@ -202,13 +202,15 @@ export class Identifier { return {"class": "handle", "id": pid}; } else if (Identifier.isValidRe3Data(pid)) { return {"class": "re3data", "id": pid}; + } else if (Identifier.isValidSwhId(pid)) { + return {"class": "swhid", "id": pid}; } //set it as a doi, to catch the case that doi has not valid format return (strict?null:{"class": "doi", "id": pid}); } public static getPIDFromIdentifiers(identifiers: Map): Identifier { - let classes:string [] = ["doi", "handle", "pmc", "pmid", "re3data"]; + let classes:string [] = ["doi", "handle", "pmc", "pmid", "re3data", "swhid"]; if(identifiers) { for (let cl of classes) { if (identifiers.get(cl)) { @@ -257,6 +259,12 @@ export class Identifier { let exp = /(r3d[1-9]\d{0,8})/g; return str.match(exp) != null; } + + public static isValidSwhId(str: string): boolean { + // let exp = /swh:1:(snp|rel|rev|dir|cnt):[0-9a-f]{40}/g; + let exp = /swh:1:snp:[0-9a-f]{40}/g; + return str.match(exp) != null; + } } export class StringUtils {