summaryrefslogtreecommitdiffstats
path: root/gui-clamp/ui-react/src/api/ControlLoopService.js
diff options
context:
space:
mode:
Diffstat (limited to 'gui-clamp/ui-react/src/api/ControlLoopService.js')
-rw-r--r--gui-clamp/ui-react/src/api/ControlLoopService.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/gui-clamp/ui-react/src/api/ControlLoopService.js b/gui-clamp/ui-react/src/api/ControlLoopService.js
index 5ef7529..1882f78 100644
--- a/gui-clamp/ui-react/src/api/ControlLoopService.js
+++ b/gui-clamp/ui-react/src/api/ControlLoopService.js
@@ -44,4 +44,38 @@ export default class ControlLoopService {
return undefined;
});
}
+
+ static async getToscaTemplate(name, version, windowLocationPathname) {
+ const params = {
+ name: name,
+ version: version
+ }
+
+ const response = await fetch(windowLocationPathname +
+ '/restservices/clds/v2/toscaControlLoop/getToscaTemplate' + '?' + (new URLSearchParams(params)));
+
+ if (!response.ok) {
+ const message = `An error has occurred: ${response.status}`;
+ throw new Error(message);
+ }
+
+ const data = await response;
+
+ return data;
+ }
+
+ static async uploadToscaFile(toscaObject, windowLocationPathName) {
+ const response = await fetch(windowLocationPathName +
+ '/restservices/clds/v2/toscaControlLoop/commissionToscaTemplate', {
+ method: 'POST',
+ headers: {
+ "Content-Type": "application/json"
+ },
+ credentials: 'same-origin',
+ body: JSON.stringify(toscaObject),
+ });
+
+ return response
+
+ }
}