Updated displaying of policy types 00/1700/2
authorPatrikBuhr <patrik.buhr@est.tech>
Wed, 20 Nov 2019 14:00:31 +0000 (15:00 +0100)
committerPatrikBuhr <patrik.buhr@est.tech>
Thu, 21 Nov 2019 11:02:00 +0000 (12:02 +0100)
Getting the policy type name from the title of the schema if possible.
Example types from file

Change-Id: I812c2360586ddec59fdfb60ce396bd1b6a075ac9
Issue-ID: NONRTRIC-61
Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
12 files changed:
dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/A1Controller.java
dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/PolicyType.java
dashboard/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/config/A1ControllerMockConfiguration.java
dashboard/webapp-backend/src/test/resources/demo-policy-schema-1.json
dashboard/webapp-backend/src/test/resources/demo-policy-schema-2.json
dashboard/webapp-backend/src/test/resources/demo-policy-schema-3.json
dashboard/webapp-frontend/src/app/interfaces/policy.types.ts
dashboard/webapp-frontend/src/app/policy-control/policy-control.component.html
dashboard/webapp-frontend/src/app/policy-control/policy-control.component.ts
dashboard/webapp-frontend/src/app/policy-control/policy-instance-dialog.component.html
dashboard/webapp-frontend/src/app/policy-control/policy-instance-dialog.component.ts
dashboard/webapp-frontend/src/app/ui/policy-card/policy-card.component.scss

index 8cd61bd..08b485e 100644 (file)
@@ -138,7 +138,7 @@ public class A1Controller {
                        checkHttpError(controllerGetPolicyType.getOutput().getCode());
                        OutputDescNamePTCodeSchemaOutput policyTypeSchema = controllerGetPolicyType.getOutput();
                        PolicyType type = new PolicyType(policyTypeId, policyTypeSchema.getName(),
-                                       policyTypeSchema.getDescription(), policyTypeSchema.getPolicyType().toString());
+                               policyTypeSchema.getPolicyType().toString());
                        policyTypes.add(type);
                }
                return policyTypes;
