diff options
Diffstat (limited to 'ui-react/src')
-rw-r--r-- | ui-react/src/api/LoopCache.js | 4 | ||||
-rw-r--r-- | ui-react/src/api/LoopCache.test.js | 11 | ||||
-rw-r--r-- | ui-react/src/api/LoopService.js | 27 | ||||
-rw-r--r-- | ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js | 2 |
4 files changed, 26 insertions, 18 deletions
diff --git a/ui-react/src/api/LoopCache.js b/ui-react/src/api/LoopCache.js index 5eaa79a6..c54337f2 100644 --- a/ui-react/src/api/LoopCache.js +++ b/ui-react/src/api/LoopCache.js @@ -70,10 +70,6 @@ export default class LoopCache { return this.loopJsonCache["name"]; } - getOperationalPolicyConfigurationJson() { - return this.loopJsonCache["operationalPolicies"]["0"]["configurationsJson"]; - } - getOperationalPolicyJsonSchema() { return this.loopJsonCache["operationalPolicies"]["0"]["jsonRepresentation"]; } diff --git a/ui-react/src/api/LoopCache.test.js b/ui-react/src/api/LoopCache.test.js index fc756814..4642ff52 100644 --- a/ui-react/src/api/LoopCache.test.js +++ b/ui-react/src/api/LoopCache.test.js @@ -30,17 +30,6 @@ describe('Verify LoopCache functions', () => { expect(loopCache.getLoopName()).toBe("LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca"); }); - it('getOperationalPolicyConfigurationJson', () => { - const opPolicyConfig = { - "guard_policies": {}, - "operational_policy": { - "controlLoop": {}, - "policies": [] - } - }; - expect(loopCache.getOperationalPolicyConfigurationJson()).toStrictEqual(opPolicyConfig); - }); - it('getOperationalPolicies', () => { const opPolicy = [{ "name": "OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca", diff --git a/ui-react/src/api/LoopService.js b/ui-react/src/api/LoopService.js index 2750763d..698ee28c 100644 --- a/ui-react/src/api/LoopService.js +++ b/ui-react/src/api/LoopService.js @@ -171,8 +171,8 @@ export default class LoopService { }); } - static refreshOpPolicyJson(loopName) { - return fetch('/restservices/clds/v2/loop/refreshOpPolicyJsonSchema/' + loopName, { + static refreshOperationalPolicyJson(loopName,operationalPolicyName) { + return fetch('/restservices/clds/v2/loop/refreshOperationalPolicyJsonSchema/' + loopName + '/' + operationalPolicyName, { method: 'PUT', headers: { "Content-Type": "application/json" @@ -194,6 +194,29 @@ export default class LoopService { }); } + static refreshMicroServicePolicyJson(loopName,microServicePolicyName) { + return fetch('/restservices/clds/v2/loop/refreshMicroServicePolicyJsonSchema/' + loopName + '/' + microServicePolicyName, { + method: 'PUT', + headers: { + "Content-Type": "application/json" + }, + credentials: 'same-origin' + }) + .then(function (response) { + console.debug("Refresh Operational Policy Json Schema response received: ", response.status); + if (response.ok) { + return response.json(); + } else { + console.error("Refresh Operational Policy Json Schema query failed"); + return {}; + } + }) + .catch(function (error) { + console.error("Refresh Operational Policy Json Schema error received", error); + return {}; + }); + } + static addOperationalPolicyType(loopName, policyType, policyVersion) { return fetch('/restservices/clds/v2/loop/addOperationaPolicy/' + loopName + '/policyModel/' + policyType +'/' + policyVersion , { method: 'PUT', diff --git a/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js index 7ed8ba6f..89e70795 100644 --- a/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js +++ b/ui-react/src/components/dialogs/OperationalPolicy/OperationalPolicyModal.js @@ -127,7 +127,7 @@ export default class OperationalPolicyModal extends React.Component { } handleRefresh() { - LoopService.refreshOpPolicyJson(this.state.loopCache.getLoopName()).then(data => { + LoopService.refreshOperationalPolicyJson(this.state.loopCache.getLoopName(), this.state.loopCache.getOperationalPolicies()[0]).then(data => { var newLoopCache = new LoopCache(data); var schema_json = newLoopCache.getOperationalPolicyJsonSchema(); var operationalPoliciesData = newLoopCache.getOperationalPoliciesNoJsonSchema(); |