Browse Source

Migrate portfolio allocations to work with filters of assistant

pull/2933/head
Thomas Kaul 2 years ago
parent
commit
15ddf715e6
  1. 33
      apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts
  2. 2
      apps/client/src/app/pages/portfolio/allocations/allocations-page.html

33
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,

2
apps/client/src/app/pages/portfolio/allocations/allocations-page.html

@ -2,12 +2,14 @@
<div class="row">
<div class="col">
<h1 class="d-none d-sm-block h3 mb-3 text-center" i18n>Allocations</h1>
@if (!user?.settings?.isExperimentalFeatures) {
<gf-activities-filter
[allFilters]="allFilters"
[isLoading]="isLoading"
[placeholder]="placeholder"
(valueChanged)="filters$.next($event)"
></gf-activities-filter>
}
</div>
</div>
<div class="row">

Loading…
Cancel
Save