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>
}
getOperationalPolicyJsonSchema() {
}
getOperationalPolicyJsonSchema() {
- return this.loopJsonCache["operationalPolicySchema"];
+ return this.loopJsonCache["operationalPolicies"]["0"]["jsonRepresentation"];
}
getOperationalPolicies() {
return this.loopJsonCache["operationalPolicies"];
}
}
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"];
}
getGlobalProperties() {
return this.loopJsonCache["globalPropertiesJson"];
}
"operational_policy": {
"controlLoop": {},
"policies": []
"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": {
it('getGlobalProperties', () => {
const globelProp = {
"dcaeDeployParameters": {
"controlLoop": {},
"policies": []
}
"controlLoop": {},
"policies": []
}
+ },
+ "jsonRepresentation": {
+ "schema": {}
console.error("NO Operational policy schema found");
return;
}
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"),
this.setState({
jsonEditor: new JSONEditor(document.getElementById("editor"),
"controlLoop": {},
"policies": []
}
"controlLoop": {},
"policies": []
}
- }
- }],
- "operationalPolicySchema": {"schema": {}}
+ },
+ "jsonRepresentation" : {"schema": {}}
+ }]
});
const historyMock = { push: jest.fn() };
const flushPromises = () => new Promise(setImmediate);
});
const historyMock = { push: jest.fn() };
const flushPromises = () => new Promise(setImmediate);