Renamed things to fit with namechange of RicSynchronizationTask
[nonrtric.git] / dashboard / webapp-frontend / src / app / policy-control / policy-type.datasource.ts
index 1b2b93e..97d792e 100644 (file)
@@ -58,6 +58,15 @@ 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];
+                    try {
+                        policyType.schemaObject = JSON.parse(policyType.schema);
+                    } catch (jsonError) {
+                        console.error('Could not parse schema: ' + policyType.schema);
+                        policyType.schemaObject = { description: 'Incorrect schema: ' + jsonError };
+                    }
+                }
                 this.policyTypeSubject.next(types);
             });
     }