|
|
@ -304,9 +304,8 @@ export class GfAssetProfileDialogComponent implements OnInit { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
this.assetProfileForm |
|
|
this.assetProfileForm.controls.assetClass.valueChanges |
|
|
.get('assetClass') |
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
?.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
|
|
|
.subscribe((assetClass) => { |
|
|
.subscribe((assetClass) => { |
|
|
if (!assetClass) { |
|
|
if (!assetClass) { |
|
|
return; |
|
|
return; |
|
|
@ -323,7 +322,7 @@ export class GfAssetProfileDialogComponent implements OnInit { |
|
|
}) |
|
|
}) |
|
|
.sort((a, b) => a.label.localeCompare(b.label)); |
|
|
.sort((a, b) => a.label.localeCompare(b.label)); |
|
|
|
|
|
|
|
|
this.assetProfileForm.get('assetSubClass')?.setValue(null); |
|
|
this.assetProfileForm.controls.assetSubClass.setValue(null); |
|
|
|
|
|
|
|
|
this.changeDetectorRef.markForCheck(); |
|
|
this.changeDetectorRef.markForCheck(); |
|
|
}); |
|
|
}); |
|
|
@ -512,35 +511,30 @@ export class GfAssetProfileDialogComponent implements OnInit { |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
countries = JSON.parse( |
|
|
countries = JSON.parse( |
|
|
this.assetProfileForm.get('countries')?.value ?? '[]' |
|
|
this.assetProfileForm.controls.countries.value ?? '[]' |
|
|
) as Prisma.InputJsonArray; |
|
|
) as Prisma.InputJsonArray; |
|
|
} catch {} |
|
|
} catch {} |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
scraperConfiguration = { |
|
|
scraperConfiguration = { |
|
|
defaultMarketPrice: |
|
|
defaultMarketPrice: |
|
|
this.assetProfileForm.controls['scraperConfiguration'].controls[ |
|
|
this.assetProfileForm.controls.scraperConfiguration.controls |
|
|
'defaultMarketPrice' |
|
|
.defaultMarketPrice?.value ?? undefined, |
|
|
]?.value ?? undefined, |
|
|
|
|
|
headers: JSON.parse( |
|
|
headers: JSON.parse( |
|
|
this.assetProfileForm.controls['scraperConfiguration'].controls[ |
|
|
this.assetProfileForm.controls.scraperConfiguration.controls.headers |
|
|
'headers' |
|
|
.value ?? '{}' |
|
|
].value ?? '{}' |
|
|
|
|
|
) as Record<string, string>, |
|
|
) as Record<string, string>, |
|
|
locale: |
|
|
locale: |
|
|
this.assetProfileForm.controls['scraperConfiguration'].controls[ |
|
|
this.assetProfileForm.controls.scraperConfiguration.controls.locale |
|
|
'locale' |
|
|
?.value ?? undefined, |
|
|
]?.value ?? undefined, |
|
|
|
|
|
mode: |
|
|
mode: |
|
|
this.assetProfileForm.controls['scraperConfiguration'].controls[ |
|
|
this.assetProfileForm.controls.scraperConfiguration.controls.mode |
|
|
'mode' |
|
|
?.value ?? undefined, |
|
|
]?.value ?? undefined, |
|
|
|
|
|
selector: |
|
|
selector: |
|
|
this.assetProfileForm.controls['scraperConfiguration'].controls[ |
|
|
this.assetProfileForm.controls.scraperConfiguration.controls.selector |
|
|
'selector' |
|
|
.value ?? '', |
|
|
].value ?? '', |
|
|
|
|
|
url: |
|
|
url: |
|
|
this.assetProfileForm.controls['scraperConfiguration'].controls['url'] |
|
|
this.assetProfileForm.controls.scraperConfiguration.controls.url |
|
|
.value ?? '' |
|
|
.value ?? '' |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
@ -563,30 +557,31 @@ export class GfAssetProfileDialogComponent implements OnInit { |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
sectors = JSON.parse( |
|
|
sectors = JSON.parse( |
|
|
this.assetProfileForm.get('sectors')?.value ?? '[]' |
|
|
this.assetProfileForm.controls.sectors.value ?? '[]' |
|
|
) as Prisma.InputJsonArray; |
|
|
) as Prisma.InputJsonArray; |
|
|
} catch {} |
|
|
} catch {} |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
symbolMapping = JSON.parse( |
|
|
symbolMapping = JSON.parse( |
|
|
this.assetProfileForm.get('symbolMapping')?.value ?? '{}' |
|
|
this.assetProfileForm.controls.symbolMapping.value ?? '{}' |
|
|
) as Record<string, string>; |
|
|
) as Record<string, string>; |
|
|
} catch {} |
|
|
} catch {} |
|
|
|
|
|
|
|
|
const isActive = this.assetProfileForm.get('isActive')?.value; |
|
|
|
|
|
const assetProfile: UpdateAssetProfileDto = { |
|
|
const assetProfile: UpdateAssetProfileDto = { |
|
|
countries, |
|
|
countries, |
|
|
scraperConfiguration, |
|
|
scraperConfiguration, |
|
|
sectors, |
|
|
sectors, |
|
|
symbolMapping, |
|
|
symbolMapping, |
|
|
assetClass: this.assetProfileForm.get('assetClass')?.value ?? undefined, |
|
|
assetClass: this.assetProfileForm.controls.assetClass.value ?? undefined, |
|
|
assetSubClass: |
|
|
assetSubClass: |
|
|
this.assetProfileForm.get('assetSubClass')?.value ?? undefined, |
|
|
this.assetProfileForm.controls.assetSubClass.value ?? undefined, |
|
|
comment: this.assetProfileForm.get('comment')?.value ?? undefined, |
|
|
comment: this.assetProfileForm.controls.comment.value ?? undefined, |
|
|
currency: this.assetProfileForm.get('currency')?.value ?? undefined, |
|
|
currency: this.assetProfileForm.controls.currency.value ?? undefined, |
|
|
isActive: isBoolean(isActive) ? isActive : undefined, |
|
|
isActive: isBoolean(this.assetProfileForm.controls.isActive.value) |
|
|
name: this.assetProfileForm.get('name')?.value ?? undefined, |
|
|
? this.assetProfileForm.controls.isActive.value |
|
|
url: this.assetProfileForm.get('url')?.value ?? undefined |
|
|
: undefined, |
|
|
|
|
|
name: this.assetProfileForm.controls.name.value ?? undefined, |
|
|
|
|
|
url: this.assetProfileForm.controls.url.value ?? undefined |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
@ -645,10 +640,12 @@ export class GfAssetProfileDialogComponent implements OnInit { |
|
|
|
|
|
|
|
|
protected async onSubmitAssetProfileIdentifierForm() { |
|
|
protected async onSubmitAssetProfileIdentifierForm() { |
|
|
const assetProfileIdentifier: UpdateAssetProfileDto = { |
|
|
const assetProfileIdentifier: UpdateAssetProfileDto = { |
|
|
dataSource: this.assetProfileIdentifierForm.get('assetProfileIdentifier') |
|
|
dataSource: |
|
|
?.value.dataSource, |
|
|
this.assetProfileIdentifierForm.controls.assetProfileIdentifier.value |
|
|
symbol: this.assetProfileIdentifierForm.get('assetProfileIdentifier') |
|
|
?.dataSource ?? undefined, |
|
|
?.value.symbol |
|
|
symbol: |
|
|
|
|
|
this.assetProfileIdentifierForm.controls.assetProfileIdentifier.value |
|
|
|
|
|
?.symbol ?? undefined |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
@ -711,28 +708,22 @@ export class GfAssetProfileDialogComponent implements OnInit { |
|
|
dataSource: this.data.dataSource, |
|
|
dataSource: this.data.dataSource, |
|
|
scraperConfiguration: { |
|
|
scraperConfiguration: { |
|
|
defaultMarketPrice: |
|
|
defaultMarketPrice: |
|
|
this.assetProfileForm.controls['scraperConfiguration'].controls[ |
|
|
this.assetProfileForm.controls.scraperConfiguration.controls |
|
|
'defaultMarketPrice' |
|
|
.defaultMarketPrice?.value, |
|
|
]?.value, |
|
|
|
|
|
headers: JSON.parse( |
|
|
headers: JSON.parse( |
|
|
this.assetProfileForm.controls['scraperConfiguration'].controls[ |
|
|
this.assetProfileForm.controls.scraperConfiguration.controls.headers |
|
|
'headers' |
|
|
.value ?? '{}' |
|
|
]?.value ?? '{}' |
|
|
|
|
|
) as Record<string, string>, |
|
|
) as Record<string, string>, |
|
|
locale: |
|
|
locale: |
|
|
this.assetProfileForm.controls['scraperConfiguration'].controls[ |
|
|
this.assetProfileForm.controls.scraperConfiguration.controls.locale |
|
|
'locale' |
|
|
?.value || undefined, |
|
|
]?.value || undefined, |
|
|
mode: this.assetProfileForm.controls.scraperConfiguration.controls |
|
|
mode: this.assetProfileForm.controls['scraperConfiguration'].controls[ |
|
|
.mode?.value, |
|
|
'mode' |
|
|
|
|
|
]?.value, |
|
|
|
|
|
selector: |
|
|
selector: |
|
|
this.assetProfileForm.controls['scraperConfiguration'].controls[ |
|
|
this.assetProfileForm.controls.scraperConfiguration.controls |
|
|
'selector' |
|
|
.selector.value, |
|
|
].value, |
|
|
url: this.assetProfileForm.controls.scraperConfiguration.controls.url |
|
|
url: this.assetProfileForm.controls['scraperConfiguration'].controls[ |
|
|
.value |
|
|
'url' |
|
|
|
|
|
].value |
|
|
|
|
|
}, |
|
|
}, |
|
|
symbol: this.data.symbol |
|
|
symbol: this.data.symbol |
|
|
}) |
|
|
}) |
|
|
@ -753,22 +744,22 @@ export class GfAssetProfileDialogComponent implements OnInit { |
|
|
' ' + |
|
|
' ' + |
|
|
price + |
|
|
price + |
|
|
' ' + |
|
|
' ' + |
|
|
this.assetProfileForm.get('currency')?.value |
|
|
this.assetProfileForm.controls.currency.value |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected onToggleIsActive({ checked }: MatCheckboxChange) { |
|
|
protected onToggleIsActive({ checked }: MatCheckboxChange) { |
|
|
if (checked) { |
|
|
if (checked) { |
|
|
this.assetProfileForm.get('isActive')?.setValue(true); |
|
|
this.assetProfileForm.controls.isActive.setValue(true); |
|
|
} else { |
|
|
} else { |
|
|
this.assetProfileForm.get('isActive')?.setValue(false); |
|
|
this.assetProfileForm.controls.isActive.setValue(false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (checked === this.assetProfile.isActive) { |
|
|
if (checked === this.assetProfile.isActive) { |
|
|
this.assetProfileForm.get('isActive')?.markAsPristine(); |
|
|
this.assetProfileForm.controls.isActive.markAsPristine(); |
|
|
} else { |
|
|
} else { |
|
|
this.assetProfileForm.get('isActive')?.markAsDirty(); |
|
|
this.assetProfileForm.controls.isActive.markAsDirty(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -791,9 +782,7 @@ export class GfAssetProfileDialogComponent implements OnInit { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private isNewSymbolValid( |
|
|
private isNewSymbolValid(control: AbstractControl): ValidationErrors | null { |
|
|
control: AbstractControl |
|
|
|
|
|
): ValidationErrors | undefined { |
|
|
|
|
|
const currentAssetProfileIdentifier: AssetProfileIdentifier | undefined = |
|
|
const currentAssetProfileIdentifier: AssetProfileIdentifier | undefined = |
|
|
control.get('assetProfileIdentifier')?.value; |
|
|
control.get('assetProfileIdentifier')?.value; |
|
|
|
|
|
|
|
|
@ -805,5 +794,7 @@ export class GfAssetProfileDialogComponent implements OnInit { |
|
|
equalsPreviousProfileIdentifier: true |
|
|
equalsPreviousProfileIdentifier: true |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|