From 15ddf715e69f4f4ea96efb6e869a9e328f6736bc Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 27 Jan 2024 19:47:36 +0100 Subject: [PATCH] Migrate portfolio allocations to work with filters of assistant --- .../allocations/allocations-page.component.ts | 33 +++++++++++++++++-- .../allocations/allocations-page.html | 2 ++ 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts b/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts index 9ef2ed9d7..01c0fb13f 100644 --- a/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts +++ b/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts @@ -148,9 +148,7 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { this.initialize(); - return this.dataService.fetchPortfolioDetails({ - filters: this.activeFilters - }); + return this.fetchPortfolioDetails(); }), takeUntil(this.unsubscribeSubject) ) @@ -210,6 +208,26 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { ? `{0}%` : `{0} ${this.user?.settings?.baseCurrency}`; + if (this.user?.settings?.isExperimentalFeatures === true) { + this.isLoading = true; + + this.initialize(); + + this.fetchPortfolioDetails() + .pipe(takeUntil(this.unsubscribeSubject)) + .subscribe((portfolioDetails) => { + this.initialize(); + + this.portfolioDetails = portfolioDetails; + + this.initializeAnalysisData(); + + this.isLoading = false; + + this.changeDetectorRef.markForCheck(); + }); + } + this.changeDetectorRef.markForCheck(); } }); @@ -561,6 +579,15 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { this.unsubscribeSubject.complete(); } + private fetchPortfolioDetails() { + return this.dataService.fetchPortfolioDetails({ + filters: + this.activeFilters.length > 0 + ? this.activeFilters + : this.userService.getFilters() + }); + } + private openAccountDetailDialog(aAccountId: string) { const dialogRef = this.dialog.open(AccountDetailDialog, { autoFocus: false, diff --git a/apps/client/src/app/pages/portfolio/allocations/allocations-page.html b/apps/client/src/app/pages/portfolio/allocations/allocations-page.html index e082ca2b5..55a308dac 100644 --- a/apps/client/src/app/pages/portfolio/allocations/allocations-page.html +++ b/apps/client/src/app/pages/portfolio/allocations/allocations-page.html @@ -2,12 +2,14 @@