diff options
author | 2021-07-08 15:33:55 +0100 | |
---|---|---|
committer | 2021-07-13 15:20:41 +0100 | |
commit | 71d6358a8f787c5d2688a485d42ff9514dc58a56 (patch) | |
tree | 091e1bf68ecff15267d7c1c14f68cca9d04f38a8 /gui-clamp/ui-react/src/api | |
parent | 9752dad7c9ad8f970fb87b92c06c7ae8d8121280 (diff) |
Add Upload Control Loop Instantiation
Created Functionality to Upload JSON file to Control Loop Instantiation.
Issue-ID: POLICY-3436
Change-Id: Iefd538c91154b7e61615ab63b440378e2feea502
Signed-off-by: brunomilitzer <bruno.militzer@est.tech>
Diffstat (limited to 'gui-clamp/ui-react/src/api')
-rw-r--r-- | gui-clamp/ui-react/src/api/ControlLoopService.js | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/gui-clamp/ui-react/src/api/ControlLoopService.js b/gui-clamp/ui-react/src/api/ControlLoopService.js index 1882f78..30b0522 100644 --- a/gui-clamp/ui-react/src/api/ControlLoopService.js +++ b/gui-clamp/ui-react/src/api/ControlLoopService.js @@ -19,7 +19,7 @@ export default class ControlLoopService { - static async getControlLoopList(windowLocationPathname) { + static async fetchControlLoopInstantiation(windowLocationPathname) { return await fetch(windowLocationPathname + '/restservices/clds/v2/toscaControlLoop/getToscaInstantiation', { method: 'GET', @@ -28,10 +28,10 @@ export default class ControlLoopService { }, credentials: 'same-origin', }).then(response => { - console.log("getControlLoopList received " + response.status); + console.log("fetchControlLoopInstantiation received " + response.status); if (response.ok) { - console.info("getControlLoopList query successful"); + console.info("fetchControlLoopInstantiation query successful"); return response.json(); } else { return response.text().then(responseBody => { @@ -39,12 +39,26 @@ export default class ControlLoopService { }); } }).catch(error => { - console.error("getControlLoopList error occurred ", error); - alert("getControlLoopList error occurred " + error); + console.error("fetchControlLoopInstantiation error occurred ", error); + alert("fetchControlLoopInstantiation error occurred " + error); return undefined; }); } + static async uploadToscaInstantiation(toscaObject, windowLocationPathname) { + + const response = await fetch(windowLocationPathname + '/restservices/clds/v2/toscaControlLoop/postToscaInstantiation', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + credentials: 'same-origin', + body: JSON.stringify(toscaObject) + }); + + return response; + } + static async getToscaTemplate(name, version, windowLocationPathname) { const params = { name: name, |