aboutsummaryrefslogtreecommitdiffstats
path: root/ui-react/src/api
diff options
context:
space:
mode:
authorash74268 <ashwin.shyam.sharma@att.com>2020-01-31 15:40:15 +0000
committersebdet <sebastien.determe@intl.att.com>2020-02-14 08:02:47 -0800
commit3a83e2a2ff88ef49535973df8dc77dc8015170da (patch)
tree7b1d9376a6a3967d9690bcc88487fb6bb7893167 /ui-react/src/api
parent29e3cd1afbd3202a0c16ef6a4057662942ddefa2 (diff)
Changes include Metadata support, Upload tosca policy model and Loop Template
CLAMP Metadata support to parse policy_model_type, acronym and clamp_possible_values from the Tosca Policy Model UI and Backend changes to support Loop Template Backend APIs for Dictionary referenced in the Tosca Policy Model. Upload Tosca Model UI changes to allow user to upload policy models. DB Schema changes for the Loop Element Model and updated schema for the Dictionary Added Jest test cases and snapshots checkstyle issues fix and Junits Issue-ID: CLAMP-580 Signed-off-by: ash74268 <ashwin.shyam.sharma@att.com> Change-Id: I57521bc1c3afaf4ca5a2acf4c59823df05fd4cd6 Signed-off-by: ash74268 <ashwin.shyam.sharma@att.com>
Diffstat (limited to 'ui-react/src/api')
-rw-r--r--ui-react/src/api/TemplateMenuService.js52
1 files changed, 50 insertions, 2 deletions
diff --git a/ui-react/src/api/TemplateMenuService.js b/ui-react/src/api/TemplateMenuService.js
index dfa9c578e..0dabebdd1 100644
--- a/ui-react/src/api/TemplateMenuService.js
+++ b/ui-react/src/api/TemplateMenuService.js
@@ -22,7 +22,7 @@
export default class TemplateMenuService {
static getToscaPolicyModels() {
- return fetch('restservices/clds/v2/loop/tosca/models', { method: 'GET', credentials: 'same-origin' })
+ return fetch('restservices/clds/v2/policyToscaModels', { method: 'GET', credentials: 'same-origin' })
.then(function (response) {
console.debug("getToscaPolicyModels response received: ", response.status);
if (response.ok) {
@@ -38,8 +38,56 @@ export default class TemplateMenuService {
});
}
+ static getToscaPolicyModelYaml(policyModelType) {
+ return fetch('/restservices/clds/v2/policyToscaModels/yaml/' + policyModelType, {
+ method: 'GET',
+ credentials: 'same-origin'
+ })
+ .then(function (response) {
+ console.debug("getToscaPolicyModelYaml response received: ", response.status);
+ if (response.ok) {
+ return response.json();
+ } else {
+ console.error("getToscaPolicyModelYaml query failed");
+ return "";
+ }
+ })
+ .catch(function (error) {
+ console.error("getToscaPolicyModelYaml error received", error);
+ return "";
+ });
+ }
+
+ static uploadToscaPolicyModal(policyModelType, jsonData) {
+ return fetch('/restservices/clds/v2/policyToscaModels/' + policyModelType, {
+ method: 'PUT',
+ credentials: 'same-origin',
+ headers: {
+ "Content-Type": "a",
+ },
+ body: JSON.stringify(jsonData)
+ })
+ .then(function(response) {
+ console.debug("uploadToscaPolicyModal response received: ", response.status);
+ if (response.ok) {
+ var message = {
+ status: response.status,
+ message: 'Tosca Policy Model successfully uploaded'
+ };
+ return message;
+ } else {
+ console.error("uploadToscaPolicyModal failed");
+ return response.text();
+ }
+ })
+ .catch(function(error) {
+ console.error("uploadToscaPolicyModal error received", error);
+ return "";
+ });
+ }
+
static getBlueprintMicroServiceTemplates() {
- return fetch('restservices/clds/v2/loop/templates', { method: 'GET', credentials: 'same-origin', })
+ return fetch('restservices/clds/v2/templates', { method: 'GET', credentials: 'same-origin', })
.then(function (response) {
console.debug("getBlueprintMicroServiceTemplates response received: ", response.status);
if (response.ok) {