Update to Angular 16 #16

Merged
k.triantafyllou merged 66 commits from angular-16 into develop 2023-10-30 10:57:26 +01:00
7 changed files with 69 additions and 10 deletions
Showing only changes of commit 69bbccd009 - Show all commits

View File

@ -1,6 +1,7 @@
import {HttpParams} from '@angular/common/http'; import {HttpParams} from '@angular/common/http';
import {properties} from "../../../environments/environment"; import {properties} from "../../../environments/environment";
import {Session} from "../login/utils/helper.class"; import {Session} from "../login/utils/helper.class";
import {CommunityInfo} from "./community/communityInfo";
export class ConnectHelper { export class ConnectHelper {
@ -53,7 +54,12 @@ export class ConnectHelper {
} }
public static isPrivate(community, user) { public static isPrivate(community: CommunityInfo, user) {
return community && (community.isPrivate() || (community.isRestricted() && !(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) ||
(!community.isOpen() && Session.isMember('community', community.communityId, user))
)))
} }
} }

View File

@ -34,7 +34,7 @@ import {ClearCacheService} from "../services/clear-cache.service";
<loading></loading> <loading></loading>
</div> </div>
</modal-alert> </modal-alert>
<modal-alert #memberModal [overflowBody]="false" *ngIf="service == 'monitor'" (cancelOutput)="cancel()" <modal-alert #memberModal [overflowBody]="false" (cancelOutput)="cancel()"
(alertOutput)="verifyMember()" [okDisabled]="(code.invalid || loading) && !isMember"> (alertOutput)="verifyMember()" [okDisabled]="(code.invalid || loading) && !isMember">
<div *ngIf="!isMember"> <div *ngIf="!isMember">
<div> <div>
@ -119,12 +119,8 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn
ngAfterViewInit() { ngAfterViewInit() {
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.user = user; this.user = user;
if (this.paramsSubscription instanceof Subscription) {
this.paramsSubscription.unsubscribe();
}
this.paramsSubscription = this.route.queryParams.subscribe(params => { this.paramsSubscription = this.route.queryParams.subscribe(params => {
if (params) { if (params) {
this.isMember = !!params['isMember'];
this.cdr.detectChanges(); this.cdr.detectChanges();
if(params['verify'] && !this.isMember) { if(params['verify'] && !this.isMember) {
if (this.user) { if (this.user) {
@ -133,7 +129,7 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn
if (this.user.email === this.verification.email.toLowerCase() && this.id === this.verification.entity && this.type === this.verification.type) { if (this.user.email === this.verification.email.toLowerCase() && this.id === this.verification.entity && this.type === this.verification.type) {
if (this.verification.verificationType === 'manager') { if (this.verification.verificationType === 'manager') {
this.openManagerModal(); this.openManagerModal();
} else if (this.verification.verificationType === 'member' && this.service === "monitor") { } else if (this.verification.verificationType === 'member') {
this.openMemberModal(); this.openMemberModal();
} else { } else {
this.openErrorModal(); this.openErrorModal();
@ -217,6 +213,9 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn
this.managerModal.cancel(); this.managerModal.cancel();
this.error = null; this.error = null;
this.userManagementService.updateUserInfo(() => { this.userManagementService.updateUserInfo(() => {
if (this.paramsSubscription instanceof Subscription) {
this.paramsSubscription.unsubscribe();
}
if (this.service === "monitor") { if (this.service === "monitor") {
this.loading = false; this.loading = false;
this.router.navigate(['/admin/' + this.verification.entity]); this.router.navigate(['/admin/' + this.verification.entity]);
@ -254,8 +253,12 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn
this.clearCacheService.clearCache('Members updated'); this.clearCacheService.clearCache('Members updated');
this.loading = false; this.loading = false;
this.error = null; this.error = null;
this.isMember = true;
this.userManagementService.updateUserInfo(() => { this.userManagementService.updateUserInfo(() => {
this.router.navigate([], {queryParams: {'verify': null, 'isMember': true}}); if (this.paramsSubscription instanceof Subscription) {
this.paramsSubscription.unsubscribe();
}
this.cancel();
}); });
}, error => { }, error => {
this.loading = false; this.loading = false;
@ -271,6 +274,7 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn
} }
cancel() { cancel() {
this.router.navigate([], {queryParams: {'verify': null, 'isMember': null}}); this.isMember = false;
this.router.navigate([]);
} }
} }

View File

@ -0,0 +1,25 @@
import {EnvProperties} from "../env-properties";
export let common: EnvProperties = {
swhURL: "https://archive.softwareheritage.org/",
// searchCrossrefAPIURL: "https://api.crossref.org/works",
// searchDataciteAPIURL: "https://api.datacite.org/works",
// searchOrcidURL: "https://pub.orcid.org/v2.1/",
// orcidURL: "https://orcid.org/",
// doiURL: "https://doi.org/",
// pmcURL: "http://europepmc.org/articles/",
// pmidURL: "https://www.ncbi.nlm.nih.gov/pubmed/",
// handleURL: "http://hdl.handle.net/",
// cordisURL: "http://cordis.europa.eu/projects/",
// openDoarURL: "http://v2.sherpa.ac.uk/id/repository/",
// r3DataURL: "http://service.re3data.org/repository/",
// fairSharingURL: "https://fairsharing.org/",
// sherpaURL: "http://sherpa.ac.uk/romeo/issn/",
// sherpaURLSuffix: "/",
// zenodo: "https://zenodo.org/",
// openAccess: "https://www.openaire.eu/support/faq#article-id-234",
// openAccessRepo: "https://www.openaire.eu/support/faq#article-id-310",
// fp7Guidlines: "https://www.openaire.eu/open-access-in-fp7-seventh-research-framework-programme",
// h2020Guidlines: "https://www.openaire.eu/oa-publications/h2020/open-access-in-horizon-2020",
// ercGuidlines: "http://erc.europa.eu/sites/default/files/document/file/ERC_Open_Access_Guidelines-revised_2014.pdf",
}

View File

@ -0,0 +1,6 @@
import {EnvProperties} from "../env-properties";
export let commonBeta: EnvProperties = {
// searchAPIURLLAst: "http://beta.services.openaire.eu/search/v2/api/",
// searchResourcesAPIURL: "https://beta.services.openaire.eu/search/v2/api/resources",
}

View File

@ -0,0 +1,6 @@
import {EnvProperties} from "../env-properties";
export let commonProd: EnvProperties = {
// searchAPIURLLAst: "https://services.openaire.eu/search/v2/api/",
// searchResourcesAPIURL: "https://services.openaire.eu/search/v2/api/resources",
}

View File

@ -0,0 +1,6 @@
import {EnvProperties} from "../env-properties";
export let commonTest: EnvProperties = {
// searchAPIURLLAst: "https://services.openaire.eu/shadowSearch/v2/api/",
// searchResourcesAPIURL: "https://services.openaire.eu/shadowSearch/v2/api/resources",
}

View File

@ -0,0 +1,6 @@
import {EnvProperties} from "../env-properties";
export let commonDev: EnvProperties = {
// searchAPIURLLAst: "http://beta.services.openaire.eu/search/v2/api/",
// searchResourcesAPIURL: "https://beta.services.openaire.eu/search/v2/api/resources",
}