|
|
|
@ -4,6 +4,7 @@ import { |
|
|
|
AdminMarketDataDetails, |
|
|
|
LineChartItem |
|
|
|
} from '@ghostfolio/common/interfaces'; |
|
|
|
import { internalRoutes } from '@ghostfolio/common/routes/routes'; |
|
|
|
import { GfDialogFooterComponent } from '@ghostfolio/ui/dialog-footer'; |
|
|
|
import { GfDialogHeaderComponent } from '@ghostfolio/ui/dialog-header'; |
|
|
|
import { DataService } from '@ghostfolio/ui/services'; |
|
|
|
@ -18,16 +19,25 @@ import { |
|
|
|
OnInit |
|
|
|
} from '@angular/core'; |
|
|
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; |
|
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
|
import { |
|
|
|
MAT_DIALOG_DATA, |
|
|
|
MatDialogModule, |
|
|
|
MatDialogRef |
|
|
|
} from '@angular/material/dialog'; |
|
|
|
import { NavigationStart, Router, RouterModule } from '@angular/router'; |
|
|
|
import { IonIcon } from '@ionic/angular/standalone'; |
|
|
|
import { format } from 'date-fns'; |
|
|
|
import { addIcons } from 'ionicons'; |
|
|
|
import { createOutline } from 'ionicons/icons'; |
|
|
|
import { filter } from 'rxjs/operators'; |
|
|
|
|
|
|
|
import { GfLineChartComponent } from '../../line-chart/line-chart.component'; |
|
|
|
import { GfValueComponent } from '../../value/value.component'; |
|
|
|
import { BenchmarkDetailDialogParams } from './interfaces/interfaces'; |
|
|
|
import { |
|
|
|
BenchmarkDetailDialogParams, |
|
|
|
BenchmarkDetailDialogResult |
|
|
|
} from './interfaces/interfaces'; |
|
|
|
|
|
|
|
@Component({ |
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush, |
|
|
|
@ -37,7 +47,10 @@ import { BenchmarkDetailDialogParams } from './interfaces/interfaces'; |
|
|
|
GfDialogHeaderComponent, |
|
|
|
GfLineChartComponent, |
|
|
|
GfValueComponent, |
|
|
|
MatDialogModule |
|
|
|
IonIcon, |
|
|
|
MatButtonModule, |
|
|
|
MatDialogModule, |
|
|
|
RouterModule |
|
|
|
], |
|
|
|
schemas: [CUSTOM_ELEMENTS_SCHEMA], |
|
|
|
selector: 'gf-benchmark-detail-dialog', |
|
|
|
@ -49,15 +62,37 @@ export class GfBenchmarkDetailDialogComponent implements OnInit { |
|
|
|
public historicalDataItems: LineChartItem[]; |
|
|
|
public isLoading = true; |
|
|
|
public precision = 2; |
|
|
|
|
|
|
|
public readonly routerLinkAdminControlMarketDataUpdate = |
|
|
|
internalRoutes.adminControl.subRoutes.marketData.subRoutes.update |
|
|
|
.routerLink; |
|
|
|
|
|
|
|
public value: number; |
|
|
|
|
|
|
|
public constructor( |
|
|
|
private changeDetectorRef: ChangeDetectorRef, |
|
|
|
@Inject(MAT_DIALOG_DATA) public data: BenchmarkDetailDialogParams, |
|
|
|
private dataService: DataService, |
|
|
|
public dialogRef: MatDialogRef< |
|
|
|
GfBenchmarkDetailDialogComponent, |
|
|
|
BenchmarkDetailDialogResult |
|
|
|
>, |
|
|
|
private destroyRef: DestroyRef, |
|
|
|
public dialogRef: MatDialogRef<GfBenchmarkDetailDialogComponent>, |
|
|
|
@Inject(MAT_DIALOG_DATA) public data: BenchmarkDetailDialogParams |
|
|
|
) {} |
|
|
|
private router: Router |
|
|
|
) { |
|
|
|
this.router.events |
|
|
|
.pipe( |
|
|
|
filter((event) => { |
|
|
|
return event instanceof NavigationStart; |
|
|
|
}), |
|
|
|
takeUntilDestroyed(this.destroyRef) |
|
|
|
) |
|
|
|
.subscribe(() => { |
|
|
|
this.dialogRef.close({ isNavigating: true }); |
|
|
|
}); |
|
|
|
|
|
|
|
addIcons({ createOutline }); |
|
|
|
} |
|
|
|
|
|
|
|
public ngOnInit() { |
|
|
|
this.dataService |
|
|
|
|