From 9eb6fac1ee62d38701c12728ee913ae9f3001dc5 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 27 Jun 2026 12:07:35 +0200 Subject: [PATCH] Refactoring --- .../create-or-update-access-dialog.component.ts | 14 +++++++++++--- .../create-or-update-access-dialog.html | 3 ++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts b/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts index c1e19af8a..b33952070 100644 --- a/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts +++ b/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts @@ -67,13 +67,14 @@ import { CreateOrUpdateAccessDialogParams } from './interfaces/interfaces'; export class GfCreateOrUpdateAccessDialogComponent implements OnInit { public accounts: AccountWithPlatform[] = []; public assetClasses: Filter[] = []; - public hasExperimentalFeatures = false; public holdings: PortfolioPosition[] = []; public tags: Filter[] = []; protected accessForm: FormGroup; protected readonly mode: 'create' | 'update'; + private hasExperimentalFeatures = false; + private readonly changeDetectorRef = inject(ChangeDetectorRef); private readonly data = @@ -93,6 +94,13 @@ export class GfCreateOrUpdateAccessDialogComponent implements OnInit { this.mode = this.data.access ? 'update' : 'create'; } + public get canApplyFilters() { + return ( + this.accessForm?.get('type')?.value === 'PUBLIC' && + this.hasExperimentalFeatures + ); + } + public ngOnInit() { const access = this.data?.access; const isPublic = access?.type === 'PUBLIC'; @@ -146,7 +154,7 @@ export class GfCreateOrUpdateAccessDialogComponent implements OnInit { access?.permissions[0] ?? AccessPermission.READ_RESTRICTED ); - if (this.hasExperimentalFeatures) { + if (this.canApplyFilters) { this.loadHoldings(); } } @@ -156,7 +164,7 @@ export class GfCreateOrUpdateAccessDialogComponent implements OnInit { this.changeDetectorRef.markForCheck(); }); - if (isPublic && this.hasExperimentalFeatures) { + if (this.canApplyFilters) { this.loadHoldings(); } } diff --git a/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.html b/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.html index 504066e97..925f7f855 100644 --- a/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.html +++ b/apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.html @@ -58,7 +58,8 @@ /> - } @else if (hasExperimentalFeatures) { + } + @if (canApplyFilters) {