summaryrefslogtreecommitdiffstats
path: root/ui-react/src/api/TemplateMenuService.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui-react/src/api/TemplateMenuService.js')
-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) {