|
@ -22,6 +22,7 @@ import { |
|
|
OnInit |
|
|
OnInit |
|
|
} from '@angular/core'; |
|
|
} from '@angular/core'; |
|
|
import { MatDialog } from '@angular/material/dialog'; |
|
|
import { MatDialog } from '@angular/material/dialog'; |
|
|
|
|
|
import { MatTableDataSource } from '@angular/material/table'; |
|
|
import { DeviceDetectorService } from 'ngx-device-detector'; |
|
|
import { DeviceDetectorService } from 'ngx-device-detector'; |
|
|
import { catchError, filter, of, Subject, takeUntil } from 'rxjs'; |
|
|
import { catchError, filter, of, Subject, takeUntil } from 'rxjs'; |
|
|
|
|
|
|
|
@ -36,11 +37,13 @@ import { GhostfolioPremiumApiDialogParams } from './ghostfolio-premium-api-dialo |
|
|
standalone: false |
|
|
standalone: false |
|
|
}) |
|
|
}) |
|
|
export class AdminSettingsComponent implements OnDestroy, OnInit { |
|
|
export class AdminSettingsComponent implements OnDestroy, OnInit { |
|
|
public dataProviders: DataProviderInfo[]; |
|
|
public dataSource = new MatTableDataSource<DataProviderInfo>(); |
|
|
public defaultDateFormat: string; |
|
|
public defaultDateFormat: string; |
|
|
public ghostfolioApiStatus: DataProviderGhostfolioStatusResponse; |
|
|
public ghostfolioApiStatus: DataProviderGhostfolioStatusResponse; |
|
|
public isGhostfolioApiKeyValid: boolean; |
|
|
public isGhostfolioApiKeyValid: boolean; |
|
|
public pricingUrl: string; |
|
|
public pricingUrl: string; |
|
|
|
|
|
public displayedColumns = ['name', 'actions']; |
|
|
|
|
|
public isLoading = false; |
|
|
|
|
|
|
|
|
private deviceType: string; |
|
|
private deviceType: string; |
|
|
private unsubscribeSubject = new Subject<void>(); |
|
|
private unsubscribeSubject = new Subject<void>(); |
|
@ -119,20 +122,28 @@ export class AdminSettingsComponent implements OnDestroy, OnInit { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public isGhostfolioProvider(provider: DataProviderInfo): boolean { |
|
|
|
|
|
return provider.name === 'Ghostfolio'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public ngOnDestroy() { |
|
|
public ngOnDestroy() { |
|
|
this.unsubscribeSubject.next(); |
|
|
this.unsubscribeSubject.next(); |
|
|
this.unsubscribeSubject.complete(); |
|
|
this.unsubscribeSubject.complete(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private initialize() { |
|
|
private initialize() { |
|
|
|
|
|
this.isLoading = true; |
|
|
|
|
|
|
|
|
this.adminService |
|
|
this.adminService |
|
|
.fetchAdminData() |
|
|
.fetchAdminData() |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.subscribe(({ dataProviders, settings }) => { |
|
|
.subscribe(({ dataProviders, settings }) => { |
|
|
this.dataProviders = dataProviders.filter(({ dataSource }) => { |
|
|
const filteredProviders = dataProviders.filter(({ dataSource }) => { |
|
|
return dataSource !== 'MANUAL'; |
|
|
return dataSource !== 'MANUAL'; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.dataSource = new MatTableDataSource(filteredProviders); |
|
|
|
|
|
|
|
|
this.adminService |
|
|
this.adminService |
|
|
.fetchGhostfolioDataProviderStatus( |
|
|
.fetchGhostfolioDataProviderStatus( |
|
|
settings[PROPERTY_API_KEY_GHOSTFOLIO] as string |
|
|
settings[PROPERTY_API_KEY_GHOSTFOLIO] as string |
|
@ -140,7 +151,7 @@ export class AdminSettingsComponent implements OnDestroy, OnInit { |
|
|
.pipe( |
|
|
.pipe( |
|
|
catchError(() => { |
|
|
catchError(() => { |
|
|
this.isGhostfolioApiKeyValid = false; |
|
|
this.isGhostfolioApiKeyValid = false; |
|
|
|
|
|
this.isLoading = false; |
|
|
this.changeDetectorRef.markForCheck(); |
|
|
this.changeDetectorRef.markForCheck(); |
|
|
|
|
|
|
|
|
return of(null); |
|
|
return of(null); |
|
@ -153,7 +164,7 @@ export class AdminSettingsComponent implements OnDestroy, OnInit { |
|
|
.subscribe((status) => { |
|
|
.subscribe((status) => { |
|
|
this.ghostfolioApiStatus = status; |
|
|
this.ghostfolioApiStatus = status; |
|
|
this.isGhostfolioApiKeyValid = true; |
|
|
this.isGhostfolioApiKeyValid = true; |
|
|
|
|
|
this.isLoading = false; |
|
|
this.changeDetectorRef.markForCheck(); |
|
|
this.changeDetectorRef.markForCheck(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|