Browse Source

Refactoring

pull/7146/head
Thomas Kaul 3 weeks ago
parent
commit
87ac23651c
  1. 26
      apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts
  2. 22
      apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.html
  3. 20
      libs/ui/src/lib/assistant/assistant.component.ts

26
apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts

@ -178,19 +178,6 @@ export class GfCreateOrUpdateAccessDialogComponent implements OnInit {
);
}
private loadHoldings() {
this.dataService
.fetchPortfolioHoldings()
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(({ holdings }) => {
this.holdings = getHoldingsForFilter(holdings);
this.updateFiltersFormControl(this.data.access?.settings?.filters);
this.changeDetectorRef.markForCheck();
});
}
private async createAccess() {
const filters = this.buildFilters();
@ -230,6 +217,19 @@ export class GfCreateOrUpdateAccessDialogComponent implements OnInit {
}
}
private loadHoldings() {
this.dataService
.fetchPortfolioHoldings()
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe(({ holdings }) => {
this.holdings = getHoldingsForFilter(holdings);
this.updateFiltersFormControl(this.data.access?.settings?.filters);
this.changeDetectorRef.markForCheck();
});
}
private async updateAccess() {
const accessId = this.data.access?.id;

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

@ -60,18 +60,16 @@
</div>
}
@if (canApplyFilters) {
<h2 class="h6" i18n>Filters</h2>
<div class="flex-grow-1 py-0">
<gf-portfolio-filter-form
appearance="outline"
class="w-100"
formControlName="filters"
[accounts]="accounts"
[assetClasses]="assetClasses"
[holdings]="holdings"
[tags]="tags"
/>
</div>
<h2 class="h6" i18n>Portfolio Filters</h2>
<gf-portfolio-filter-form
appearance="outline"
class="w-100"
formControlName="filters"
[accounts]="accounts"
[assetClasses]="assetClasses"
[holdings]="holdings"
[tags]="tags"
/>
}
</div>
<div class="justify-content-end" mat-dialog-actions>

20
libs/ui/src/lib/assistant/assistant.component.ts

@ -722,14 +722,26 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
const settings = this.user?.settings;
const filters = [
{ id: settings?.['filters.accounts']?.[0] ?? '', type: 'ACCOUNT' },
{
id: settings?.['filters.accounts']?.[0] ?? '',
type: 'ACCOUNT'
},
{
id: settings?.['filters.assetClasses']?.[0] ?? '',
type: 'ASSET_CLASS'
},
{ id: settings?.['filters.dataSource'] ?? '', type: 'DATA_SOURCE' },
{ id: settings?.['filters.symbol'] ?? '', type: 'SYMBOL' },
{ id: settings?.['filters.tags']?.[0] ?? '', type: 'TAG' }
{
id: settings?.['filters.dataSource'] ?? '',
type: 'DATA_SOURCE'
},
{
id: settings?.['filters.symbol'] ?? '',
type: 'SYMBOL'
},
{
id: settings?.['filters.tags']?.[0] ?? '',
type: 'TAG'
}
].filter(({ id }) => {
return !!id;
}) as Filter[];

Loading…
Cancel
Save