|
|
@ -22,7 +22,13 @@ import { GfValueComponent } from '@ghostfolio/ui/value'; |
|
|
import { GfWorldMapChartComponent } from '@ghostfolio/ui/world-map-chart'; |
|
|
import { GfWorldMapChartComponent } from '@ghostfolio/ui/world-map-chart'; |
|
|
|
|
|
|
|
|
import { NgClass } from '@angular/common'; |
|
|
import { NgClass } from '@angular/common'; |
|
|
import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core'; |
|
|
import { |
|
|
|
|
|
ChangeDetectorRef, |
|
|
|
|
|
Component, |
|
|
|
|
|
DestroyRef, |
|
|
|
|
|
OnInit |
|
|
|
|
|
} from '@angular/core'; |
|
|
|
|
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; |
|
|
import { MatCardModule } from '@angular/material/card'; |
|
|
import { MatCardModule } from '@angular/material/card'; |
|
|
import { MatDialog } from '@angular/material/dialog'; |
|
|
import { MatDialog } from '@angular/material/dialog'; |
|
|
import { MatProgressBarModule } from '@angular/material/progress-bar'; |
|
|
import { MatProgressBarModule } from '@angular/material/progress-bar'; |
|
|
@ -36,8 +42,6 @@ import { |
|
|
} from '@prisma/client'; |
|
|
} from '@prisma/client'; |
|
|
import { isNumber } from 'lodash'; |
|
|
import { isNumber } from 'lodash'; |
|
|
import { DeviceDetectorService } from 'ngx-device-detector'; |
|
|
import { DeviceDetectorService } from 'ngx-device-detector'; |
|
|
import { Subject } from 'rxjs'; |
|
|
|
|
|
import { takeUntil } from 'rxjs/operators'; |
|
|
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
@Component({ |
|
|
imports: [ |
|
|
imports: [ |
|
|
@ -54,7 +58,7 @@ import { takeUntil } from 'rxjs/operators'; |
|
|
styleUrls: ['./allocations-page.scss'], |
|
|
styleUrls: ['./allocations-page.scss'], |
|
|
templateUrl: './allocations-page.html' |
|
|
templateUrl: './allocations-page.html' |
|
|
}) |
|
|
}) |
|
|
export class GfAllocationsPageComponent implements OnDestroy, OnInit { |
|
|
export class GfAllocationsPageComponent implements OnInit { |
|
|
public accounts: { |
|
|
public accounts: { |
|
|
[id: string]: Pick<Account, 'name'> & { |
|
|
[id: string]: Pick<Account, 'name'> & { |
|
|
id: string; |
|
|
id: string; |
|
|
@ -119,11 +123,10 @@ export class GfAllocationsPageComponent implements OnDestroy, OnInit { |
|
|
public user: User; |
|
|
public user: User; |
|
|
public worldMapChartFormat: string; |
|
|
public worldMapChartFormat: string; |
|
|
|
|
|
|
|
|
private unsubscribeSubject = new Subject<void>(); |
|
|
|
|
|
|
|
|
|
|
|
public constructor( |
|
|
public constructor( |
|
|
private changeDetectorRef: ChangeDetectorRef, |
|
|
private changeDetectorRef: ChangeDetectorRef, |
|
|
private dataService: DataService, |
|
|
private dataService: DataService, |
|
|
|
|
|
private destroyRef: DestroyRef, |
|
|
private deviceService: DeviceDetectorService, |
|
|
private deviceService: DeviceDetectorService, |
|
|
private dialog: MatDialog, |
|
|
private dialog: MatDialog, |
|
|
private impersonationStorageService: ImpersonationStorageService, |
|
|
private impersonationStorageService: ImpersonationStorageService, |
|
|
@ -132,7 +135,7 @@ export class GfAllocationsPageComponent implements OnDestroy, OnInit { |
|
|
private userService: UserService |
|
|
private userService: UserService |
|
|
) { |
|
|
) { |
|
|
this.route.queryParams |
|
|
this.route.queryParams |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.subscribe((params) => { |
|
|
.subscribe((params) => { |
|
|
if (params['accountId'] && params['accountDetailDialog']) { |
|
|
if (params['accountId'] && params['accountDetailDialog']) { |
|
|
this.openAccountDetailDialog(params['accountId']); |
|
|
this.openAccountDetailDialog(params['accountId']); |
|
|
@ -145,13 +148,13 @@ export class GfAllocationsPageComponent implements OnDestroy, OnInit { |
|
|
|
|
|
|
|
|
this.impersonationStorageService |
|
|
this.impersonationStorageService |
|
|
.onChangeHasImpersonation() |
|
|
.onChangeHasImpersonation() |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.subscribe((impersonationId) => { |
|
|
.subscribe((impersonationId) => { |
|
|
this.hasImpersonationId = !!impersonationId; |
|
|
this.hasImpersonationId = !!impersonationId; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
this.userService.stateChanged |
|
|
this.userService.stateChanged |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.subscribe((state) => { |
|
|
.subscribe((state) => { |
|
|
if (state?.user) { |
|
|
if (state?.user) { |
|
|
this.user = state.user; |
|
|
this.user = state.user; |
|
|
@ -166,7 +169,7 @@ export class GfAllocationsPageComponent implements OnDestroy, OnInit { |
|
|
this.initialize(); |
|
|
this.initialize(); |
|
|
|
|
|
|
|
|
this.fetchPortfolioDetails() |
|
|
this.fetchPortfolioDetails() |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.subscribe((portfolioDetails) => { |
|
|
.subscribe((portfolioDetails) => { |
|
|
this.initialize(); |
|
|
this.initialize(); |
|
|
|
|
|
|
|
|
@ -202,11 +205,6 @@ export class GfAllocationsPageComponent implements OnDestroy, OnInit { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public ngOnDestroy() { |
|
|
|
|
|
this.unsubscribeSubject.next(); |
|
|
|
|
|
this.unsubscribeSubject.complete(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private extractEtfProvider({ |
|
|
private extractEtfProvider({ |
|
|
assetSubClass, |
|
|
assetSubClass, |
|
|
name |
|
|
name |
|
|
@ -578,7 +576,7 @@ export class GfAllocationsPageComponent implements OnDestroy, OnInit { |
|
|
|
|
|
|
|
|
dialogRef |
|
|
dialogRef |
|
|
.afterClosed() |
|
|
.afterClosed() |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
.subscribe(() => { |
|
|
.subscribe(() => { |
|
|
this.router.navigate(['.'], { relativeTo: this.route }); |
|
|
this.router.navigate(['.'], { relativeTo: this.route }); |
|
|
}); |
|
|
}); |
|
|
|