summaryrefslogtreecommitdiffstats
path: root/ui-react/src
diff options
context:
space:
mode:
Diffstat (limited to 'ui-react/src')
-rw-r--r--ui-react/src/api/LoopCache.js8
-rw-r--r--ui-react/src/api/LoopCache.test.js25
-rw-r--r--ui-react/src/api/LoopCache_mokeLoopJsonCache.json3
-rw-r--r--ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js2
-rw-r--r--ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.test.js6
5 files changed, 38 insertions, 6 deletions
diff --git a/ui-react/src/api/LoopCache.js b/ui-react/src/api/LoopCache.js
index 95eb9310e..c73ed62b5 100644
--- a/ui-react/src/api/LoopCache.js
+++ b/ui-react/src/api/LoopCache.js
@@ -53,13 +53,19 @@ export default class LoopCache {
}
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 f67bc0aa0..471fa4d71 100644
--- a/ui-react/src/api/LoopCache.test.js
+++ b/ui-react/src/api/LoopCache.test.js
@@ -49,13 +49,36 @@ describe('Verify LoopCache functions', () => {
"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.getOperationalPolicies()).toStrictEqual(opPolicy);
+ 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 c84b5b691..087ab5d45 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": {}
}
}
],
diff --git a/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js
index 5c5f0241a..c7363f6e5 100644
--- a/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js
+++ b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js
@@ -114,7 +114,7 @@ export default class OperationalPolicyModal extends React.Component {
console.error("NO Operational policy schema found");
return;
}
- var operationalPoliciesData = this.state.loopCache.getOperationalPolicies();
+ var operationalPoliciesData = this.state.loopCache.getOperationalPoliciesNoJsonSchema();
this.setState({
jsonEditor: new JSONEditor(document.getElementById("editor"),
diff --git a/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.test.js b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.test.js
index 9c7da3108..522a3f681 100644
--- a/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.test.js
+++ b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.test.js
@@ -46,9 +46,9 @@ describe('Verify OperationalPolicyModal', () => {
"controlLoop": {},
"policies": []
}
- }
- }],
- "operationalPolicySchema": {"schema": {}}
+ },
+ "jsonRepresentation" : {"schema": {}}
+ }]
});
const historyMock = { push: jest.fn() };
const flushPromises = () => new Promise(setImmediate);