summaryrefslogtreecommitdiffstats
path: root/ui-react/src/api
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2020-05-18 12:31:11 +0200
committersebdet <sebastien.determe@intl.att.com>2020-05-20 18:00:03 +0200
commitc0ec0fc448af1c5d6eacb195e95938c921ba1bce (patch)
treef294596a5aa001f76fa4cd6f1a3c88d669fadd32 /ui-react/src/api
parent061ecec6a6099ad7fb480b0fe67f6e5154f9db23 (diff)
Create SVG in UI
Remove the SVG generation from the backend and put it in the UI Issue-ID: CLAMP-854 Signed-off-by: sebdet <sebastien.determe@intl.att.com> Change-Id: Icfa9e107d83bb244ac3d87300d013555bfa0b037
Diffstat (limited to 'ui-react/src/api')
-rw-r--r--ui-react/src/api/LoopCache.js27
-rw-r--r--ui-react/src/api/TemplateService.js41
2 files changed, 29 insertions, 39 deletions
diff --git a/ui-react/src/api/LoopCache.js b/ui-react/src/api/LoopCache.js
index 4f22dc2bb..3e19b4fc7 100644
--- a/ui-react/src/api/LoopCache.js
+++ b/ui-react/src/api/LoopCache.js
@@ -221,9 +221,32 @@ export default class LoopCache {
}
getTemplateName() {
- if (this.loopJsonCache["loopTemplate"] !== undefined) {
- return this.loopJsonCache["loopTemplate"].name;
+ if (this.getLoopTemplate() !== undefined) {
+ return this.getLoopTemplate().name;
}
return null;
}
+
+ getLoopTemplate() {
+ return this.loopJsonCache["loopTemplate"];
+ }
+
+ isOpenLoopTemplate() {
+ var loopTemplate = this.getLoopTemplate();
+ if(loopTemplate != null && loopTemplate["allowedLoopType"] === "OPEN") {
+ return true;
+ }
+ return false;
+ }
+
+ getAllLoopElementModels() {
+ var loopTemplate = this.getLoopTemplate();
+ var loopElementModels = [];
+ if(loopTemplate != null) {
+ for (var element of loopTemplate['loopElementModelsUsed']) {
+ loopElementModels.push(element['loopElementModel'])
+ }
+ }
+ return loopElementModels;
+ }
}
diff --git a/ui-react/src/api/TemplateService.js b/ui-react/src/api/TemplateService.js
index eddd58dff..3a780dd65 100644
--- a/ui-react/src/api/TemplateService.js
+++ b/ui-react/src/api/TemplateService.js
@@ -21,57 +21,24 @@
*/
export default class TemplateService {
- static getTemplateNames() {
- return fetch('/restservices/clds/v2/templates/names', { method: 'GET', credentials: 'same-origin' })
- .then(function (response) {
- console.debug("GetTemplateNames response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("GetTemplateNames query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("GetTemplateNames error received", error);
- return {};
- });
- }
- static getBlueprintMicroServiceTemplates() {
+ static getAllLoopTemplates() {
return fetch('restservices/clds/v2/templates', { method: 'GET', credentials: 'same-origin', })
.then(function (response) {
- console.debug("getBlueprintMicroServiceTemplates response received: ", response.status);
+ console.debug("getAllLoopTemplates response received: ", response.status);
if (response.ok) {
return response.json();
} else {
- console.error("getBlueprintMicroServiceTemplates query failed");
+ console.error("getAllLoopTemplates query failed");
return {};
}
})
.catch(function (error) {
- console.error("getBlueprintMicroServiceTemplates error received", error);
+ console.error("getAllLoopTemplates error received", error);
return {};
});
}
- static getBlueprintMicroServiceTemplateSvg(templateName) {
- return fetch('/restservices/clds/v2/templates/' + templateName + ' /svgRepresentation', { method: 'GET', credentials: 'same-origin', })
- .then(function (response) {
- console.debug("getBlueprintMicroServiceTemplateSvg response received: ", response.status);
- if (response.ok) {
- return response.text();
- } else {
- console.error("getBlueprintMicroServiceTemplateSvg query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("getBlueprintMicroServiceTemplateSvg error received", error);
- return {};
- });
- }
-
static getDictionary() {
return fetch('restservices/clds/v2/dictionary/', { method: 'GET', credentials: 'same-origin', })
.then(function (response) {