From 592589c3bcaba8f8d309bccf9068c0fce4434da8 Mon Sep 17 00:00:00 2001 From: PatrikBuhr Date: Wed, 20 Nov 2019 15:00:31 +0100 Subject: [PATCH] Updated displaying of policy types 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 --- .../portal/dashboard/controller/A1Controller.java | 2 +- .../ric/portal/dashboard/model/PolicyType.java | 32 ++-- .../config/A1ControllerMockConfiguration.java | 184 +++++---------------- .../src/test/resources/demo-policy-schema-1.json | 79 ++++----- .../src/test/resources/demo-policy-schema-2.json | 54 ++++-- .../src/test/resources/demo-policy-schema-3.json | 72 +++++--- .../src/app/interfaces/policy.types.ts | 3 +- .../policy-control/policy-control.component.html | 7 +- .../app/policy-control/policy-control.component.ts | 10 ++ .../policy-instance-dialog.component.html | 3 +- .../policy-instance-dialog.component.ts | 18 +- .../app/ui/policy-card/policy-card.component.scss | 2 +- 12 files changed, 199 insertions(+), 267 deletions(-) diff --git a/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/A1Controller.java b/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/A1Controller.java index 8cd61bdd..08b485e8 100644 --- a/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/A1Controller.java +++ b/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/A1Controller.java @@ -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; diff --git a/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/PolicyType.java b/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/PolicyType.java index d24667aa..efe40107 100644 --- a/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/PolicyType.java +++ b/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/PolicyType.java @@ -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 + "]"; } } diff --git a/dashboard/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/config/A1ControllerMockConfiguration.java b/dashboard/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/config/A1ControllerMockConfiguration.java index 086868de..5706a913 100644 --- a/dashboard/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/config/A1ControllerMockConfiguration.java +++ b/dashboard/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/config/A1ControllerMockConfiguration.java @@ -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', ' '); } diff --git a/dashboard/webapp-backend/src/test/resources/demo-policy-schema-1.json b/dashboard/webapp-backend/src/test/resources/demo-policy-schema-1.json index 09999efc..fa7410fb 100644 --- a/dashboard/webapp-backend/src/test/resources/demo-policy-schema-1.json +++ b/dashboard/webapp-backend/src/test/resources/demo-policy-schema-1.json @@ -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 diff --git a/dashboard/webapp-backend/src/test/resources/demo-policy-schema-2.json b/dashboard/webapp-backend/src/test/resources/demo-policy-schema-2.json index 69ec6788..f3eb28fb 100644 --- a/dashboard/webapp-backend/src/test/resources/demo-policy-schema-2.json +++ b/dashboard/webapp-backend/src/test/resources/demo-policy-schema-2.json @@ -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 diff --git a/dashboard/webapp-backend/src/test/resources/demo-policy-schema-3.json b/dashboard/webapp-backend/src/test/resources/demo-policy-schema-3.json index 3be99591..695514cd 100644 --- a/dashboard/webapp-backend/src/test/resources/demo-policy-schema-3.json +++ b/dashboard/webapp-backend/src/test/resources/demo-policy-schema-3.json @@ -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 diff --git a/dashboard/webapp-frontend/src/app/interfaces/policy.types.ts b/dashboard/webapp-frontend/src/app/interfaces/policy.types.ts index bc94af9d..ee0c4474 100644 --- a/dashboard/webapp-frontend/src/app/interfaces/policy.types.ts +++ b/dashboard/webapp-frontend/src/app/interfaces/policy.types.ts @@ -23,8 +23,7 @@ export interface PolicyType { policy_type_id: number; name: string; - description: string; - create_schema: string; + schema: string; } export interface PolicyInstance { diff --git a/dashboard/webapp-frontend/src/app/policy-control/policy-control.component.html b/dashboard/webapp-frontend/src/app/policy-control/policy-control.component.html index 1eef5c5a..e71fd8ab 100644 --- a/dashboard/webapp-frontend/src/app/policy-control/policy-control.component.html +++ b/dashboard/webapp-frontend/src/app/policy-control/policy-control.component.html @@ -24,17 +24,18 @@ class="policy-type-table mat-elevation-z8"> - Policy Type + Policy Type {{isInstancesShown(policyType) ? 'expand_less' : 'expand_more'}} - {{policyType.name}} + {{this.getName(policyType)}} Description - {{policyType.description}} + {{this.getDescription(policyType)}} + diff --git a/dashboard/webapp-frontend/src/app/policy-control/policy-control.component.ts b/dashboard/webapp-frontend/src/app/policy-control/policy-control.component.ts index 019a637b..d57019f2 100644 --- a/dashboard/webapp-frontend/src/app/policy-control/policy-control.component.ts +++ b/dashboard/webapp-frontend/src/app/policy-control/policy-control.component.ts @@ -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(); } diff --git a/dashboard/webapp-frontend/src/app/policy-control/policy-instance-dialog.component.html b/dashboard/webapp-frontend/src/app/policy-control/policy-instance-dialog.component.html index e9b6ff07..776d503e 100644 --- a/dashboard/webapp-frontend/src/app/policy-control/policy-instance-dialog.component.html +++ b/dashboard/webapp-frontend/src/app/policy-control/policy-instance-dialog.component.html @@ -26,7 +26,6 @@ - Policy editor {{this.jsonSchemaObject.title}} {{this.policyTypeName}} @@ -34,7 +33,7 @@ - +
{{jsonSchemaObject.description}}
diff --git a/dashboard/webapp-frontend/src/app/policy-control/policy-instance-dialog.component.ts b/dashboard/webapp-frontend/src/app/policy-control/policy-instance-dialog.component.ts index b635418a..f9293420 100644 --- a/dashboard/webapp-frontend/src/app/policy-control/policy-instance-dialog.component.ts +++ b/dashboard/webapp-frontend/src/app/policy-control/policy-instance-dialog.component.ts @@ -91,9 +91,9 @@ export class PolicyInstanceDialogComponent implements OnInit, AfterViewInit { private dialogRef: MatDialogRef, 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; diff --git a/dashboard/webapp-frontend/src/app/ui/policy-card/policy-card.component.scss b/dashboard/webapp-frontend/src/app/ui/policy-card/policy-card.component.scss index 5ecd5858..30a3dfa7 100644 --- a/dashboard/webapp-frontend/src/app/ui/policy-card/policy-card.component.scss +++ b/dashboard/webapp-frontend/src/app/ui/policy-card/policy-card.component.scss @@ -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; } -- 2.16.6