From a4dbbffe20618566a2e3d994e25629ce5ef1b03e Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 26 Jan 2023 12:35:05 +0200 Subject: [PATCH 1/4] Portals: Add piwik as a column. Add pid in search --- dashboard/portal/portals.component.html | 8 ++++++-- dashboard/portal/portals.component.ts | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dashboard/portal/portals.component.html b/dashboard/portal/portals.component.html index 9f57de8c..6910431c 100644 --- a/dashboard/portal/portals.component.html +++ b/dashboard/portal/portals.component.html @@ -55,11 +55,11 @@ Bulk Actions ({{getSelectedPortals().length}})
-
@@ -67,6 +67,7 @@ Name Type + Piwik Actions @@ -81,6 +82,9 @@
{{check.portal.type}}
+ +
{{check.portal.piwik}}
+
diff --git a/dashboard/portal/portals.component.ts b/dashboard/portal/portals.component.ts index be2ed599..d9dec3ec 100644 --- a/dashboard/portal/portals.component.ts +++ b/dashboard/portal/portals.component.ts @@ -229,11 +229,11 @@ export class PortalsComponent implements OnInit { public filterByType(portal: Portal): boolean { let type = this.filterForm.get("type").value; - return type == "all" || (type == portal.type); + return type == "all" || (type === portal.type); } public filterPortals(portal: Portal): boolean { - return this.searchText.toString() === '' || (portal.name || portal.type).match(this.searchText) != null; + return this.searchText.toString() === '' || (portal.name + portal.type + portal.pid).match(this.searchText) != null; } handleUpdateError(message: string, error = null) { From 1e35eb5d6f544621b8f5d6a3446d59f5647e95a8 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 9 Feb 2023 16:30:24 +0200 Subject: [PATCH 2/4] 1. Add cache in get managers and members methods. 2. Add delete Authorization level with values curator and manager in role users for managers. Authorization level for mebers are always manager. 3. Clear cache when managers and members list has been updated. --- .../role-users/role-users.component.html | 8 +++--- .../users/role-users/role-users.component.ts | 18 +++++++++++++ .../role-verification.component.ts | 6 ++++- services/user-registry.service.ts | 27 ++++++++++--------- 4 files changed, 43 insertions(+), 16 deletions(-) diff --git a/dashboard/users/role-users/role-users.component.html b/dashboard/users/role-users/role-users.component.html index 83681f59..f9f2e444 100644 --- a/dashboard/users/role-users/role-users.component.html +++ b/dashboard/users/role-users/role-users.component.html @@ -67,9 +67,11 @@
{{(showCurrent) ? item.email : item}}
- + (alertOutput)="verifyMember()" [okDisabled]="(code.invalid || loading) && !isMember">
You have been invited to join {{name}} Monitor Dashboard as a member. @@ -108,7 +108,8 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn private emailService: EmailService, private userManagementService: UserManagementService, private userRegistryService: UserRegistryService, - private clearCacheService: ClearCacheService) { + private clearCacheService: ClearCacheService, + private cdr: ChangeDetectorRef) { } ngOnInit() { @@ -122,33 +123,42 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn this.paramsSubscription.unsubscribe(); } this.paramsSubscription = this.route.queryParams.subscribe(params => { - if (params && params['verify']) { - if (this.user) { - this.subscriptions.push(this.userRegistryService.getInvitation(params['verify']).subscribe(verification => { - this.verification = verification; - if (this.user.email === this.verification.email.toLowerCase() && this.id === this.verification.entity && this.type === this.verification.type) { - if (this.verification.verificationType === 'manager') { - this.openManagerModal(); - } else if (this.verification.verificationType === 'member' && this.service === "monitor") { - this.openMemberModal(); + if (params) { + this.isMember = !!params['isMember']; + this.cdr.detectChanges(); + if(params['verify'] && !this.isMember) { + if (this.user) { + this.subscriptions.push(this.userRegistryService.getInvitation(params['verify']).subscribe(verification => { + this.verification = verification; + if (this.user.email === this.verification.email.toLowerCase() && this.id === this.verification.entity && this.type === this.verification.type) { + if (this.verification.verificationType === 'manager') { + this.openManagerModal(); + } else if (this.verification.verificationType === 'member' && this.service === "monitor") { + this.openMemberModal(); + } else { + this.openErrorModal(); + } } else { this.openErrorModal(); } - } else { + }, error => { this.openErrorModal(); - } - }, error => { - this.openErrorModal(); - })); - } else { - this.router.navigate(['user-info'], { - queryParams: { - 'errorCode': LoginErrorCodes.NOT_LOGIN, - 'redirectUrl': this.router.url - }, - relativeTo: this.route - }); + })); + } else { + this.router.navigate(['user-info'], { + queryParams: { + 'errorCode': LoginErrorCodes.NOT_LOGIN, + 'redirectUrl': this.router.url + }, + relativeTo: this.route + }); + } + } else if(this.isMember) { + this.openMemberModal(); } + } else { + this.isMember = false; + this.cdr.detectChanges(); } }); })); @@ -177,12 +187,18 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn public openMemberModal() { this.error = null; - this.isMember = false; + if(this.isMember) { + this.memberModal.cancelButton = false; + this.memberModal.okButtonText = 'Close'; + } else { + this.memberModal.cancelButton = true; + this.memberModal.okButtonText = 'Accept'; + } this.memberModal.okButtonLeft = false; - this.memberModal.okButtonText = 'Accept'; this.memberModal.stayOpen = true; this.memberModal.cancelButtonText = 'Cancel'; this.memberModal.alertTitle = 'Member Invitation'; + this.cdr.detectChanges(); this.memberModal.open(); } @@ -239,9 +255,7 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn this.loading = false; this.error = null; this.userManagementService.updateUserInfo(() => { - this.memberModal.cancelButton = false; - this.memberModal.okButtonText = 'Close'; - this.isMember = true; + this.router.navigate([], {queryParams: {'verify': null, 'isMember': true}}); }); }, error => { this.loading = false; @@ -257,6 +271,6 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn } cancel() { - this.router.navigate([this.router.url.split('?')[0]]); + this.router.navigate([], {queryParams: {'verify': null, 'isMember': null}}); } }