From d400786ffc4575d04035d86f3f5eebf06644828c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Wed, 18 Feb 2015 13:16:31 +0100 Subject: [PATCH] Bug #3605: Fix dynamic network update --- src/sunstone/public/js/plugins/oneflow-templates.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/sunstone/public/js/plugins/oneflow-templates.js b/src/sunstone/public/js/plugins/oneflow-templates.js index 215c4e5e66..831ebcba9c 100644 --- a/src/sunstone/public/js/plugins/oneflow-templates.js +++ b/src/sunstone/public/js/plugins/oneflow-templates.js @@ -723,7 +723,7 @@ function updateServiceTemplateInfo(request,elem){ $(".resource-info-header", $("#oneflow-templates")).html(elem_info.NAME); var network_configuration = ""; - if (elem_info.TEMPLATE.BODY['custom_attrs']) { + if ( ! $.isEmptyObject( elem_info.TEMPLATE.BODY['custom_attrs'] ) ) { network_configuration += '\ \ @@ -1556,8 +1556,11 @@ function generate_json_service_template_from_form(dialog) { name: name, deployment: deployment, description: description, - roles: roles, - custom_attrs: custom_attrs + roles: roles + } + + if (!$.isEmptyObject(custom_attrs)){ + obj['custom_attrs'] = custom_attrs } if (shutdown_action_service){ @@ -1584,7 +1587,7 @@ function fillUpUpdateServiceTemplateDialog(response, dialog){ $("select[name='shutdown_action_service']", dialog).val(service_template.TEMPLATE.BODY.shutdown_action); $("input[name='ready_status_gate']", dialog).prop("checked",service_template.TEMPLATE.BODY.ready_status_gate || false); - if (service_template.TEMPLATE.BODY['custom_attrs'].length) { + if ( ! $.isEmptyObject( service_template.TEMPLATE.BODY['custom_attrs'] ) ) { $("a[href='#network_configuration_and_attributes']", dialog).trigger("click"); $(".service_networks i.remove-tab", dialog).trigger("click");