summaryrefslogtreecommitdiffstats
path: root/gui-clamp/ui-react/src/api/ControlLoopService.js
diff options
context:
space:
mode:
authorsaul.gill <saul.gill@est.tech>2021-07-12 17:10:10 +0100
committersaul.gill <saul.gill@est.tech>2021-07-19 16:08:22 +0100
commit3f99e6d9f007477fe6074f470048440d2b29c1ff (patch)
treef8c35c32fa163fc6f21f04cb61f2c3b6db5545de /gui-clamp/ui-react/src/api/ControlLoopService.js
parent71d6358a8f787c5d2688a485d42ff9514dc58a56 (diff)
Added Commissioning Template Editor
Added a new modal to allow editing of the tosca template Json schema from the backend generates a for the user Added Decommissioning capability while viewing template Added service for decommissioning Issue-ID: POLICY-3439 Change-Id: Ic5bec9ea26aa8df468d36a893faa06f88d248dd5 Signed-off-by: saul.gill <saul.gill@est.tech>
Diffstat (limited to 'gui-clamp/ui-react/src/api/ControlLoopService.js')
-rw-r--r--gui-clamp/ui-react/src/api/ControlLoopService.js53
1 files changed, 50 insertions, 3 deletions
diff --git a/gui-clamp/ui-react/src/api/ControlLoopService.js b/gui-clamp/ui-react/src/api/ControlLoopService.js
index 30b0522..1f3cbed 100644
--- a/gui-clamp/ui-react/src/api/ControlLoopService.js
+++ b/gui-clamp/ui-react/src/api/ControlLoopService.js
@@ -68,11 +68,37 @@ export default class ControlLoopService {
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 deleteToscaTemplate(name, version, windowLocationPathname) {
+ const params = {
+ name: name,
+ version: version
}
+ const response = await fetch(windowLocationPathname +
+ '/restservices/clds/v2/toscaControlLoop/decommissionToscaTemplate' + '?' + (new URLSearchParams(params)),
+ {
+ method: 'DELETE'
+ });
+
+ this.checkResponseForError(response);
+
+ const data = await response;
+
+ return data;
+ }
+
+ static async getToscaControlLoopDefinitions(windowLocationPathname) {
+
+ const response = await fetch(windowLocationPathname +
+ '/restservices/clds/v2/toscaControlLoop/getElementDefinitions');
+
+ this.checkResponseForError(response);
+
const data = await response;
return data;
@@ -92,4 +118,25 @@ export default class ControlLoopService {
return response
}
+
+ static async getToscaServiceTemplateSchema(section, windowLocationPathName) {
+
+ const params = {
+ section: section
+ }
+
+ const response = await fetch(windowLocationPathName +
+ '/restservices/clds/v2/toscaControlLoop/getJsonSchema' + '?' + (new URLSearchParams(params)));
+
+ this.checkResponseForError(response);
+
+ return response;
+ }
+
+ static checkResponseForError (response) {
+ if (!response.ok) {
+ const message = `An error has occurred: ${response.status}`;
+ throw new Error(message);
+ }
+ }
}