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 <patrik.buhr@est.tech>
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 8cd61bd..08b485e 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 @@
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 d24667a..efe4010 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 @@
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 @@
this.name = name;
}
- public String getDescription() {
- return description;
+ public String getSchema() {
+ return schema;
}
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getCreateSchema() {
- return createSchema;
- }
-
- 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 086868d..5706a91 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.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.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 @@
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 @@
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 @@
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 @@
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 @@
}
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 09999ef..fa7410f 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 69ec678..f3eb28f 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 3be9959..695514c 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",
- "required": [
- "veggieName",
- "veggieLike"
- ],
"properties": {
- "veggieName": {
- "type": "string",
- "description": "The name of the vegetable."
+ "ueId": {
+ "type": "string"
},
- "veggieLike": {
- "type": "boolean",
- "description": "Do I like this vegetable?"
+ "sliceId": {
+ "type": "string"
+ },
+ "qosId": {
+ "type": "string"
+ },
+ "cellId": {
+ "type": "string"
}
- }
+ },
+ "additionalProperties": false,
+ "required": [
+ "ueId"
+ ]
+ },
+ "statement": {
+ "type": "object",
+ "properties": {
+ "cellIdList": {
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "string"
+ }
+ },
+ "preference": {
+ "type": "string",
+ "enum": [
+ "SHALL",
+ "PREFER",
+ "AVOID",
+ "FORBID"
+ ]
+ },
+ "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 bc94af9..ee0c447 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 1eef5c5..e71fd8a 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">
<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">
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 019a637..d57019f 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 @@
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 e9b6ff0..776d503 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 @@
<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}">
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 b635418..f929342 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 @@
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 @@
this.dialogRef.close();
}
- public onChanges(data: any) {
- this.liveFormData = data;
+ public onChanges(formData: any) {
+ this.liveFormData = formData;
}
get prettyLiveFormData() {
@@ -150,8 +150,8 @@
this.formIsValid = isValid;
}
- validationErrors(data: any): void {
- this.formValidationErrors = data;
+ validationErrors(validationErrors: any): void {
+ this.formValidationErrors = validationErrors;
}
get prettyValidationErrors() {
@@ -177,7 +177,7 @@
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 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 5ecd585..30a3dfa 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;
}