Browse Source

task: Allow editing country and sector data for all assets #6283

pull/6284/head
omkarg01 5 days ago
parent
commit
384cc2a326
  1. 21
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts
  2. 2
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.html

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

@ -150,7 +150,7 @@ export class GfAssetProfileDialogComponent implements OnDestroy, OnInit {
assetClass: new FormControl<AssetClass>(undefined), assetClass: new FormControl<AssetClass>(undefined),
assetSubClass: new FormControl<AssetSubClass>(undefined), assetSubClass: new FormControl<AssetSubClass>(undefined),
comment: '', comment: '',
countries: '', countries: ['', this.jsonValidator()],
currency: '', currency: '',
historicalData: this.formBuilder.group({ historicalData: this.formBuilder.group({
csvString: '' csvString: ''
@ -159,14 +159,14 @@ export class GfAssetProfileDialogComponent implements OnDestroy, OnInit {
name: ['', Validators.required], name: ['', Validators.required],
scraperConfiguration: this.formBuilder.group({ scraperConfiguration: this.formBuilder.group({
defaultMarketPrice: null, defaultMarketPrice: null,
headers: JSON.stringify({}), headers: [JSON.stringify({}), this.jsonValidator()],
locale: '', locale: '',
mode: '', mode: '',
selector: '', selector: '',
url: '' url: ''
}), }),
sectors: '', sectors: ['', this.jsonValidator()],
symbolMapping: '', symbolMapping: ['', this.jsonValidator()],
url: '' url: ''
}); });
@ -722,4 +722,17 @@ export class GfAssetProfileDialogComponent implements OnDestroy, OnInit {
}; };
} }
} }
private jsonValidator() {
return (control: AbstractControl): ValidationErrors | null => {
try {
if (control.value) {
JSON.parse(control.value);
}
return null;
} catch {
return { invalidJson: true };
}
};
}
} }

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

@ -514,7 +514,6 @@
</mat-accordion> </mat-accordion>
</div> </div>
} }
@if (assetProfile?.dataSource === 'MANUAL') {
<div> <div>
<mat-form-field appearance="outline" class="w-100"> <mat-form-field appearance="outline" class="w-100">
<mat-label i18n>Sectors</mat-label> <mat-label i18n>Sectors</mat-label>
@ -537,7 +536,6 @@
></textarea> ></textarea>
</mat-form-field> </mat-form-field>
</div> </div>
}
<div> <div>
<mat-form-field appearance="outline" class="w-100 without-hint"> <mat-form-field appearance="outline" class="w-100 without-hint">
<mat-label i18n>Url</mat-label> <mat-label i18n>Url</mat-label>

Loading…
Cancel
Save