|
|
@ -1,3 +1,4 @@ |
|
|
|
|
|
import { UserService } from '@ghostfolio/client/services/user/user.service'; |
|
|
import { |
|
|
import { |
|
|
HEADER_KEY_SKIP_INTERCEPTOR, |
|
|
HEADER_KEY_SKIP_INTERCEPTOR, |
|
|
HEADER_KEY_TOKEN |
|
|
HEADER_KEY_TOKEN |
|
|
@ -13,6 +14,7 @@ import { |
|
|
MarketDataOfMarketsResponse, |
|
|
MarketDataOfMarketsResponse, |
|
|
QuotesResponse |
|
|
QuotesResponse |
|
|
} from '@ghostfolio/common/interfaces'; |
|
|
} from '@ghostfolio/common/interfaces'; |
|
|
|
|
|
import { hasPermission, permissions } from '@ghostfolio/common/permissions'; |
|
|
import { GfFearAndGreedIndexComponent } from '@ghostfolio/ui/fear-and-greed-index'; |
|
|
import { GfFearAndGreedIndexComponent } from '@ghostfolio/ui/fear-and-greed-index'; |
|
|
|
|
|
|
|
|
import { CommonModule } from '@angular/common'; |
|
|
import { CommonModule } from '@angular/common'; |
|
|
@ -24,6 +26,7 @@ import { |
|
|
} from '@angular/common/http'; |
|
|
} from '@angular/common/http'; |
|
|
import { |
|
|
import { |
|
|
ChangeDetectionStrategy, |
|
|
ChangeDetectionStrategy, |
|
|
|
|
|
ChangeDetectorRef, |
|
|
Component, |
|
|
Component, |
|
|
DestroyRef, |
|
|
DestroyRef, |
|
|
inject, |
|
|
inject, |
|
|
@ -57,6 +60,7 @@ export class GfApiPageComponent implements OnInit { |
|
|
FetchResult<DataProviderGhostfolioAssetProfileResponse> |
|
|
FetchResult<DataProviderGhostfolioAssetProfileResponse> |
|
|
>; |
|
|
>; |
|
|
protected dividends$: Observable<FetchResult<DividendsResponse['dividends']>>; |
|
|
protected dividends$: Observable<FetchResult<DividendsResponse['dividends']>>; |
|
|
|
|
|
protected hasPermissionToAccessAdminControl: boolean; |
|
|
protected historicalData$: Observable< |
|
|
protected historicalData$: Observable< |
|
|
FetchResult<HistoricalResponse['historicalData']> |
|
|
FetchResult<HistoricalResponse['historicalData']> |
|
|
>; |
|
|
>; |
|
|
@ -72,13 +76,26 @@ export class GfApiPageComponent implements OnInit { |
|
|
|
|
|
|
|
|
private apiKey: string; |
|
|
private apiKey: string; |
|
|
|
|
|
|
|
|
|
|
|
private readonly changeDetectorRef = inject(ChangeDetectorRef); |
|
|
private readonly destroyRef = inject(DestroyRef); |
|
|
private readonly destroyRef = inject(DestroyRef); |
|
|
private readonly http = inject(HttpClient); |
|
|
private readonly http = inject(HttpClient); |
|
|
|
|
|
private readonly userService = inject(UserService); |
|
|
|
|
|
|
|
|
public ngOnInit() { |
|
|
public ngOnInit() { |
|
|
this.apiKey = |
|
|
this.apiKey = |
|
|
prompt($localize`Please enter your Ghostfolio API key:`) ?? ''; |
|
|
prompt($localize`Please enter your Ghostfolio API key:`) ?? ''; |
|
|
|
|
|
|
|
|
|
|
|
this.userService.stateChanged |
|
|
|
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
|
|
|
.subscribe((state) => { |
|
|
|
|
|
this.hasPermissionToAccessAdminControl = hasPermission( |
|
|
|
|
|
state?.user?.permissions, |
|
|
|
|
|
permissions.accessAdminControl |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
this.changeDetectorRef.markForCheck(); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
this.aiServiceHealth$ = this.fetchAiServiceHealth(); |
|
|
this.aiServiceHealth$ = this.fetchAiServiceHealth(); |
|
|
this.assetProfile$ = this.fetchAssetProfile({ symbol: 'AAPL' }); |
|
|
this.assetProfile$ = this.fetchAssetProfile({ symbol: 'AAPL' }); |
|
|
this.dividends$ = this.fetchDividends({ symbol: 'KO' }); |
|
|
this.dividends$ = this.fetchDividends({ symbol: 'KO' }); |
|
|
|