Add code in UI to create new policy version

Add code to call the policy create backend endpoint + alert box to show status of the creation + Fix backend +

Issue-ID: POLICY-2928
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: Ia8f2506ecc692ad68111ebe7a55a92579b951908
diff --git a/ui-react/src/api/PolicyService.js b/ui-react/src/api/PolicyService.js
index fdbb5d5..16cc1f3 100644
--- a/ui-react/src/api/PolicyService.js
+++ b/ui-react/src/api/PolicyService.js
@@ -40,4 +40,27 @@
         return {};
       });
   }
+  static createNewPolicy(policyModelType, policyModelVersion, policyJson) {
+    return fetch(window.location.pathname + 'restservices/clds/v2/policies/' + policyModelType + '/' + policyModelVersion, {
+            method: 'POST',
+            credentials: 'same-origin',
+            headers: {
+                "Content-Type": "application/json"
+            },
+            body: JSON.stringify(policyJson)
+        })
+      .then(function (response) {
+        console.debug("createNewPolicy response received: ", response.status);
+        if (response.ok) {
+          return response.text;
+        } else {
+          console.error("createNewPolicy query failed");
+          return "";
+        }
+      })
+      .catch(function (error) {
+        console.error("createNewPolicy error received", error);
+        throw new Error(error)
+      });
+  }
 }