Browse Source
Feature/improve Ghostfolio data provider status check (#4735)
* Improve Ghostfolio data provider status check
pull/4732/head
Thomas Kaul
1 month ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
27 additions and
21 deletions
-
apps/client/src/app/components/admin-settings/admin-settings.component.ts
|
|
@ -146,29 +146,35 @@ export class AdminSettingsComponent implements OnDestroy, OnInit { |
|
|
|
|
|
|
|
this.dataSource = new MatTableDataSource(filteredProviders); |
|
|
|
|
|
|
|
this.adminService |
|
|
|
.fetchGhostfolioDataProviderStatus( |
|
|
|
settings[PROPERTY_API_KEY_GHOSTFOLIO] as string |
|
|
|
) |
|
|
|
.pipe( |
|
|
|
catchError(() => { |
|
|
|
this.isGhostfolioApiKeyValid = false; |
|
|
|
const ghostfolioApiKey = settings[ |
|
|
|
PROPERTY_API_KEY_GHOSTFOLIO |
|
|
|
] as string; |
|
|
|
|
|
|
|
if (ghostfolioApiKey) { |
|
|
|
this.adminService |
|
|
|
.fetchGhostfolioDataProviderStatus(ghostfolioApiKey) |
|
|
|
.pipe( |
|
|
|
catchError(() => { |
|
|
|
this.isGhostfolioApiKeyValid = false; |
|
|
|
|
|
|
|
this.changeDetectorRef.markForCheck(); |
|
|
|
|
|
|
|
return of(null); |
|
|
|
}), |
|
|
|
filter((status) => { |
|
|
|
return status !== null; |
|
|
|
}), |
|
|
|
takeUntil(this.unsubscribeSubject) |
|
|
|
) |
|
|
|
.subscribe((status) => { |
|
|
|
this.ghostfolioApiStatus = status; |
|
|
|
this.isGhostfolioApiKeyValid = true; |
|
|
|
|
|
|
|
this.changeDetectorRef.markForCheck(); |
|
|
|
|
|
|
|
return of(null); |
|
|
|
}), |
|
|
|
filter((status) => { |
|
|
|
return status !== null; |
|
|
|
}), |
|
|
|
takeUntil(this.unsubscribeSubject) |
|
|
|
) |
|
|
|
.subscribe((status) => { |
|
|
|
this.ghostfolioApiStatus = status; |
|
|
|
this.isGhostfolioApiKeyValid = true; |
|
|
|
|
|
|
|
this.changeDetectorRef.markForCheck(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.isGhostfolioApiKeyValid = false; |
|
|
|
} |
|
|
|
|
|
|
|
this.isLoading = false; |
|
|
|
|
|
|
|