Update to Angular 16 #16
|
@ -7,8 +7,8 @@ import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
|
|||
import {EnvProperties} from '../../utils/properties/env-properties';
|
||||
import {Subscriber} from "rxjs";
|
||||
import {OpenaireEntities} from "../../utils/properties/searchFields";
|
||||
import {CommunityService} from "../../connect/community/community.service";
|
||||
import {CommunitiesService} from "../../connect/communities/communities.service";
|
||||
import {UserManagementService} from "../../services/user-management.service";
|
||||
|
||||
declare var UIkit: any;
|
||||
|
||||
|
@ -49,9 +49,14 @@ export class ClaimContextSearchFormComponent {
|
|||
keyword = "";
|
||||
subscriptions = [];
|
||||
communityLogos = {};
|
||||
communityIds = [];
|
||||
user = null;
|
||||
ngOnInit() {
|
||||
this.entitiesSelectOptions = this.showOptions.selectOptions;
|
||||
//get community logos
|
||||
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
|
||||
this.subscriptions.push(this._communitiesService.getCommunities(this.properties, this.properties.communityAPI+"/communities/").subscribe(
|
||||
communitiesResults => {
|
||||
if(communitiesResults!=null) {
|
||||
|
@ -61,6 +66,13 @@ export class ClaimContextSearchFormComponent {
|
|||
this.communityLogos[community.communityId] = community;
|
||||
}
|
||||
}
|
||||
this.communityIds = communitiesResults.filter(community => {
|
||||
return community.claim == "all" ||
|
||||
Session.isCommunityCurator(this.user) ||
|
||||
Session.isClaimsCurator(this.user) ||
|
||||
(community.claim == "membersOnly" && Session.isSubscribedTo("community", community.communityId,this.user)) ||
|
||||
(community.claim == "managersOnly" && Session.isManager("community", community.communityId,this.user))
|
||||
}).map(community => community.communityId);
|
||||
this.getCommunities();
|
||||
}
|
||||
},
|
||||
|
@ -69,6 +81,10 @@ export class ClaimContextSearchFormComponent {
|
|||
}
|
||||
));
|
||||
|
||||
}, error => {
|
||||
|
||||
}));
|
||||
|
||||
}
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
|
@ -77,7 +93,7 @@ export class ClaimContextSearchFormComponent {
|
|||
}
|
||||
});
|
||||
}
|
||||
constructor(private _contextService: ContextsService, private router: Router, private _communitiesService: CommunitiesService) {
|
||||
constructor(private _contextService: ContextsService, private router: Router, private _communitiesService: CommunitiesService, private userManagementService: UserManagementService,) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -172,15 +188,16 @@ export class ClaimContextSearchFormComponent {
|
|||
|
||||
} else {
|
||||
this.loading = true;
|
||||
this.subscriptions.push(this._contextService.getPublicCommunitiesByState().subscribe(
|
||||
this.subscriptions.push(this._contextService.getCommunitiesByState().subscribe(
|
||||
data => {
|
||||
this.communities = data;
|
||||
console.log(this.communities)
|
||||
this.communities = data.filter(community => {
|
||||
return this.communityIds.indexOf(community.id) != -1
|
||||
});
|
||||
if (this.communities.length > 0) {
|
||||
this.communities.sort((n1, n2) => n1.label > n2.label);
|
||||
this.communities.sort((n1, n2) => n1.title > n2.title);
|
||||
}
|
||||
this.loading = false;
|
||||
if (this.communityId != null) {
|
||||
if (this.communityId != null && this.communityIds.indexOf(this.communityId) != -1) {
|
||||
//preselect community
|
||||
this.selectedCommunityId = this.communityId;
|
||||
for (let i = 0; i < this.communities.length; i++) {
|
||||
|
|
|
@ -56,12 +56,11 @@ export class CommunitiesService {
|
|||
result['description'] = resData.description;
|
||||
result['date'] = resData.creationDate;
|
||||
result['status'] = 'all';
|
||||
result['claim'] = resData.claim;
|
||||
result['membership'] = resData.membership;
|
||||
if (resData.hasOwnProperty('status')) {
|
||||
result['status'] = resData.status;
|
||||
const status = ['all', 'hidden', 'manager'];
|
||||
if (status.indexOf(result['status']) === -1) {
|
||||
result['status'] = 'hidden';
|
||||
}
|
||||
result.validateStatus();
|
||||
}
|
||||
if (resData.type != null) {
|
||||
result['type'] = resData.type;
|
||||
|
|
|
@ -98,14 +98,14 @@ export class CommunityService {
|
|||
community.description = resData.description;
|
||||
community.date = resData.creationDate;
|
||||
community.zenodoCommunity = resData.zenodoCommunity;
|
||||
community.status = 'all';
|
||||
community.status = 'PUBLIC';
|
||||
community.claim = resData.claim;
|
||||
community.membership = resData.membership;
|
||||
community.type = resData.type;
|
||||
community.otherZenodoCommunities = resData.otherZenodoCommunities;
|
||||
if (resData.hasOwnProperty('status')) {
|
||||
community.status = resData.status;
|
||||
const status = ['all', 'hidden', 'manager'];
|
||||
if (status.indexOf(community['status']) === -1) {
|
||||
community.status = 'hidden';
|
||||
}
|
||||
community.validateStatus();
|
||||
}
|
||||
if (resData.subjects != null) {
|
||||
community.subjects = Array.isArray(resData.subjects)?resData.subjects:[resData.subjects];
|
||||
|
|
|
@ -14,8 +14,11 @@ export class CommunityInfo {
|
|||
managers: string[];
|
||||
date:Date;
|
||||
subjects: string[];
|
||||
status:string;
|
||||
status:"all" | "manager" | "hidden" | "PUBLIC" | "RESTRICTED" | "PRIVATE";
|
||||
claim: "all" | "managersOnly" | "membersOnly";
|
||||
membership: "open" | "byInvitation";
|
||||
zenodoCommunity:string;
|
||||
otherZenodoCommunities: string[];
|
||||
isUpload: boolean;
|
||||
isSubscribed: boolean;
|
||||
isManager: boolean;
|
||||
|
@ -33,5 +36,19 @@ export class CommunityInfo {
|
|||
}
|
||||
return response;
|
||||
}
|
||||
public isPublic(){
|
||||
return this.status == "all" || this.status == "PUBLIC";
|
||||
}
|
||||
public isRestricted(){
|
||||
return this.status == "manager" || this.status == "RESTRICTED";
|
||||
}
|
||||
public isPrivate(){
|
||||
return this.status == "hidden" || this.status == "PRIVATE";
|
||||
}
|
||||
public validateStatus(){
|
||||
if(!(this.isPrivate() || this.isRestricted() || this.isPublic())){
|
||||
this.status = "PRIVATE";
|
||||
}
|
||||
}
|
||||
}
|
||||
// export const prodReadyCommunities = ["dh-ch", "ee", "fam", "mes", "ni", "covid-19", "dariah", "epos", "egi"];
|
||||
|
|
|
@ -54,6 +54,6 @@ export class ConnectHelper {
|
|||
|
||||
|
||||
public static isPrivate(community, user) {
|
||||
return community && (community.status == "hidden" || (community.status == "manager" && !(Session.isPortalAdministrator(user) || Session.isCommunityCurator(user) || Session.isManager("community", community.communityId, user))))
|
||||
return community && (community.isPrivate() || (community.isRestricted() && !(Session.isPortalAdministrator(user) || Session.isCommunityCurator(user) || Session.isManager("community", community.communityId, user))))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,15 +7,25 @@ import {map} from "rxjs/operators";
|
|||
export class SearchCommunityProjectsService {
|
||||
constructor(private http: HttpClient ) {}
|
||||
|
||||
searchProjects (properties:EnvProperties, pid: string):any {
|
||||
let url = properties.communityAPI+pid+"/projects";
|
||||
|
||||
searchProjects (properties:EnvProperties, pid: string, page=1, size=500):any {
|
||||
return this.searchProjectsWithPaging(properties,pid,page, size, null, null);
|
||||
}
|
||||
searchProjectsWithPaging (properties:EnvProperties, pid: string, page=1, size=500, searchFilter, funder, orderBy = "name"):any {
|
||||
let params = funder ? ["funder="+ funder] :[];
|
||||
if (searchFilter) {
|
||||
params.push("searchFilter="+ searchFilter)
|
||||
}
|
||||
params.push("orderBy="+ orderBy);
|
||||
let url = properties.communityAPI+pid+"/projects/"+ (page-1) + "/" + size + (params.length > 0?"?" + params.join("&"):"");
|
||||
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
|
||||
//.map(res => <any> res.json())
|
||||
}
|
||||
countTotalProjects(properties:EnvProperties,pid:string) {
|
||||
let url = properties.communityAPI+pid+"/projects";
|
||||
let url = properties.communityAPI+pid+"/projects/0/1";
|
||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||
.pipe(map(res => res['length']));
|
||||
.pipe(map(res => res['totalElements']));
|
||||
}
|
||||
getProjectFunders(properties:EnvProperties,pid:string) {
|
||||
let url = properties.communityAPI+pid+"/funders";
|
||||
return this.http.get<string[]>((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {HttpClient} from "@angular/common/http";
|
||||
import{EnvProperties} from '../../utils/properties/env-properties';
|
||||
|
||||
@Injectable()
|
||||
export class SearchZenodoCommunitiesService {
|
||||
constructor(private http: HttpClient ) {}
|
||||
|
||||
searchZCommunities (properties:EnvProperties, pid: string):any {
|
||||
let url = properties.communityAPI+pid+"/zenodocommunities";
|
||||
|
||||
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
|
||||
//.map(res => <any> res.json())
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
import { NgModule} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import {SearchZenodoCommunitiesService} from './searchZenodoCommunities.service';
|
||||
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule
|
||||
],
|
||||
declarations: [
|
||||
],
|
||||
providers:[
|
||||
SearchZenodoCommunitiesService
|
||||
],
|
||||
exports: [
|
||||
]
|
||||
})
|
||||
export class SearchZenodoCommunitiesServiceModule { }
|
|
@ -16,12 +16,11 @@ export class ZenodoCommunitiesService {
|
|||
//.map(res => <any> res.json())
|
||||
.pipe(map(res => [this.parseZenodoCommunities(res['hits'].hits),res['hits'].total]));
|
||||
}
|
||||
getZenodoCommunityById(properties:EnvProperties, url: string, openaireId:string) {
|
||||
getZenodoCommunityById(properties:EnvProperties, url: string) {
|
||||
return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)) : url)
|
||||
//.map(res => <any> res.json())
|
||||
.pipe(map(res => {
|
||||
var community = this.parseZenodoCommunity(res);
|
||||
community["openaireId"]=openaireId;
|
||||
return community;
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -6,5 +6,4 @@ export class ZenodoCommunityInfo {
|
|||
logoUrl: string;
|
||||
date: Date;
|
||||
page: string;
|
||||
openaireId:string;
|
||||
}
|
||||
|
|
|
@ -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)}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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";
|
|||
<span>Thematic</span>
|
||||
</ng-container>
|
||||
<!-- Projects -->
|
||||
<span uk-tooltip="Funded By" *ngIf="projects && projects.length > 0" [class.truncated]="projects.length > 3">
|
||||
{{projectNames.slice(0,3).join(', ')}}
|
||||
<span *ngIf="projects && projects.length > 0"
|
||||
[attr.uk-tooltip]="projects.length > projectsLimit ? 'cls: uk-invisible' : 'pos: top; cls: uk-active'" title="Funded by">
|
||||
{{showInline ? projectNames.join(', ') : projectNames.slice(0, projectsLimit).join(', ')}}
|
||||
<span *ngIf="projects.length > projectsLimit">
|
||||
<a *ngIf="!showInline" (click)="viewAllProjectsClick();" class="uk-background-muted custom-extra-entities">
|
||||
+{{projects.length - projectsLimit | number}} projects
|
||||
</a>
|
||||
<a *ngIf="showInline && lessBtn" (click)="showInline = !showInline; lessBtn = false;"
|
||||
class="uk-background-muted custom-extra-entities">
|
||||
View less
|
||||
</a>
|
||||
</span>
|
||||
</span>
|
||||
<!-- Organizations -->
|
||||
<span uk-tooltip="Partners" *ngIf="organizations && organizations.length > 0" [class.truncated]="organizations.length > 3">
|
||||
{{organizationNames.slice(0, 3).join(', ')}}
|
||||
<span *ngIf="organizations && organizations.length > 0"
|
||||
[attr.uk-tooltip]="organizations.length > organizationsLimit ? 'cls: uk-invisible' : 'pos: top; cls: uk-active'" title="Partners">
|
||||
{{showInline ? organizationNames.join(', ') : organizationNames.slice(0, organizationsLimit).join(', ')}}
|
||||
<span *ngIf="organizations.length > organizationsLimit">
|
||||
<a *ngIf="!showInline" (click)="viewAllPartnersClick();" class="uk-background-muted custom-extra-entities">
|
||||
+{{organizations.length - organizationsLimit | number}} partners
|
||||
</a>
|
||||
<a *ngIf="showInline && lessBtn" (click)="showInline = !showInline; lessBtn = false;"
|
||||
class="uk-background-muted custom-extra-entities">
|
||||
View less
|
||||
</a>
|
||||
</span>
|
||||
</span>
|
||||
<!-- Subjects -->
|
||||
<span uk-tooltip="Subjects" *ngIf="subjects && subjects.length > 0" [class.truncated]="subjects.length > 3">
|
||||
|
@ -169,10 +189,37 @@ import {RouterHelper} from "../../utils/routerHelper.class";
|
|||
<span>{{relationName}}</span>
|
||||
</ng-container>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<modal-alert *ngIf="!isMobile" #partnersModal>
|
||||
<div class="uk-text-small uk-text-emphasis uk-grid uk-grid-column-collapse uk-grid-row-small" uk-grid>
|
||||
<ng-container *ngFor="let item of organizations; let i = index">
|
||||
<div class="uk-margin-xsmall-right">
|
||||
{{item.name}}{{i == organizations.length - 1 ? '' : ','}}
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
</modal-alert>
|
||||
|
||||
<modal-alert *ngIf="!isMobile" #projectsModal>
|
||||
<div class="uk-text-small uk-text-emphasis uk-grid uk-grid-column-collapse uk-grid-row-small" uk-grid>
|
||||
<ng-container *ngFor="let item of projects; let i = index">
|
||||
<div class="uk-margin-xsmall-right">
|
||||
<span
|
||||
*ngIf="item['funderShortname'] || item['funderName']">{{item['funderShortname'] ? item['funderShortname'] : item['funderName']}}</span>
|
||||
<span *ngIf="!item['funderShortname'] && !item['funderName']">[no funder available]</span>
|
||||
<span *ngIf="item['acronym'] || item['title']">| {{ item['acronym'] ? item['acronym'] : item['title']}}</span>
|
||||
{{i == projects.length - 1 ? '' : ','}}
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
</modal-alert>
|
||||
`,
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>());
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
<span>Member</span>
|
||||
</div>
|
||||
<div [ngClass]="isMobile?'uk-flex uk-flex-middle uk-margin-left uk-margin-small-top':'uk-position-top-right uk-margin-top uk-margin-right uk-flex uk-flex-column uk-flex-middle'">
|
||||
<div *ngIf="type === 'community' && result.status === 'manager'">
|
||||
<div *ngIf="type === 'community' && result.isRestricted()">
|
||||
<icon [name]="visibilityIcon.get('RESTRICTED')" [ratio]="isMobile?0.8:1.2" [flex]="true"></icon>
|
||||
<span class="uk-text-small uk-text-capitalize" [class.uk-text-xsmall]="isMobile" [class.uk-margin-xsmall-left]="isMobile">restricted</span>
|
||||
</div>
|
||||
<ng-container *ngIf="type === 'community' && result.status === 'hidden'">
|
||||
<ng-container *ngIf="type === 'community' && result.isPrivate()">
|
||||
<icon [name]="visibilityIcon.get('PRIVATE')" [ratio]="isMobile?0.8:1.2" [flex]="true"></icon>
|
||||
<span class="uk-text-small uk-text-capitalize" [class.uk-text-xsmall]="isMobile" [class.uk-margin-xsmall-left]="isMobile">private</span>
|
||||
</ng-container>
|
||||
|
|
|
@ -109,7 +109,7 @@ import {properties} from "../../../../environments/environment";
|
|||
+{{authors.length - authorsLimit | number}} more
|
||||
</span>
|
||||
<span *ngIf="showAll && authors && authors.length > authorsLimit && !viewAll">
|
||||
<a (click)="viewAllClick();">
|
||||
<a (click)="viewAllClick();" class="uk-background-muted custom-extra-entities">
|
||||
+{{authors.length - authorsLimit | number}} Authors
|
||||
</a>
|
||||
</span>
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ export interface EnvProperties {
|
|||
cordisURL?: string;
|
||||
openDoarURL?: string;
|
||||
r3DataURL?: string;
|
||||
swhURL?: string;
|
||||
fairSharingURL?: string,
|
||||
eoscMarketplaceURL?: string,
|
||||
sherpaURL?: string;
|
||||
|
|
|
@ -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"];
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue