Merge branch 'develop' into new-api

This commit is contained in:
argirok 2023-10-06 16:38:01 +03:00
commit 5e4aaab04f
8 changed files with 29 additions and 15 deletions

View File

@ -514,7 +514,8 @@ export class ParsingFunctions {
let identifiers = new Map<string, string[]>();
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<string>());
}
@ -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<string>());
}

View File

@ -26,7 +26,7 @@ import {properties} from "../../../../environments/environment";
<span class="uk-text-meta uk-text-small" [class.uk-text-uppercase]="key != 're3data'">{{key}}: </span>
<span [class.uk-margin-small-left]="modal">
<ng-container *ngFor="let item of identifiers.get(key) let j=index">
<a *ngIf="key == 'doi' || key == 'pmc' || key == 'pmid' || key == 'handle' || key == 're3data'"
<a *ngIf="key == 'doi' || key == 'pmc' || key == 'pmid' || key == 'handle' || key == 're3data' || key == 'swhid'"
[href]="getUrl(key) + item" target="_blank" class="uk-display-inline-block custom-external">
{{item}}
</a>
@ -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;
}
}

View File

@ -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;
}

View File

@ -17,13 +17,13 @@
<div *ngIf="user.role.length > 1">
<span class="uk-text-muted"> Roles </span> <span> {{getTheRolesFormatted(user.role)}} </span>
</div>
<div class="uk-margin-top" *ngIf="user.role.length > 1">
<a *ngIf="isCurator" class="uk-button uk-button-primary" href="https://aai.openaire.eu/roles/index.php"
<div class="uk-margin-top" *ngIf="user.role.length > 1 && isPortalAdministrator">
<a class="uk-button uk-button-primary" href="https://aai.openaire.eu/roles/index.php"
target="_blank">Manage your roles</a> {{" "}}
<a *ngIf="isUserManager" class="uk-button uk-button-primary uk-margin-top"
<a class="uk-button uk-button-primary uk-margin-top"
href="https://aai.openaire.eu/roles/admin.php"
target="_blank">Manage role requests</a>{{" "}}
<a *ngIf="isUserManager" class="uk-button uk-button-primary uk-margin-top"
<a class="uk-button uk-button-primary uk-margin-top"
href="https://aai.openaire.eu/registry"
target="_blank">Manage users</a>
</div>

View File

@ -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);
}
}

View File

@ -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
}

View File

@ -44,6 +44,7 @@ export interface EnvProperties {
cordisURL?: string;
openDoarURL?: string;
r3DataURL?: string;
swhURL?: string;
fairSharingURL?: string,
eoscMarketplaceURL?: string,
sherpaURL?: string;

View File

@ -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<string, string[]>): 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 {