|
|
@ -48,6 +48,7 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { |
|
|
|
{ label: 'Initial', value: 'original' }, |
|
|
|
{ label: 'Current', value: 'current' } |
|
|
|
]; |
|
|
|
public placeholder = ''; |
|
|
|
public portfolioDetails: PortfolioDetails; |
|
|
|
public positions: { |
|
|
|
[symbol: string]: Pick< |
|
|
@ -73,6 +74,7 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { |
|
|
|
value: number; |
|
|
|
}; |
|
|
|
}; |
|
|
|
public tags = ['high-risk', 'pension']; |
|
|
|
|
|
|
|
public user: User; |
|
|
|
|
|
|
@ -120,17 +122,6 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { |
|
|
|
this.hasImpersonationId = !!aId; |
|
|
|
}); |
|
|
|
|
|
|
|
this.dataService |
|
|
|
.fetchPortfolioDetails({}) |
|
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
|
.subscribe((portfolioDetails) => { |
|
|
|
this.portfolioDetails = portfolioDetails; |
|
|
|
|
|
|
|
this.initializeAnalysisData(this.period); |
|
|
|
|
|
|
|
this.changeDetectorRef.markForCheck(); |
|
|
|
}); |
|
|
|
|
|
|
|
this.userService.stateChanged |
|
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
|
.subscribe((state) => { |
|
|
@ -142,7 +133,7 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public initializeAnalysisData(aPeriod: string) { |
|
|
|
public initialize() { |
|
|
|
this.accounts = {}; |
|
|
|
this.continents = { |
|
|
|
[UNKNOWN_KEY]: { |
|
|
@ -185,6 +176,10 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { |
|
|
|
value: 0 |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
public initializeAnalysisData(aPeriod: string) { |
|
|
|
this.initialize(); |
|
|
|
|
|
|
|
for (const [id, { current, name, original }] of Object.entries( |
|
|
|
this.portfolioDetails.accounts |
|
|
@ -342,6 +337,25 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public onUpdateFilters(tags: string[] = []) { |
|
|
|
this.update(tags); |
|
|
|
} |
|
|
|
|
|
|
|
public update(tags?: string[]) { |
|
|
|
this.initialize(); |
|
|
|
|
|
|
|
this.dataService |
|
|
|
.fetchPortfolioDetails({ tags }) |
|
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
|
.subscribe((portfolioDetails) => { |
|
|
|
this.portfolioDetails = portfolioDetails; |
|
|
|
|
|
|
|
this.initializeAnalysisData(this.period); |
|
|
|
|
|
|
|
this.changeDetectorRef.markForCheck(); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public ngOnDestroy() { |
|
|
|
this.unsubscribeSubject.next(); |
|
|
|
this.unsubscribeSubject.complete(); |
|
|
|