summaryrefslogtreecommitdiffstats
path: root/ui-react/src/api/PolicyService.js
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2021-04-21 16:28:33 +0200
committersebdet <sebastien.determe@intl.att.com>2021-04-23 17:35:17 +0200
commitd1ed0a9ba6ffea4006fadf3847495563d11dc12e (patch)
tree4ced12d9a953aa0fddd1c6a8002836964020d94d /ui-react/src/api/PolicyService.js
parent5ce5937197df5eed3895e2590ea31b23207026b4 (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/PolicyService.js')
-rw-r--r--ui-react/src/api/PolicyService.js26
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;
+ });
+ }
}