X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-frontend%2Fsrc%2Fapp%2Fpolicy%2Fpolicy-type%2Fpolicy-type.component.ts;h=cfc0eb5784428b90c713bd8266a753cc8ca1a742;hb=55d8bd15efc74705d2a89e022485a47f503d14ab;hp=7d82cb47f46eaaa9566a8b5ccc673cb6e921bab2;hpb=f4b78deddb07a1832b7445911588c830d01222b8;p=portal%2Fnonrtric-controlpanel.git diff --git a/webapp-frontend/src/app/policy/policy-type/policy-type.component.ts b/webapp-frontend/src/app/policy/policy-type/policy-type.component.ts index 7d82cb4..cfc0eb5 100644 --- a/webapp-frontend/src/app/policy/policy-type/policy-type.component.ts +++ b/webapp-frontend/src/app/policy/policy-type/policy-type.component.ts @@ -46,7 +46,12 @@ export class PolicyTypeComponent implements OnInit { constructor(private policyService: PolicyService) {} ngOnInit(): void { - if (this.policyTypeId !== "") { + this.loadTypeInfo(); + this.isVisible.next(false); + } + + public loadTypeInfo() { + if (this.policyTypeId && this.policyTypeId !== "") { this.policyService .getPolicyType(this.policyTypeId) .subscribe((policyType: PolicyType) => { @@ -57,15 +62,14 @@ export class PolicyTypeComponent implements OnInit { }); } else { const noType = { - policy_schema: JSON.parse('{"schemaObject": "{}"}'), + policy_schema: JSON.parse('{}'), } as PolicyType; const noTypeSchema = this.getSchemaObject(noType); this.policyTypeInfo = new PolicyTypeInfo(noTypeSchema); this.policyType = "< No Type >"; this.policyDescription = "Type with no schema"; } - this.isVisible.next(false); - } +} private getSchemaObject(policyType: PolicyType) { const policyTypeSchema = {} as PolicyTypeSchema; @@ -75,10 +79,6 @@ export class PolicyTypeComponent implements OnInit { return policyTypeSchema; } - public setIsVisible(status: boolean) { - this.isVisible.next(status); - } - public toggleVisible() { this.isVisible.next(!this.isVisible.value); }