|
|
@ -15,6 +15,7 @@ import { DataService } from '@ghostfolio/client/services/data.service'; |
|
|
|
import { DATE_FORMAT, parseDate } from '@ghostfolio/common/helper'; |
|
|
|
import { |
|
|
|
AdminMarketDataDetails, |
|
|
|
Currency, |
|
|
|
UniqueAsset |
|
|
|
} from '@ghostfolio/common/interfaces'; |
|
|
|
import { translate } from '@ghostfolio/ui/i18n'; |
|
|
@ -51,6 +52,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit { |
|
|
|
assetClass: new FormControl<AssetClass>(undefined), |
|
|
|
assetSubClass: new FormControl<AssetSubClass>(undefined), |
|
|
|
comment: '', |
|
|
|
currency: '', |
|
|
|
historicalData: this.formBuilder.group({ |
|
|
|
csvString: '' |
|
|
|
}), |
|
|
@ -63,6 +65,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit { |
|
|
|
public countries: { |
|
|
|
[code: string]: { name: string; value: number }; |
|
|
|
}; |
|
|
|
public currencies: Currency[] = []; |
|
|
|
public isBenchmark = false; |
|
|
|
public marketDataDetails: MarketData[] = []; |
|
|
|
public sectors: { |
|
|
@ -86,7 +89,13 @@ export class AssetProfileDialog implements OnDestroy, OnInit { |
|
|
|
) {} |
|
|
|
|
|
|
|
public ngOnInit(): void { |
|
|
|
this.benchmarks = this.dataService.fetchInfo().benchmarks; |
|
|
|
const { benchmarks, currencies } = this.dataService.fetchInfo(); |
|
|
|
|
|
|
|
this.benchmarks = benchmarks; |
|
|
|
this.currencies = currencies.map((currency) => ({ |
|
|
|
label: currency, |
|
|
|
value: currency |
|
|
|
})); |
|
|
|
|
|
|
|
this.initialize(); |
|
|
|
} |
|
|
@ -132,6 +141,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit { |
|
|
|
assetClass: this.assetProfile.assetClass ?? null, |
|
|
|
assetSubClass: this.assetProfile.assetSubClass ?? null, |
|
|
|
comment: this.assetProfile?.comment ?? '', |
|
|
|
currency: this.assetProfile?.currency, |
|
|
|
historicalData: { |
|
|
|
csvString: AssetProfileDialog.HISTORICAL_DATA_TEMPLATE |
|
|
|
}, |
|
|
@ -245,12 +255,15 @@ export class AssetProfileDialog implements OnDestroy, OnInit { |
|
|
|
} catch {} |
|
|
|
|
|
|
|
const assetProfileData: UpdateAssetProfileDto = { |
|
|
|
scraperConfiguration, |
|
|
|
symbolMapping, |
|
|
|
assetClass: this.assetProfileForm.controls['assetClass'].value, |
|
|
|
assetSubClass: this.assetProfileForm.controls['assetSubClass'].value, |
|
|
|
comment: this.assetProfileForm.controls['comment'].value ?? null, |
|
|
|
name: this.assetProfileForm.controls['name'].value, |
|
|
|
scraperConfiguration, |
|
|
|
symbolMapping |
|
|
|
currency: (<Currency>( |
|
|
|
(<unknown>this.assetProfileForm.controls['currency'].value) |
|
|
|
))?.value, |
|
|
|
name: this.assetProfileForm.controls['name'].value |
|
|
|
}; |
|
|
|
|
|
|
|
this.adminService |
|
|
|