|
|
@ -52,12 +52,14 @@ export class AssetProfileDialog implements OnDestroy, OnInit { |
|
|
|
assetClass: new FormControl<AssetClass>(undefined), |
|
|
|
assetSubClass: new FormControl<AssetSubClass>(undefined), |
|
|
|
comment: '', |
|
|
|
countries: '', |
|
|
|
currency: '', |
|
|
|
historicalData: this.formBuilder.group({ |
|
|
|
csvString: '' |
|
|
|
}), |
|
|
|
name: ['', Validators.required], |
|
|
|
scraperConfiguration: '', |
|
|
|
sectors: '', |
|
|
|
symbolMapping: '' |
|
|
|
}); |
|
|
|
public assetProfileSubClass: string; |
|
|
@ -119,20 +121,20 @@ export class AssetProfileDialog implements OnDestroy, OnInit { |
|
|
|
this.marketDataDetails = marketData; |
|
|
|
this.sectors = {}; |
|
|
|
|
|
|
|
if (assetProfile?.countries?.length > 0) { |
|
|
|
for (const country of assetProfile.countries) { |
|
|
|
this.countries[country.code] = { |
|
|
|
name: country.name, |
|
|
|
value: country.weight |
|
|
|
if (this.assetProfile?.countries?.length > 0) { |
|
|
|
for (const { code, name, weight } of this.assetProfile.countries) { |
|
|
|
this.countries[code] = { |
|
|
|
name, |
|
|
|
value: weight |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (assetProfile?.sectors?.length > 0) { |
|
|
|
for (const sector of assetProfile.sectors) { |
|
|
|
this.sectors[sector.name] = { |
|
|
|
name: sector.name, |
|
|
|
value: sector.weight |
|
|
|
if (this.assetProfile?.sectors?.length > 0) { |
|
|
|
for (const { name, weight } of this.assetProfile.sectors) { |
|
|
|
this.sectors[name] = { |
|
|
|
name, |
|
|
|
value: weight |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
@ -141,6 +143,11 @@ export class AssetProfileDialog implements OnDestroy, OnInit { |
|
|
|
assetClass: this.assetProfile.assetClass ?? null, |
|
|
|
assetSubClass: this.assetProfile.assetSubClass ?? null, |
|
|
|
comment: this.assetProfile?.comment ?? '', |
|
|
|
countries: JSON.stringify( |
|
|
|
this.assetProfile?.countries.map(({ code, weight }) => { |
|
|
|
return { code, weight }; |
|
|
|
}) ?? [] |
|
|
|
), |
|
|
|
currency: this.assetProfile?.currency, |
|
|
|
historicalData: { |
|
|
|
csvString: AssetProfileDialog.HISTORICAL_DATA_TEMPLATE |
|
|
@ -149,6 +156,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit { |
|
|
|
scraperConfiguration: JSON.stringify( |
|
|
|
this.assetProfile?.scraperConfiguration ?? {} |
|
|
|
), |
|
|
|
sectors: JSON.stringify(this.assetProfile?.sectors ?? []), |
|
|
|
symbolMapping: JSON.stringify(this.assetProfile?.symbolMapping ?? {}) |
|
|
|
}); |
|
|
|
|
|
|
@ -239,15 +247,25 @@ export class AssetProfileDialog implements OnDestroy, OnInit { |
|
|
|
} |
|
|
|
|
|
|
|
public onSubmit() { |
|
|
|
let countries = []; |
|
|
|
let scraperConfiguration = {}; |
|
|
|
let sectors = []; |
|
|
|
let symbolMapping = {}; |
|
|
|
|
|
|
|
try { |
|
|
|
countries = JSON.parse(this.assetProfileForm.controls['countries'].value); |
|
|
|
} catch {} |
|
|
|
|
|
|
|
try { |
|
|
|
scraperConfiguration = JSON.parse( |
|
|
|
this.assetProfileForm.controls['scraperConfiguration'].value |
|
|
|
); |
|
|
|
} catch {} |
|
|
|
|
|
|
|
try { |
|
|
|
sectors = JSON.parse(this.assetProfileForm.controls['sectors'].value); |
|
|
|
} catch {} |
|
|
|
|
|
|
|
try { |
|
|
|
symbolMapping = JSON.parse( |
|
|
|
this.assetProfileForm.controls['symbolMapping'].value |
|
|
@ -255,7 +273,9 @@ export class AssetProfileDialog implements OnDestroy, OnInit { |
|
|
|
} catch {} |
|
|
|
|
|
|
|
const assetProfileData: UpdateAssetProfileDto = { |
|
|
|
countries, |
|
|
|
scraperConfiguration, |
|
|
|
sectors, |
|
|
|
symbolMapping, |
|
|
|
assetClass: this.assetProfileForm.controls['assetClass'].value, |
|
|
|
assetSubClass: this.assetProfileForm.controls['assetSubClass'].value, |
|
|
|