diff options
author | sebdet <sebastien.determe@intl.att.com> | 2021-04-21 16:28:33 +0200 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2021-04-23 17:35:17 +0200 |
commit | d1ed0a9ba6ffea4006fadf3847495563d11dc12e (patch) | |
tree | 4ced12d9a953aa0fddd1c6a8002836964020d94d /ui-react/src/api | |
parent | 5ce5937197df5eed3895e2590ea31b23207026b4 (diff) |
ToscaFileSelector
The UI code that manages the tosca file selector that will be sent to clamp be + fix Rest Camel endpoint that always want ot convert http body to JSON (due to Camel upgrade)
Issue-ID: POLICY-3229
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: I6148276d4c527f29db904a76655055c19d4e2023
Diffstat (limited to 'ui-react/src/api')
-rw-r--r-- | ui-react/src/api/PolicyService.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ui-react/src/api/PolicyService.js b/ui-react/src/api/PolicyService.js index 54110f39c..f2886b30a 100644 --- a/ui-react/src/api/PolicyService.js +++ b/ui-react/src/api/PolicyService.js @@ -119,4 +119,30 @@ export default class PolicyService { return undefined; }); } + static sendNewPolicyModel(newPolicyModel) { + return fetch(window.location.pathname + 'restservices/clds/v2/policies/policytype', { + method: 'POST', + credentials: 'same-origin', + headers: { + "Content-Type": "plain/text" + }, + body: newPolicyModel + }) + .then(function (response) { + console.debug("sendNewPolicyModel response received: ", response.status); + if (response.ok) { + console.info("sendNewPolicyModel query successful"); + return response.text(); + } else { + return response.text().then(responseBody => { + throw new Error("HTTP " + response.status + "," + responseBody); + }) + } + }) + .catch(function (error) { + console.error("sendNewPolicyModel error occurred ", error); + alert ("sendNewPolicyModel error occurred " + error); + return undefined; + }); + } } |