|
|
@ -1,3 +1,5 @@ |
|
|
|
import { ConfirmationDialogType } from '@ghostfolio/client/core/notification/confirmation-dialog/confirmation-dialog.type'; |
|
|
|
import { NotificationService } from '@ghostfolio/client/core/notification/notification.service'; |
|
|
|
import { getLocale, resolveMarketCondition } from '@ghostfolio/common/helper'; |
|
|
|
import { |
|
|
|
AssetProfileIdentifier, |
|
|
@ -13,11 +15,15 @@ import { |
|
|
|
CUSTOM_ELEMENTS_SCHEMA, |
|
|
|
ChangeDetectionStrategy, |
|
|
|
Component, |
|
|
|
EventEmitter, |
|
|
|
Input, |
|
|
|
OnChanges, |
|
|
|
OnDestroy |
|
|
|
OnDestroy, |
|
|
|
Output |
|
|
|
} from '@angular/core'; |
|
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
|
import { MatDialog } from '@angular/material/dialog'; |
|
|
|
import { MatMenuModule } from '@angular/material/menu'; |
|
|
|
import { MatTableModule } from '@angular/material/table'; |
|
|
|
import { ActivatedRoute, Router, RouterModule } from '@angular/router'; |
|
|
|
import { isNumber } from 'lodash'; |
|
|
@ -33,6 +39,8 @@ import { BenchmarkDetailDialogParams } from './benchmark-detail-dialog/interface |
|
|
|
CommonModule, |
|
|
|
GfTrendIndicatorComponent, |
|
|
|
GfValueComponent, |
|
|
|
MatButtonModule, |
|
|
|
MatMenuModule, |
|
|
|
MatTableModule, |
|
|
|
NgxSkeletonLoaderModule, |
|
|
|
RouterModule |
|
|
@ -45,10 +53,19 @@ import { BenchmarkDetailDialogParams } from './benchmark-detail-dialog/interface |
|
|
|
export class GfBenchmarkComponent implements OnChanges, OnDestroy { |
|
|
|
@Input() benchmarks: Benchmark[]; |
|
|
|
@Input() deviceType: string; |
|
|
|
@Input() hasPermissionToDeleteItem: boolean; |
|
|
|
@Input() locale = getLocale(); |
|
|
|
@Input() user: User; |
|
|
|
|
|
|
|
public displayedColumns = ['name', 'date', 'change', 'marketCondition']; |
|
|
|
@Output() itemDeleted = new EventEmitter<AssetProfileIdentifier>(); |
|
|
|
|
|
|
|
public displayedColumns = [ |
|
|
|
'name', |
|
|
|
'date', |
|
|
|
'change', |
|
|
|
'marketCondition', |
|
|
|
'actions' |
|
|
|
]; |
|
|
|
public isLoading = true; |
|
|
|
public isNumber = isNumber; |
|
|
|
public resolveMarketCondition = resolveMarketCondition; |
|
|
@ -58,6 +75,7 @@ export class GfBenchmarkComponent implements OnChanges, OnDestroy { |
|
|
|
|
|
|
|
public constructor( |
|
|
|
private dialog: MatDialog, |
|
|
|
private notificationService: NotificationService, |
|
|
|
private route: ActivatedRoute, |
|
|
|
private router: Router |
|
|
|
) { |
|
|
@ -89,11 +107,22 @@ export class GfBenchmarkComponent implements OnChanges, OnDestroy { |
|
|
|
'trend200d', |
|
|
|
'date', |
|
|
|
'change', |
|
|
|
'marketCondition' |
|
|
|
'marketCondition', |
|
|
|
'actions' |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public onDeleteItem({ dataSource, symbol }: AssetProfileIdentifier) { |
|
|
|
this.notificationService.confirm({ |
|
|
|
confirmFn: () => { |
|
|
|
this.itemDeleted.emit({ dataSource, symbol }); |
|
|
|
}, |
|
|
|
confirmType: ConfirmationDialogType.Warn, |
|
|
|
title: $localize`Do you really want to delete this item?` |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public onOpenBenchmarkDialog({ dataSource, symbol }: AssetProfileIdentifier) { |
|
|
|
this.router.navigate([], { |
|
|
|
queryParams: { dataSource, symbol, benchmarkDetailDialog: true } |
|
|
|