Browse Source

Refactoring

pull/7146/head
Thomas Kaul 3 weeks ago
parent
commit
9eb6fac1ee
  1. 14
      apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts
  2. 3
      apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.html

14
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();
}
}

3
apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.html

@ -58,7 +58,8 @@
/>
</mat-form-field>
</div>
} @else if (hasExperimentalFeatures) {
}
@if (canApplyFilters) {
<h2 class="h6" i18n>Filters</h2>
<div class="flex-grow-1 py-0">
<gf-portfolio-filter-form

Loading…
Cancel
Save