From a4a7cffb9edbf153aab20cacaddda8fa368d47f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Fri, 14 Mar 2014 15:33:40 +0100 Subject: [PATCH] Feature #2746: Fix nic section in template update --- .../public/js/plugins/templates-tab.js | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index 3e9c4dd2e6..9d3ebb81a6 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -1689,6 +1689,38 @@ function retrieve_nic_tab_data(context){ return data } +function fill_nic_tab_data(template_json, context){ + + if (template_json["WHITE_PORTS_TCP"]){ + var field = $("input.tcp_type[value='WHITE_PORTS_TCP']", context); + field.click(); + + $("#TCP_PORTS", context).val(template_json["WHITE_PORTS_TCP"]); + } else if (template_json["BLACK_PORTS_TCP"]){ + var field = $("input.tcp_type[value='BLACK_PORTS_TCP']", context); + field.click(); + + $("#TCP_PORTS", context).val(template_json["BLACK_PORTS_TCP"]); + } + + if (template_json["WHITE_PORTS_UDP"]){ + var field = $("input.udp_type[value='WHITE_PORTS_UDP']", context); + field.click(); + + $("#UDP_PORTS", context).val(template_json["WHITE_PORTS_UDP"]); + } else if (template_json["BLACK_PORTS_UDP"]){ + var field = $("input.udp_type[value='BLACK_PORTS_UDP']", context); + field.click(); + + $("#UDP_PORTS", context).val(template_json["BLACK_PORTS_UDP"]); + } + + if (template_json["ICMP"]){ + var field = $("#icmp_type", context); + $("#icmp_type", context).attr('checked','checked'); + } +} + function setup_nic_tab_content(nic_section, str_nic_tab_id, str_datatable_id) { var dataTable_template_networks = $('#'+str_datatable_id, nic_section).dataTable({ "bAutoWidth":false, @@ -4000,6 +4032,8 @@ function fillTemplatePopUp(template, dialog){ }) autoFillInputs(nic, nic_section); + + fill_nic_tab_data(nic, nic_section); } if (template.NIC) {