X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-frontend%2Fsrc%2Fapp%2Fpolicy%2Fno-type-policy-editor%2Fno-type-policy-editor.component.ts;h=ece01751b3a29a50011b891a5d4bb9412c395753;hb=HEAD;hp=877e0e37e7115fe4a1fd756895bdfb7efa0fdcc8;hpb=e0f0ae59f6f1958617c927bdfbec63e037efed97;p=portal%2Fnonrtric-controlpanel.git diff --git a/webapp-frontend/src/app/policy/no-type-policy-editor/no-type-policy-editor.component.ts b/webapp-frontend/src/app/policy/no-type-policy-editor/no-type-policy-editor.component.ts index 877e0e3..ece0175 100644 --- a/webapp-frontend/src/app/policy/no-type-policy-editor/no-type-policy-editor.component.ts +++ b/webapp-frontend/src/app/policy/no-type-policy-editor/no-type-policy-editor.component.ts @@ -47,14 +47,19 @@ export class NoTypePolicyEditorComponent implements OnInit { constructor() {} ngOnInit(): void { + let initialJson: string; + if (this.policyJson) { + initialJson = formatJsonString(this.policyJson); + } else { + initialJson = "{}"; + } this.instanceForm.addControl( "policyJsonTextArea", - new FormControl(this.policyJson, [ + new FormControl(initialJson, [ Validators.required, this.jsonValidator(), ]) ); - if (!this.policyJson) this.policyJson = "{}"; } get policyJsonTextArea(): AbstractControl {