Policy types schemas should only be parsed once
[nonrtric.git] / dashboard / webapp-frontend / src / app / policy-control / policy-type.datasource.ts
index 1b2b93e..8d9dec7 100644 (file)
@@ -58,6 +58,10 @@ export class PolicyTypeDataSource extends DataSource<PolicyType> {
             )
             .subscribe((types: PolicyType[]) => {
                 this.rowCount = types.length;
+                for (let i = 0; i < types.length; i++) {
+                    const policyType = types[i];
+                    policyType.schemaObject = JSON.parse(policyType.schema);
+                }
                 this.policyTypeSubject.next(types);
             });
     }