Update op policy UI
Change the React UI accordingly so that we read OperationalPolicy Object
Issue-ID: CLAMP-583
Change-Id: Ifd14a7eb115dc75acb35f1e7591ee383066a45f1
Signed-off-by: xuegao <xg353y@intl.att.com>
diff --git a/ui-react/src/api/LoopCache.js b/ui-react/src/api/LoopCache.js
index 95eb931..c73ed62 100644
--- a/ui-react/src/api/LoopCache.js
+++ b/ui-react/src/api/LoopCache.js
@@ -53,13 +53,19 @@
}
getOperationalPolicyJsonSchema() {
- return this.loopJsonCache["operationalPolicySchema"];
+ return this.loopJsonCache["operationalPolicies"]["0"]["jsonRepresentation"];
}
getOperationalPolicies() {
return this.loopJsonCache["operationalPolicies"];
}
+ getOperationalPoliciesNoJsonSchema() {
+ var operationalPolicies = JSON.parse(JSON.stringify(this.loopJsonCache["operationalPolicies"]));
+ delete operationalPolicies[0]["jsonRepresentation"];
+ return operationalPolicies;
+ }
+
getGlobalProperties() {
return this.loopJsonCache["globalPropertiesJson"];
}
diff --git a/ui-react/src/api/LoopCache.test.js b/ui-react/src/api/LoopCache.test.js
index f67bc0a..471fa4d 100644
--- a/ui-react/src/api/LoopCache.test.js
+++ b/ui-react/src/api/LoopCache.test.js
@@ -49,13 +49,36 @@
"operational_policy": {
"controlLoop": {},
"policies": []
-
}
- }
+ },
+ "jsonRepresentation": {
+ "schema": {}
+ }
}];
expect(loopCache.getOperationalPolicies()).toStrictEqual(opPolicy);
});
+ it('getOperationalPoliciesNoJsonSchema', () => {
+ const opPolicy = [{
+ "name": "OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca",
+ "configurationsJson": {
+ "guard_policies": {},
+ "operational_policy": {
+ "controlLoop": {},
+ "policies": []
+ }
+ }
+ }];
+ expect(loopCache.getOperationalPoliciesNoJsonSchema()).toStrictEqual(opPolicy);
+ });
+
+ it('getOperationalPolicyJsonSchema', () => {
+ const jsonSchema = {
+ "schema": {}
+ };
+
+ expect(loopCache.getOperationalPolicyJsonSchema()).toStrictEqual(jsonSchema);
+ });
it('getGlobalProperties', () => {
const globelProp = {
"dcaeDeployParameters": {
diff --git a/ui-react/src/api/LoopCache_mokeLoopJsonCache.json b/ui-react/src/api/LoopCache_mokeLoopJsonCache.json
index c84b5b6..087ab5d 100644
--- a/ui-react/src/api/LoopCache_mokeLoopJsonCache.json
+++ b/ui-react/src/api/LoopCache_mokeLoopJsonCache.json
@@ -93,6 +93,9 @@
"controlLoop": {},
"policies": []
}
+ },
+ "jsonRepresentation": {
+ "schema": {}
}
}
],