diff options
author | Jim Hahn <jrh3@att.com> | 2021-07-20 13:44:23 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-07-20 13:44:23 +0000 |
commit | 29871bc266df6b4418f30311ce9d0ef9ddd9965c (patch) | |
tree | a58d71644fb500c6b60089c9af78e7185262e85b /gui-clamp/ui-react/src/api/ControlLoopService.js | |
parent | efaa2f3f7d22a5096625b51643f707b471569d78 (diff) | |
parent | 3f99e6d9f007477fe6074f470048440d2b29c1ff (diff) |
Merge "Added Commissioning Template Editor"
Diffstat (limited to 'gui-clamp/ui-react/src/api/ControlLoopService.js')
-rw-r--r-- | gui-clamp/ui-react/src/api/ControlLoopService.js | 53 |
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); + } + } } |