index d24667a..efe4010 100644 (file)
@@ -23,23 +23,19 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 
 public class PolicyType {
 
-    @JsonProperty("policy_type_id")
+       @JsonProperty("policy_type_id")
        Integer policyTypeId;
 
        @JsonProperty("name")
        String name;
 
-       @JsonProperty("description")
-       String description;
+       @JsonProperty("schema")
+       String schema;
 
-       @JsonProperty("create_schema")
-       String createSchema;
-
-       public PolicyType(Integer policyId, String name, String description, String createSchema) {
+       public PolicyType(Integer policyId, String name, String schema) {
                this.policyTypeId = policyId;
                this.name = name;
-               this.description = description;
-               this.createSchema = createSchema;
+               this.schema = schema;
        }
 
        public Integer getPolicyTypeId() {
@@ -58,24 +54,16 @@ public class PolicyType {
                this.name = name;
        }
 
-       public String getDescription() {
-               return description;
-       }
-
-       public void setDescription(String description) {
-               this.description = description;
-       }
-
-       public String getCreateSchema() {
-               return createSchema;
+       public String getSchema() {
+               return schema;
        }
 
-       public void setCreateSchema(String createSchema) {
-               this.createSchema = createSchema;
+       public void setSchema(String schema) {
+               this.schema = schema;
        }
 
        @Override
        public String toString() {
-               return "[policy_type_id:" + policyTypeId +  ", name:" + name + ", description:" + description + ", create_schema:" + createSchema + "]";
+               return "[policy_type_id:" + policyTypeId + ", name:" + name + ", schema:" + schema + "]";
        }
 }
index 086868d..5706a91 100644 (file)
@@ -24,7 +24,13 @@ import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 import com.fasterxml.jackson.core.JsonProcessingException;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.lang.invoke.MethodHandles;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -33,6 +39,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
+import java.util.stream.Collectors;
+
 import org.oransc.ric.a1controller.client.api.A1ControllerApi;
 import org.oransc.ric.a1controller.client.invoker.ApiClient;
 import org.oransc.ric.a1controller.client.model.InputNRRidPTidPIidPISchema;
@@ -115,8 +123,7 @@ public class A1ControllerMockConfiguration {
                        PolicyType policyType = database.getPolicyType(input.getInput().getPolicyTypeId());
                        OutputDescNamePTCodeSchemaOutput type = new OutputDescNamePTCodeSchemaOutput();
                        type.setName(policyType.getName());
-                       type.setDescription(policyType.getDescription());
-                       type.setPolicyType(database.normalize(policyType.getCreateSchema()));
+                       type.setPolicyType(database.normalize(policyType.getSchema()));
                        type.setCode(String.valueOf(HttpStatus.OK.value()));
                        OutputDescNamePTCodeSchema outputSchema = new OutputDescNamePTCodeSchema();
                        outputSchema.setOutput(type);
@@ -168,7 +175,7 @@ public class A1ControllerMockConfiguration {
                        OutputCodeSchemaOutput outputCodeSchemaOutput = new OutputCodeSchemaOutput();
                        outputCodeSchemaOutput.setCode(String.valueOf(HttpStatus.CREATED.value()));
                        OutputCodeSchema outputCodeSchema = new OutputCodeSchema();
-            outputCodeSchema.setOutput(outputCodeSchemaOutput);
+                       outputCodeSchema.setOutput(outputCodeSchemaOutput);
                        return outputCodeSchema;
                }).when(mockApi).a1ControllerCreatePolicyInstance(any(InputNRRidPTidPIidPISchema.class));
 
@@ -182,10 +189,10 @@ public class A1ControllerMockConfiguration {
                        String instanceId = input.getInput().getPolicyInstanceId();
                        database.deleteInstance(polcyTypeId, instanceId);
                        OutputCodeSchemaOutput outputCodeSchemaOutput = new OutputCodeSchemaOutput();
-            outputCodeSchemaOutput.setCode(String.valueOf(HttpStatus.NO_CONTENT.value()));
-            OutputCodeSchema outputCodeSchema = new OutputCodeSchema();
-            outputCodeSchema.setOutput(outputCodeSchemaOutput);
-            return outputCodeSchema;
+                       outputCodeSchemaOutput.setCode(String.valueOf(HttpStatus.NO_CONTENT.value()));
+                       OutputCodeSchema outputCodeSchema = new OutputCodeSchema();
+                       outputCodeSchema.setOutput(outputCodeSchemaOutput);
+                       return outputCodeSchema;
                }).when(mockApi).a1ControllerDeletePolicyInstance(any(InputNRRidPTidPIidSchema.class));
 
                return mockApi;
@@ -193,137 +200,6 @@ public class A1ControllerMockConfiguration {
 
        class Database {
 
-               private String schema1 = "{\"$schema\": " //
-                               + "\"http://json-schema.org/draft-07/schema#\"," //
-                               + "\"title\": \"ANR\"," //
-                               + "\"description\": \"ANR Neighbour Cell Relation Policy\"," //
-                               + "\"type\": \"object\"," //
-                               + "\"properties\": " //
-                               + "{ \"servingCellNrcgi\": {" //
-                               + "\"type\": \"string\"," //
-                               + "\"description\" : \"Serving Cell Identifier (NR CGI)\"}," //
-                               + "\"neighborCellNrpci\": {" //
-                               + "\"type\": \"string\"," //
-                               + "\"description\": \"Neighbor Cell Identifier (NR PCI)\"}," //
-                               + "\"neighborCellNrcgi\": {" //
-                               + "\"type\": \"string\"," //
-                               + "\"description\": \"Neighbor Cell Identifier (NR CGI)\"}," //
-                               + "\"flagNoHo\": {" //
-                               + "\"type\": \"boolean\"," //
-                               + "\"description\": \"Flag for HANDOVER NOT ALLOWED\"}," //
-                               + "\"flagNoXn\": {" //
-                               + "\"type\": \"boolean\"," //
-                               + "\"description\": \"Flag for Xn CONNECTION NOT ALLOWED\"}," //
-                               + "\"flagNoRemove\": {" //
-                               + "\"type\": \"boolean\"," //
-                               + "\"description\": \"Flag for DELETION NOT ALLOWED\"}}, " //
-                               + "\"required\": [ \"servingCellNrcgi\",\"neighborCellNrpci\",\"neighborCellNrcgi\",\"flagNoHo\",\"flagNoXn\",\"flagNoRemove\" ]}";
-               private PolicyType policy1 = new PolicyType(1, "ANR", "ANR Neighbour Cell Relation Policy", schema1);
-
-               private String policyInstance1 = "{\"servingCellNrcgi\": \"Cell1\",\r\n" + //
-                               "\"neighborCellNrpci\": \"NCell1\",\r\n" + //
-                               "\"neighborCellNrcgi\": \"Ncell1\",\r\n" + //
-                               "\"flagNoHo\": true,\r\n" + //
-                               "\"flagNoXn\": true,\r\n" + //
-                               "\"flagNoRemove\": true}";
-
-               private String schema2 = "{\n" + "          \"type\": \"object\",\n" + //
-                               "          \"title\": \"Car\",\n" + //
-                               "          \"properties\": {\n" + //
-                               "            \"make\": {\n" + //
-                               "              \"type\": \"string\",\n" + //
-                               "              \"enum\": [\n" + //
-                               "                \"Toyota\",\n" + //
-                               "                \"BMW\",\n" + //
-                               "                \"Honda\",\n" + //
-                               "                \"Ford\",\n" + //
-                               "                \"Chevy\",\n" + //
-                               "                \"VW\"\n" + //
-                               "              ]\n" + //
-                               "            },\n" + //
-                               "            \"model\": {\n" + //
-                               "              \"type\": \"string\"\n" + //
-                               "            },\n" + //
-                               "            \"year\": {\n" + //
-                               "              \"type\": \"integer\",\n" + //
-                               "              \"enum\": [\n" + //
-                               "                1995,1996,1997,1998,1999,\n" + //
-                               "                2000,2001,2002,2003,2004,\n" + //
-                               "                2005,2006,2007,2008,2009,\n" + //
-                               "                2010,2011,2012,2013,2014\n" + //
-                               "              ],\n" + //
-                               "              \"default\": 2008\n" + //
-                               "            },\n" + //
-                               "            \"safety\": {\n" + //
-                               "              \"type\": \"integer\",\n" + //
-                               "              \"format\": \"rating\",\n" + //
-                               "              \"maximum\": 5,\n" + //
-                               "              \"exclusiveMaximum\": false,\n" + //
-                               "              \"readonly\": false\n" + //
-                               "            }\n" + //
-                               "          }\n" + //
-                               "        }\n";
-               private PolicyType policy2 = new PolicyType(2, "type2", "Type2 description", schema2);
-
-               private String schema3 = "{\n" + //
-                               "  \"$id\": \"https://example.com/person.schema.json\",\n" + //
-                               "  \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n" + //
-                               "  \"title\": \"Person\",\n" + //
-                               "  \"type\": \"object\",\n" + //
-                               "  \"properties\": {\n" + //
-                               "    \"firstName\": {\n" + //
-                               "      \"type\": \"string\",\n" + //
-                               "      \"description\": \"The person's first name.\"\n" + //
-                               "    },\n" + //
-                               "    \"lastName\": {\n" + //
-                               "      \"type\": \"string\",\n" + //
-                               "      \"description\": \"The person's last name.\"\n" + //
-                               "    },\n" + //
-                               "    \"age\": {\n" + //
-                               "      \"description\": \"Age in years which must be equal to or greater than zero.\",\n" + //
-                               "      \"type\": \"integer\",\n" + //
-                               "      \"minimum\": 0\n" + //
-                               "    }\n" + //
-                               "  }\n" + //
-                               "}";
-               private PolicyType policy3 = new PolicyType(3, "type3", "Type3 description", schema3);
-
-               private String schema4 = "{" + //
-                               "                 \"$id\": \"https://example.com/arrays.schema.json\"," + //
-                               "                 \"$schema\": \"http://json-schema.org/draft-07/schema#\"," + //
-                               "                 \"description\": \"A representation of a person, company, organization, or place\"," + //
-                               "                 \"type\": \"object\"," + //
-                               "                 \"properties\": {" + //
-                               "                   \"fruits\": {" + //
-                               "                     \"type\": \"array\"," + //
-                               "                     \"items\": {" + //
-                               "                       \"type\": \"string\"" + //
-                               "                     }" + //
-                               "                   }," + //
-                               "                   \"vegetables\": {" + //
-                               "                     \"type\": \"array\"," + //
-                               "                     \"items\": { \"$ref\": \"#/definitions/veggie\" }" + //
-                               "                   }" + //
-                               "                 }," + //
-                               "                 \"definitions\": {" + //
-                               "                   \"veggie\": {" + //
-                               "                     \"type\": \"object\"," + //
-                               "                     \"required\": [ \"veggieName\", \"veggieLike\" ]," + //
-                               "                     \"properties\": {" + //
-                               "                       \"veggieName\": {" + //
-                               "                         \"type\": \"string\"," + //
-                               "                         \"description\": \"The name of the vegetable.\"" + //
-                               "                       }," + //
-                               "                       \"veggieLike\": {" + //
-                               "                         \"type\": \"boolean\"," + //
-                               "                         \"description\": \"Do I like this vegetable?\"" + //
-                               "                       }" + //
-                               "                     }" + //
-                               "                   }" + //
-                               "                 }" + //
-                               "               }";
-               private PolicyType policy4 = new PolicyType(4, "type4", "Type4 description", schema4);
-
                public class PolicyException extends Exception {
 
                        private static final long serialVersionUID = 1L;
@@ -368,17 +244,39 @@ public class A1ControllerMockConfiguration {
                }
 
                Database() {
-                       types.put(1, new PolicyTypeHolder(policy1));
-                       types.put(2, new PolicyTypeHolder(policy2));
-                       types.put(3, new PolicyTypeHolder(policy3));
-                       types.put(4, new PolicyTypeHolder(policy4));
+                       String schema = getStringFromFile("anr-policy-schema.json");
+                       PolicyType policy = new PolicyType(1, "ANR", schema);
+                       types.put(1, new PolicyTypeHolder(policy));
+
+                       schema = getStringFromFile("demo-policy-schema-1.json");
+                       policy = new PolicyType(2, "type2", schema);
+                       types.put(2, new PolicyTypeHolder(policy));
+
+                       schema = getStringFromFile("demo-policy-schema-2.json");
+                       policy = new PolicyType(3, "type3", schema);
+                       types.put(3, new PolicyTypeHolder(policy));
+
+                       schema = getStringFromFile("demo-policy-schema-3.json");
+                       policy = new PolicyType(4, "type4", schema);
+                       types.put(4, new PolicyTypeHolder(policy));
                        try {
-                               putInstance(1, "ANR-1", policyInstance1);
+                               putInstance(1, "ANR-1", getStringFromFile("anr-policy-instance.json"));
                        } catch (JsonProcessingException | PolicyException e) {
                                // Nothing
                        }
                }
 
+               private String getStringFromFile(String path) {
+                       try {
+                               InputStream inputStream = MethodHandles.lookup().lookupClass().getClassLoader()
+                                               .getResourceAsStream(path);
+                               return new BufferedReader(new InputStreamReader(inputStream)).lines().collect(Collectors.joining("\n"));
+                       } catch (Exception e) {
+                               logger.error("Cannot read file :" + path, e);
+                               return "";
+                       }
+               }
+
                String normalize(String str) {
                        return str.replace('\n', ' ');
                }
index 09999ef..fa7410f 100644 (file)
@@ -1,53 +1,42 @@
 {
+  "$schema": "http://json-schema.org/draft-07/schema#",
+  "title": "Example_QoSTarget_1.0.0",
+  "description": "Example QoS Target policy type",
   "type": "object",
-  "title": "Car",
   "properties": {
-    "make": {
-      "type": "string",
-      "enum": [
-        "Toyota",
-        "BMW",
-        "Honda",
-        "Ford",
-        "Chevy",
-        "VW"
+    "scope": {
+      "type": "object",
+      "properties": {
+        "qosId": {
+          "type": "string"
+        },
+        "cellId": {
+          "type": "string"
+        }
+      },
+      "additionalProperties": false,
+      "required": [
+        "qosId"
       ]
     },
-    "model": {
-      "type": "string"
-    },
-    "year": {
-      "type": "integer",
-      "enum": [
-        1995,
-        1996,
-        1997,
-        1998,
-        1999,
-        2000,
-        2001,
-        2002,
-        2003,
-        2004,
-        2005,
-        2006,
-        2007,
-        2008,
-        2009,
-        2010,
-        2011,
-        2012,
-        2013,
-        2014
-      ],
-      "default": 2008
-    },
-    "safety": {
-      "type": "integer",
-      "format": "rating",
-      "maximum": 5,
-      "exclusiveMaximum": false,
-      "readonly": false
+    "statement": {
+      "type": "object",
+      "properties": {
+        "gfbr": {
+          "type": "number"
+        },
+        "mfbr": {
+          "type": "number"
+        },
+        "priorityLevel": {
+          "type": "number"
+        },
+        "pdb": {
+          "type": "number"
+        }
+      },
+      "minProperties": 1,
+      "additionalProperties": false
     }
   }
 }
\ No newline at end of file
index 69ec678..f3eb28f 100644 (file)
@@ -1,21 +1,49 @@
 {
-  "$id": "https://example.com/person.schema.json",
   "$schema": "http://json-schema.org/draft-07/schema#",
-  "title": "Person",
+  "title": "Example_QoETarget_1.0.0",
+  "description": "Example QoE Target policy type",
   "type": "object",
   "properties": {
-    "firstName": {
-      "type": "string",
-      "description": "The person's first name."
+    "scope": {
+      "type": "object",
+      "properties": {
+        "ueId": {
+          "type": "string"
+        },
+        "sliceId": {
+          "type": "string"
+        },
+        "qosId": {
+          "type": "string"
+        },
+        "cellId": {
+          "type": "string"
+        }
+      },
+      "additionalProperties": false,
+      "required": [
+        "ueId",
+        "sliceId"
+      ]
     },
-    "lastName": {
-      "type": "string",
-      "description": "The person's last name."
-    },
-    "age": {
-      "description": "Age in years which must be equal to or greater than zero.",
-      "type": "integer",
-      "minimum": 0
+    "statement": {
+      "type": "object",
+      "properties": {
+        "qoeScore": {
+          "type": "number"
+        },
+        "initialBuffering": {
+          "type": "number"
+        },
+        "reBuffFreq": {
+          "type": "number"
+        },
+        "stallRatio": {
+          "type": "number"
+        }
+      },
+      "minProperties": 1,
+      "additionalProperties": false
     }
   }
 }
\ No newline at end of file
index 3be9959..695514c 100644 (file)
@@ -1,39 +1,59 @@
 {
-  "$id": "https://example.com/arrays.schema.json",
   "$schema": "http://json-schema.org/draft-07/schema#",
-  "description": "A representation of a person, company, organization, or place",
+  "title": "Example_TrafficSteeringPreference_1.0.0",
+  "description": "Example QoE Target policy type",
   "type": "object",
   "properties": {
-    "fruits": {
-      "type": "array",
-      "items": {
-        "type": "string"
-      }
-    },
-    "vegetables": {
-      "type": "array",
-      "items": {
-        "$ref": "#/definitions/veggie"
-      }
-    }
-  },
-  "definitions": {
-    "veggie": {
+    "scope": {
       "type": "object",
+      "properties": {
+        "ueId": {
+          "type": "string"
+        },
+        "sliceId": {
+          "type": "string"
+        },
+        "qosId": {
+          "type": "string"
+        },
+        "cellId": {
+          "type": "string"
+        }
+      },
+      "additionalProperties": false,
       "required": [
-        "veggieName",
-        "veggieLike"
-      ],
+        "ueId"
+      ]
+    },
+    "statement": {
+      "type": "object",
       "properties": {
-        "veggieName": {
+        "cellIdList": {
+          "type": "array",
+          "minItems": 1,
+          "uniqueItems": true,
+          "items": {
+            "type": "string"
+          }
+        },
+        "preference": {
           "type": "string",
-          "description": "The name of the vegetable."
+          "enum": [
+            "SHALL",
+            "PREFER",
+            "AVOID",
+            "FORBID"
+          ]
         },
-        "veggieLike": {
-          "type": "boolean",
-          "description": "Do I like this vegetable?"
+        "primary": {
+          "type": "boolean"
         }
-      }
+      },
+      "required": [
+        "cellIdList",
+        "preference"
+      ],
+      "additionalProperties": false
     }
   }
 }
\ No newline at end of file
index bc94af9..ee0c447 100644 (file)
@@ -23,8 +23,7 @@
 export interface PolicyType {
   policy_type_id: number;
   name: string;
-  description: string;
-  create_schema: string;
+  schema: string;
 }
 
 export interface PolicyInstance {
index 1eef5c5..e71fd8a 100644 (file)
     class="policy-type-table mat-elevation-z8">
 
     <ng-container matColumnDef="name">
-        <mat-header-cell *matHeaderCellDef>Policy Type</mat-header-cell>
+        <mat-header-cell *matHeaderCellDef mat-sort-header>Policy Type</mat-header-cell>
         <mat-cell *matCellDef="let policyType">
             <mat-icon matTooltip="Properties">{{isInstancesShown(policyType)  ? 'expand_less' : 'expand_more'}}
             </mat-icon>
-            {{policyType.name}}
+            {{this.getName(policyType)}}
         </mat-cell>
     </ng-container>
 
     <ng-container matColumnDef="description">
         <mat-header-cell *matHeaderCellDef> Description </mat-header-cell>
-        <mat-cell *matCellDef="let policyType"> {{policyType.description}} </mat-cell>
+        <mat-cell *matCellDef="let policyType"> {{this.getDescription(policyType)}}
+        </mat-cell>
     </ng-container>
 
     <ng-container matColumnDef="action">
index 019a637..d57019f 100644 (file)
@@ -107,6 +107,16 @@ export class PolicyControlComponent implements OnInit {
         return info;
     }
 
+    getDescription(policyType: PolicyType): string {
+        return JSON.parse(policyType.schema).description;
+    }
+
+    getName(policyType: PolicyType): string {
+        const title = JSON.parse(policyType.schema).title;
+        if (title) { return title; }
+        return policyType.name;
+    }
+
     isInstancesShown(policyType: PolicyType): boolean {
         return this.getPolicyTypeInfo(policyType).isExpanded.getValue();
     }
index e9b6ff0..776d503 100644 (file)
@@ -26,7 +26,6 @@
         <svg class="logo__icon" viewBox="150.3 22.2 1000 50">
             <text class="logo__text" [ngClass]="{'logo__text-dark': darkMode}" font-size="30" font-weight="600"
                 letter-spacing=".1em" transform="translate(149 56)">
-                <tspan>Policy editor</tspan>
                 <tspan *ngIf="jsonSchemaObject.title"> {{this.jsonSchemaObject.title}}</tspan>
                 <tspan *ngIf="!jsonSchemaObject.title"> {{this.policyTypeName}}</tspan>
             </text>
@@ -34,7 +33,7 @@
     </div>
 </div>
 
-<!--<div class="text-muted" *ngIf="jsonSchemaObject.description">{{jsonSchemaObject.description}}</div>-->
+<div class="text-muted" *ngIf="jsonSchemaObject.description">{{jsonSchemaObject.description}}</div>
 
 <div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-sm="column" fxLayoutAlign.lt-sm="flex-start center">
     <mat-card class="card" [ngClass]="{'card-dark': darkMode}">
index b635418..f929342 100644 (file)
@@ -91,9 +91,9 @@ export class PolicyInstanceDialogComponent implements OnInit, AfterViewInit {
         private dialogRef: MatDialogRef<PolicyInstanceDialogComponent>,
         private ui: UiService) {
         this.formActive = false;
-        this.policyInstanceId = this.data.instanceId;
-        this.policyTypeName = this.data.name;
-        this.policyTypeId = this.data.policyTypeId;
+        this.policyInstanceId = data.instanceId;
+        this.policyTypeName = data.name;
+        this.policyTypeId = data.policyTypeId;
         this.parseJson(data.createSchema, data.instanceJson);
     }
 
@@ -130,8 +130,8 @@ export class PolicyInstanceDialogComponent implements OnInit, AfterViewInit {
         this.dialogRef.close();
     }
 
-    public onChanges(data: any) {
-        this.liveFormData = data;
+    public onChanges(formData: any) {
+        this.liveFormData = formData;
     }
 
     get prettyLiveFormData() {
@@ -150,8 +150,8 @@ export class PolicyInstanceDialogComponent implements OnInit, AfterViewInit {
         this.formIsValid = isValid;
     }
 
-    validationErrors(data: any): void {
-        this.formValidationErrors = data;
+    validationErrors(validationErrors: any): void {
+        this.formValidationErrors = validationErrors;
     }
 
     get prettyValidationErrors() {
@@ -177,7 +177,7 @@ export class PolicyInstanceDialogComponent implements OnInit, AfterViewInit {
     private parseJson(createSchema: string, instanceJson: string): void {
         try {
             this.jsonSchemaObject = JSON.parse(createSchema);
-            if (this.data.instanceJson != null) {
+            if (instanceJson != null) {
                 this.jsonObject = JSON.parse(instanceJson);
             }
         } catch (jsonError) {
@@ -195,7 +195,7 @@ export class PolicyInstanceDialogComponent implements OnInit, AfterViewInit {
 
 export function getPolicyDialogProperties(policyType: PolicyType, instance: PolicyInstance, darkMode: boolean): MatDialogConfig {
     const policyTypeId = policyType.policy_type_id;
-    const createSchema = policyType.create_schema;
+    const createSchema = policyType.schema;
     const instanceId = instance ? instance.instanceId : null;
     const instanceJson = instance ? instance.instance : null;
     const name = policyType.name;
index 5ecd585..30a3dfa 100644 (file)
@@ -35,7 +35,7 @@
 }
 
 .add__card-dark {
-  background: linear-gradient(rgb(78, 78, 129), rgb(45, 44, 61));
+  background: linear-gradient(to bottom, rgb(78, 78, 129), rgb(45, 44, 61));
   color: white;
 }