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. 46
      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),
assetSubClass: new FormControl<AssetSubClass>(undefined),
comment: '',
countries: '',
countries: ['', this.jsonValidator()],
currency: '',
historicalData: this.formBuilder.group({
csvString: ''
@ -159,14 +159,14 @@ export class GfAssetProfileDialogComponent implements OnDestroy, OnInit {
name: ['', Validators.required],
scraperConfiguration: this.formBuilder.group({
defaultMarketPrice: null,
headers: JSON.stringify({}),
headers: [JSON.stringify({}), this.jsonValidator()],
locale: '',
mode: '',
selector: '',
url: ''
}),
sectors: '',
symbolMapping: '',
sectors: ['', this.jsonValidator()],
symbolMapping: ['', this.jsonValidator()],
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 };
}
};
}
}

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

@ -514,30 +514,28 @@
</mat-accordion>
</div>
}
@if (assetProfile?.dataSource === 'MANUAL') {
<div>
<mat-form-field appearance="outline" class="w-100">
<mat-label i18n>Sectors</mat-label>
<textarea
cdkTextareaAutosize
formControlName="sectors"
matInput
type="text"
></textarea>
</mat-form-field>
</div>
<div>
<mat-form-field appearance="outline" class="w-100">
<mat-label i18n>Countries</mat-label>
<textarea
cdkTextareaAutosize
formControlName="countries"
matInput
type="text"
></textarea>
</mat-form-field>
</div>
}
<div>
<mat-form-field appearance="outline" class="w-100">
<mat-label i18n>Sectors</mat-label>
<textarea
cdkTextareaAutosize
formControlName="sectors"
matInput
type="text"
></textarea>
</mat-form-field>
</div>
<div>
<mat-form-field appearance="outline" class="w-100">
<mat-label i18n>Countries</mat-label>
<textarea
cdkTextareaAutosize
formControlName="countries"
matInput
type="text"
></textarea>
</mat-form-field>
</div>
<div>
<mat-form-field appearance="outline" class="w-100 without-hint">
<mat-label i18n>Url</mat-label>

Loading…
Cancel
Save