Browse Source

Fix issues in the form

pull/4157/head
Amandee Ellawala 7 months ago
committed by Thomas Kaul
parent
commit
21c2865485
  1. 11
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts
  2. 5
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html

11
apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts

@ -66,7 +66,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
}), }),
name: ['', Validators.required], name: ['', Validators.required],
scraperConfiguration: this.formBuilder.group({ scraperConfiguration: this.formBuilder.group({
defaultMarketPrice: undefined, defaultMarketPrice: null,
headers: JSON.stringify({}), headers: JSON.stringify({}),
locale: '', locale: '',
mode: '', mode: '',
@ -91,7 +91,6 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
{ value: 'lazy', viewValue: $localize`Lazy` }, { value: 'lazy', viewValue: $localize`Lazy` },
{ value: 'instant', viewValue: $localize`Instant` } { value: 'instant', viewValue: $localize`Instant` }
]; ];
public selectedModeValue: string;
public scraperConfiguationIsExpanded = signal(false); public scraperConfiguationIsExpanded = signal(false);
public sectors: { public sectors: {
[name: string]: { name: string; value: number }; [name: string]: { name: string; value: number };
@ -127,7 +126,6 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
public initialize() { public initialize() {
this.historicalDataItems = undefined; this.historicalDataItems = undefined;
this.selectedModeValue = 'lazy';
this.userService.stateChanged this.userService.stateChanged
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
@ -198,14 +196,13 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
name: this.assetProfile.name ?? this.assetProfile.symbol, name: this.assetProfile.name ?? this.assetProfile.symbol,
scraperConfiguration: { scraperConfiguration: {
defaultMarketPrice: defaultMarketPrice:
this.assetProfile?.scraperConfiguration?.defaultMarketPrice, this.assetProfile?.scraperConfiguration?.defaultMarketPrice ??
null,
headers: JSON.stringify( headers: JSON.stringify(
this.assetProfile?.scraperConfiguration?.headers ?? {} this.assetProfile?.scraperConfiguration?.headers ?? {}
), ),
locale: this.assetProfile?.scraperConfiguration?.locale ?? '', locale: this.assetProfile?.scraperConfiguration?.locale ?? '',
mode: mode: this.assetProfile?.scraperConfiguration?.mode ?? 'lazy',
this.assetProfile?.scraperConfiguration?.mode ??
this.selectedModeValue,
selector: this.assetProfile?.scraperConfiguration?.selector ?? '', selector: this.assetProfile?.scraperConfiguration?.selector ?? '',
url: this.assetProfile?.scraperConfiguration?.url ?? '' url: this.assetProfile?.scraperConfiguration?.url ?? ''
}, },

5
apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html

@ -319,10 +319,7 @@
<div class="mt-3"> <div class="mt-3">
<mat-form-field appearance="outline" class="w-100 without-hint"> <mat-form-field appearance="outline" class="w-100 without-hint">
<mat-label i18n>Mode</mat-label> <mat-label i18n>Mode</mat-label>
<mat-select <mat-select formControlName="mode">
formControlName="mode"
[(ngModel)]="selectedModeValue"
>
@for (modeValue of modeValues; track modeValue) { @for (modeValue of modeValues; track modeValue) {
<mat-option [value]="modeValue.value">{{ <mat-option [value]="modeValue.value">{{
modeValue.viewValue modeValue.viewValue

Loading…
Cancel
Save