|
|
@ -22,6 +22,7 @@ import { |
|
|
|
OnInit |
|
|
|
} from '@angular/core'; |
|
|
|
import { MatDialog } from '@angular/material/dialog'; |
|
|
|
import { MatTableDataSource } from '@angular/material/table'; |
|
|
|
import { DeviceDetectorService } from 'ngx-device-detector'; |
|
|
|
import { catchError, filter, of, Subject, takeUntil } from 'rxjs'; |
|
|
|
|
|
|
@ -36,10 +37,12 @@ import { GhostfolioPremiumApiDialogParams } from './ghostfolio-premium-api-dialo |
|
|
|
standalone: false |
|
|
|
}) |
|
|
|
export class AdminSettingsComponent implements OnDestroy, OnInit { |
|
|
|
public dataProviders: DataProviderInfo[]; |
|
|
|
public dataSource = new MatTableDataSource<DataProviderInfo>(); |
|
|
|
public defaultDateFormat: string; |
|
|
|
public displayedColumns = ['name', 'actions']; |
|
|
|
public ghostfolioApiStatus: DataProviderGhostfolioStatusResponse; |
|
|
|
public isGhostfolioApiKeyValid: boolean; |
|
|
|
public isLoading = false; |
|
|
|
public pricingUrl: string; |
|
|
|
|
|
|
|
private deviceType: string; |
|
|
@ -83,6 +86,10 @@ export class AdminSettingsComponent implements OnDestroy, OnInit { |
|
|
|
this.initialize(); |
|
|
|
} |
|
|
|
|
|
|
|
public isGhostfolioDataProvider(provider: DataProviderInfo): boolean { |
|
|
|
return provider.dataSource === 'GHOSTFOLIO'; |
|
|
|
} |
|
|
|
|
|
|
|
public onRemoveGhostfolioApiKey() { |
|
|
|
this.notificationService.confirm({ |
|
|
|
confirmFn: () => { |
|
|
@ -125,14 +132,20 @@ export class AdminSettingsComponent implements OnDestroy, OnInit { |
|
|
|
} |
|
|
|
|
|
|
|
private initialize() { |
|
|
|
this.isLoading = true; |
|
|
|
|
|
|
|
this.dataSource = new MatTableDataSource(); |
|
|
|
|
|
|
|
this.adminService |
|
|
|
.fetchAdminData() |
|
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
|
.subscribe(({ dataProviders, settings }) => { |
|
|
|
this.dataProviders = dataProviders.filter(({ dataSource }) => { |
|
|
|
const filteredProviders = dataProviders.filter(({ dataSource }) => { |
|
|
|
return dataSource !== 'MANUAL'; |
|
|
|
}); |
|
|
|
|
|
|
|
this.dataSource = new MatTableDataSource(filteredProviders); |
|
|
|
|
|
|
|
this.adminService |
|
|
|
.fetchGhostfolioDataProviderStatus( |
|
|
|
settings[PROPERTY_API_KEY_GHOSTFOLIO] as string |
|
|
@ -157,6 +170,8 @@ export class AdminSettingsComponent implements OnDestroy, OnInit { |
|
|
|
this.changeDetectorRef.markForCheck(); |
|
|
|
}); |
|
|
|
|
|
|
|
this.isLoading = false; |
|
|
|
|
|
|
|
this.changeDetectorRef.markForCheck(); |
|
|
|
}); |
|
|
|
} |
|
|
|