From f9e2ceeae29504505f631086e612fad4e1e16979 Mon Sep 17 00:00:00 2001 From: sebdet Date: Fri, 9 Aug 2019 18:36:09 +0200 Subject: Draft of op policy First draft of the Operational policy based on JsonEditor, it's a wip code Issue-ID: CLAMP-430 Change-Id: I2c7970e94488f4020377fd9d4d00691a3590b13e Signed-off-by: sebdet --- ui-react/src/api/LoopCache.js | 4 ++++ ui-react/src/api/LoopService.js | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'ui-react/src/api') diff --git a/ui-react/src/api/LoopCache.js b/ui-react/src/api/LoopCache.js index 3ee5acc6..d83e3ce9 100644 --- a/ui-react/src/api/LoopCache.js +++ b/ui-react/src/api/LoopCache.js @@ -51,6 +51,10 @@ export default class LoopCache { getOperationalPolicyConfigurationJson() { return this.loopJsonCache["operationalPolicies"]["0"]["configurationsJson"]; } + + getOperationalPolicyJsonSchema() { + return this.loopJsonCache["operationalPolicySchema"]; + } getOperationalPolicies() { return this.loopJsonCache["operationalPolicies"]; diff --git a/ui-react/src/api/LoopService.js b/ui-react/src/api/LoopService.js index 031ec638..eece20c9 100644 --- a/ui-react/src/api/LoopService.js +++ b/ui-react/src/api/LoopService.js @@ -104,6 +104,30 @@ export default class LoopService { return ""; }); } + + static setOperationalPolicyProperties(loopName, jsonData) { + return fetch('/restservices/clds/v2/loop/updateOperationalPolicies/' + loopName, { + method: 'POST', + credentials: 'same-origin', + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(jsonData), + }) + .then(function (response) { + console.debug("updateOperationalPolicies response received: ", response.status); + if (response.ok) { + return response.text(); + } else { + console.error("updateOperationalPolicies query failed"); + return ""; + } + }) + .catch(function (error) { + console.error("updateOperationalPolicies error received", error); + return ""; + }); + } static updateGlobalProperties(loopName, jsonData) { return fetch('/restservices/clds/v2/loop/updateGlobalProperties/' + loopName, { -- cgit 1.2.3-korg