diff options
author | 2021-11-15 11:53:18 +0000 | |
---|---|---|
committer | 2021-11-15 11:53:18 +0000 | |
commit | cb347e737f05d030fe781e15a9cf755cef42c80f (patch) | |
tree | 8919ef211d85b25b2e4edc94b40c678dabb87a85 /runtime/ui-react/src/api/LoopActionService.js | |
parent | 496f58cf8f5ad6c65b417d2ae79a69ece480d049 (diff) | |
parent | 2022e5ce5a03788a6edc5761c495cfadc5ded485 (diff) |
Merge "Align ui-react file in policy-clamp and policy-gui"
Diffstat (limited to 'runtime/ui-react/src/api/LoopActionService.js')
-rw-r--r-- | runtime/ui-react/src/api/LoopActionService.js | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/runtime/ui-react/src/api/LoopActionService.js b/runtime/ui-react/src/api/LoopActionService.js index 18ae90eff..6f3b22fa2 100644 --- a/runtime/ui-react/src/api/LoopActionService.js +++ b/runtime/ui-react/src/api/LoopActionService.js @@ -21,54 +21,54 @@ * */ -export default class LoopActionService{ +export default class LoopActionService { - static performAction(cl_name, uiAction) { - console.info("LoopActionService perform action: " + uiAction + " closedloopName=" + cl_name); - const svcAction = uiAction.toLowerCase(); - return fetch(window.location.pathname + "restservices/clds/v2/loop/" + svcAction + "/" + cl_name, { - method: 'PUT', - credentials: 'same-origin' - }) - .then(function (response) { - if (response.ok) { - return response; - } else { - return Promise.reject("Perform action failed with code:" + response.status); - } - }) - .then(function (data) { - console.info("Action Successful: " + uiAction); - return data; - }) - .catch(function(error) { - console.info("Action Failure: " + uiAction); - return Promise.reject(error); - }); - } + static performAction(cl_name, uiAction) { + console.info("LoopActionService perform action: " + uiAction + " closedloopName=" + cl_name); + const svcAction = uiAction.toLowerCase(); + return fetch(window.location.pathname + "restservices/clds/v2/loop/" + svcAction + "/" + cl_name, { + method: 'PUT', + credentials: 'same-origin' + }) + .then(function (response) { + if (response.ok) { + return response; + } else { + return Promise.reject("Perform action failed with code:" + response.status); + } + }) + .then(function (data) { + console.info("Action Successful: " + uiAction); + return data; + }) + .catch(function (error) { + console.info("Action Failure: " + uiAction); + return Promise.reject(error); + }); + } - static refreshStatus(cl_name) { - console.info("Refresh the status for closedloopName=" + cl_name); + static refreshStatus(cl_name) { + console.info("Refresh the status for closedloopName=" + cl_name); - return fetch(window.location.pathname + "restservices/clds/v2/loop/getstatus/" + cl_name, { - method: 'GET', - credentials: 'same-origin' - }) - .then(function (response) { - if (response.ok) { - return response.json(); - } else { - return Promise.reject("Refresh status failed with code:" + response.status); - } - }) - .then(function (data) { - console.info ("Refresh status Successful"); - return data; - }) - .catch(function(error) { - console.info ("Refresh status failed:", error); - return Promise.reject(error); - }); - } + return fetch(window.location.pathname + "restservices/clds/v2/loop/getstatus/" + cl_name, { + method: 'GET', + credentials: 'same-origin' + }) + .then(function (response) { + if (response.ok) { + return response.json(); + } else { + return Promise.reject("Refresh status failed with code:" + response.status); + } + }) + .then(function (data) { + console.info("Refresh status Successful"); + return data; + }) + .catch(function (error) { + console.info("Refresh status failed:", error); + return Promise.reject(error); + }); + } } |