From ab2000f5c2e7ef1c1901d767a6f175d1800387bf Mon Sep 17 00:00:00 2001 From: Jorge Miguel Lobo Escalona <47326048+jloboescalona2@users.noreply.github.com> Date: Tue, 14 Jul 2020 17:34:08 +0200 Subject: [PATCH] M #~: fix vm_template_content undefined (#88) Signed-off-by: Jorge Lobo (cherry picked from commit c2ab2e12d272f17fe5e0aa86758b62de4939c5d3) --- .../form-panels/instantiate.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/instantiate.js b/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/instantiate.js index ab66f4b7fb..3f6e1ce10f 100644 --- a/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/instantiate.js +++ b/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/instantiate.js @@ -237,8 +237,8 @@ define(function(require) { var extra_info = ServiceUtils.getExtraInfo(context); if( - that && - that.service_template_json && + that && + that.service_template_json && that.service_template_json.DOCUMENT && that.service_template_json.DOCUMENT.TEMPLATE && that.service_template_json.DOCUMENT.TEMPLATE.BODY && @@ -253,7 +253,7 @@ define(function(require) { role.user_inputs_values = tmp_json; if (stringCustomValues) { (temp_role.vm_template_contents) - ? temp_role.vm_template_contents += stringCustomValues + ? temp_role.vm_template_contents += stringCustomValues : temp_role.vm_template_contents = stringCustomValues; } $("#instantiate_service_role_user_inputs").find("select").each(function(key, vm_group){ @@ -267,6 +267,13 @@ define(function(require) { temp_role.vm_template_contents += TemplateUtils.templateToString({VMGROUP:{ROLE:role.name,VMGROUP_ID:vm_group_value}}); } }); + if(charters.length){ + if(temp_role.vm_template_contents !== undefined){ + temp_role.vm_template_contents += charters; + }else{ + temp_role.vm_template_contents = charters; + } + } extra_info.merge_template.roles.push(temp_role); }); }