From 3f99e6d9f007477fe6074f470048440d2b29c1ff Mon Sep 17 00:00:00 2001 From: "saul.gill" Date: Mon, 12 Jul 2021 17:10:10 +0100 Subject: 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 --- gui-clamp/ui-react/src/api/ControlLoopService.js | 53 ++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 3 deletions(-) (limited to 'gui-clamp/ui-react/src/api/ControlLoopService.js') 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); + } + } } -- cgit 1.2.3-korg