From e55540f0c339ffebdea795b25e8e0a4cc53bfd12 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 27 Jul 2011 17:29:53 +0200 Subject: [PATCH] Feature #735: Added firewall-related attributes to the NIC section of template wizards. --- .../public/js/plugins/templates-tab.js | 114 ++++++++++++++++-- 1 file changed, 106 insertions(+), 8 deletions(-) diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index 2dfe909977..61853318c3 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -118,7 +118,7 @@ var create_template_tmpl = '
\ \
Path to the OS kernel to boot the image
\
\ -
\ +
\ \ \
Path to the initrd image
\ @@ -290,7 +290,7 @@ var create_template_tmpl = '
\ \
\
\ -
\ +
\ \ \ @@ -326,14 +326,61 @@ var create_template_tmpl = '
\ \
Hardware that will emulate this network interface. With Xen this is the type attribute of the vif.
\
\ +
\ + \ + \ +
\ +
\ +
\ + \ + \ +
Permits access to the VM only through the specified ports in the TCP protocol
\ +
\ +
\ + \ + \ +
Disallow access to the VM through the specified ports in the TCP protocol
\ +
\ +
\ + \ + \ +
\ +
\ +
\ + \ + \ +
Permits access to the VM only through the specified ports in the UDP protocol
\ +
\ +
\ + \ + \ +
Disallow access to the VM through the specified ports in the UDP protocol
\ +
\ +
\ + \ + \ +
ICMP policy
\ +
\ +
\
\ \ - \ -
\ - \ - \ -
\ + \ +
\ + \ + \ +
\ \
\ \ @@ -1448,6 +1495,7 @@ function setupCreateTemplateDialog(){ var networks_setup = function(){ $('.vm_param',section_networks).hide(); + $('.firewall_select').hide(); $('fieldset',section_networks).hide(); $('#add_networks',section_networks).click(function(){ @@ -1459,6 +1507,12 @@ function setupCreateTemplateDialog(){ //some fields $('#network_vs_niccfg input',section_networks).click(function(){ + //firewall + $('.firewall',section_networks).hide(); + $('.firewall',section_networks).attr("disabled","disabled"); + $('.firewall_select',section_networks).show(); + $('.firewall_select select option',section_networks).removeAttr("selected"); + select = $('#network_vs_niccfg :checked',section_networks).val(); switch (select) { case "network": @@ -1477,6 +1531,50 @@ function setupCreateTemplateDialog(){ //hide_disabled(section_networks); }); + $('#black_white_tcp',section_networks).live("change",function(){ + switch ($(this).val()) { + case "whitelist": + $('#BLACK_PORTS_TCP',section_networks).parent().attr("disabled","disabled"); + $('#BLACK_PORTS_TCP',section_networks).parent().hide(); + $('#WHITE_PORTS_TCP',section_networks).parent().removeAttr("disabled"); + $('#WHITE_PORTS_TCP',section_networks).parent().show(); + break; + case "blacklist": + $('#WHITE_PORTS_TCP',section_networks).parent().attr("disabled","disabled"); + $('#WHITE_PORTS_TCP',section_networks).parent().hide(); + $('#BLACK_PORTS_TCP',section_networks).parent().removeAttr("disabled"); + $('#BLACK_PORTS_TCP',section_networks).parent().show(); + break; + default: + $('#WHITE_PORTS_TCP',section_networks).parent().attr("disabled","disabled"); + $('#WHITE_PORTS_TCP',section_networks).parent().hide(); + $('#BLACK_PORTS_TCP',section_networks).parent().attr("disabled","disabled"); + $('#BLACK_PORTS_TCP',section_networks).parent().hide(); + }; + }); + + $('#black_white_udp',section_networks).live("change",function(){ + switch ($(this).val()) { + case "whitelist": + $('#BLACK_PORTS_UDP',section_networks).parent().attr("disabled","disabled"); + $('#BLACK_PORTS_UDP',section_networks).parent().hide(); + $('#WHITE_PORTS_UDP',section_networks).parent().removeAttr("disabled"); + $('#WHITE_PORTS_UDP',section_networks).parent().show(); + break; + case "blacklist": + $('#WHITE_PORTS_UDP',section_networks).parent().attr("disabled","disabled"); + $('#WHITE_PORTS_UDP',section_networks).parent().hide(); + $('#BLACK_PORTS_UDP',section_networks).parent().removeAttr("disabled"); + $('#BLACK_PORTS_UDP',section_networks).parent().show(); + break; + default: + $('#WHITE_PORTS_UDP',section_networks).parent().attr("disabled","disabled"); + $('#WHITE_PORTS_UDP',section_networks).parent().hide(); + $('#BLACK_PORTS_UDP',section_networks).parent().attr("disabled","disabled"); + $('#BLACK_PORTS_UDP',section_networks).parent().hide(); + }; + }); + //The filter to add a new network checks that we have selected a //network, or that the ip or mac are set //TODO: Improve this check