From c03a18d57b7702ac7a37b66651dd49c163306c56 Mon Sep 17 00:00:00 2001 From: Jorge Miguel Lobo Escalona <47326048+jloboescalona2@users.noreply.github.com> Date: Thu, 17 Sep 2020 16:00:05 +0200 Subject: [PATCH] B #~: lost charters in services (#222) Signed-off-by: Jorge Lobo Co-authored-by: Jorge Lobo --- .../form-panels/instantiate.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 3f6e1ce10f..0c4e14ba80 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 @@ -244,6 +244,16 @@ define(function(require) { that.service_template_json.DOCUMENT.TEMPLATE.BODY && that.service_template_json.DOCUMENT.TEMPLATE.BODY.roles ){ + var charters = ""; + if(config && config.system_config && config.system_config.leases ){ + $(".service-charters", context).find("tr").each(function(index){ + var time = $(this).attr("data-time"); + var action = $(this).attr("data-action"); + if(time.length>0 && action.length>0){ + charters += TemplateUtils.templateToString({SCHED_ACTION:{ACTION:action, TIME: time, ID: index.toString()}}); + } + }); + } $.each(that.service_template_json.DOCUMENT.TEMPLATE.BODY.roles, function(index, role){ var temp_role = role; var div_id = "user_input_role_"+index; @@ -267,7 +277,7 @@ define(function(require) { temp_role.vm_template_contents += TemplateUtils.templateToString({VMGROUP:{ROLE:role.name,VMGROUP_ID:vm_group_value}}); } }); - if(charters.length){ + if(charters && charters.length){ if(temp_role.vm_template_contents !== undefined){ temp_role.vm_template_contents += charters; }else{ @@ -276,6 +286,7 @@ define(function(require) { } extra_info.merge_template.roles.push(temp_role); }); + charters = ""; } if (!service_name.length){ //empty name for (var i=0; i< n_times_int; i++){