bug 11175: cloudStack - convert firewallRuleUiEnabled from boolean to string before saving to cookie.

This commit is contained in:
Jessica Wang 2011-08-19 13:49:27 -07:00
parent eada883b5e
commit 301a5f7bcc
2 changed files with 36 additions and 26 deletions

View File

@ -702,23 +702,23 @@ $(document).ready(function() {
dataType: "json",
async: false,
success: function(json) {
/* g_supportELB: guest ips are allocated on guest network (so use 'forvirtualnetwork' = false)
* g_supportELB: public - ips are allocated on public network (so use 'forvirtualnetwork' = true)
* g_supportELB: false no ELB support
/* g_supportELB: "guest" ips are allocated on guest network (so use 'forvirtualnetwork' = false)
* g_supportELB: "public" - ips are allocated on public network (so use 'forvirtualnetwork' = true)
* g_supportELB: "false" no ELB support
*/
g_supportELB = json.listcapabilitiesresponse.capability.supportELB;
g_supportELB = json.listcapabilitiesresponse.capability.supportELB.toString(); //convert boolean to string if it's boolean
$.cookie('supportELB', g_supportELB, { expires: 1});
g_firewallRuleUiEnabled = json.listcapabilitiesresponse.capability.firewallRuleUiEnabled;
g_firewallRuleUiEnabled = json.listcapabilitiesresponse.capability.firewallRuleUiEnabled.toString(); //convert boolean to string if it's boolean
$.cookie('firewallRuleUiEnabled', g_firewallRuleUiEnabled, { expires: 1});
if (json.listcapabilitiesresponse.capability.userpublictemplateenabled != null) {
g_userPublicTemplateEnabled = ""+json.listcapabilitiesresponse.capability.userpublictemplateenabled;
g_userPublicTemplateEnabled = json.listcapabilitiesresponse.capability.userpublictemplateenabled.toString(); //convert boolean to string if it's boolean
$.cookie('userpublictemplateenabled', g_userPublicTemplateEnabled, { expires: 1});
}
if (json.listcapabilitiesresponse.capability.securitygroupsenabled != null) {
g_directAttachSecurityGroupsEnabled = ""+json.listcapabilitiesresponse.capability.securitygroupsenabled;
g_directAttachSecurityGroupsEnabled = json.listcapabilitiesresponse.capability.securitygroupsenabled.toString(); //convert boolean to string if it's boolean
$.cookie('directattachsecuritygroupsenabled', g_directAttachSecurityGroupsEnabled, { expires: 1});
}
@ -790,10 +790,10 @@ $(document).ready(function() {
else
g_timezoneoffset = null;
if (!g_directAttachSecurityGroupsEnabled || g_directAttachSecurityGroupsEnabled.length == 0)
if (g_directAttachSecurityGroupsEnabled == null || g_directAttachSecurityGroupsEnabled.length == 0)
g_directAttachSecurityGroupsEnabled = "false";
if (!g_userPublicTemplateEnabled || g_userPublicTemplateEnabled.length == 0)
if (g_userPublicTemplateEnabled == null || g_userPublicTemplateEnabled.length == 0)
g_userPublicTemplateEnabled = "true";
} else {
g_mySession = $.cookie('JSESSIONID');
@ -816,16 +816,26 @@ $(document).ready(function() {
data: createURL("command=listCapabilities"),
dataType: "json",
async: false,
success: function(json) {
if (json.listcapabilitiesresponse.capability.userpublictemplateenabled != null) {
g_userPublicTemplateEnabled = ""+json.listcapabilitiesresponse.capability.userpublictemplateenabled;
$.cookie('userpublictemplateenabled', g_userPublicTemplateEnabled, { expires: 1});
}
if (json.listcapabilitiesresponse.capability.securitygroupsenabled != null) {
g_directAttachSecurityGroupsEnabled = ""+json.listcapabilitiesresponse.capability.securitygroupsenabled;
$.cookie('directattachsecuritygroupsenabled', g_directAttachSecurityGroupsEnabled, { expires: 1});
}
success: function(json) {
/* g_supportELB: "guest" ips are allocated on guest network (so use 'forvirtualnetwork' = false)
* g_supportELB: "public" - ips are allocated on public network (so use 'forvirtualnetwork' = true)
* g_supportELB: "false" no ELB support
*/
g_supportELB = json.listcapabilitiesresponse.capability.supportELB.toString(); //convert boolean to string if it's boolean
$.cookie('supportELB', g_supportELB, { expires: 1});
g_firewallRuleUiEnabled = json.listcapabilitiesresponse.capability.firewallRuleUiEnabled.toString(); //convert boolean to string if it's boolean
$.cookie('firewallRuleUiEnabled', g_firewallRuleUiEnabled, { expires: 1});
if (json.listcapabilitiesresponse.capability.userpublictemplateenabled != null) {
g_userPublicTemplateEnabled = json.listcapabilitiesresponse.capability.userpublictemplateenabled.toString(); //convert boolean to string if it's boolean
$.cookie('userpublictemplateenabled', g_userPublicTemplateEnabled, { expires: 1});
}
if (json.listcapabilitiesresponse.capability.securitygroupsenabled != null) {
g_directAttachSecurityGroupsEnabled = json.listcapabilitiesresponse.capability.securitygroupsenabled.toString(); //convert boolean to string if it's boolean
$.cookie('directattachsecuritygroupsenabled', g_directAttachSecurityGroupsEnabled, { expires: 1});
}
buildSecondLevelNavigation();
$("#main_username").text(g_username);

View File

@ -213,7 +213,7 @@ function afterLoadIpJSP() {
//****** Advanced Zone (begin) *******************************************************************************************************************
else {
if(g_firewallRuleUiEnabled == true)
if(g_firewallRuleUiEnabled == "true")
$("#tab_firewall").show();
else
$("#tab_firewall").hide();
@ -471,7 +471,7 @@ function afterLoadIpJSP() {
array1.push("&endPort="+endPort);
array1.push("&protocol="+protocol);
if(g_firewallRuleUiEnabled == true)
if(g_firewallRuleUiEnabled == "true")
array1.push("&openfirewall=false");
$.ajax({
@ -612,7 +612,7 @@ function afterLoadIpJSP() {
var virtualMachineId = $createPortForwardingRow.find("#vm").val();
array1.push("&virtualmachineid=" + virtualMachineId);
if(g_firewallRuleUiEnabled == true)
if(g_firewallRuleUiEnabled == "true")
array1.push("&openfirewall=false");
$.ajax({
@ -718,7 +718,7 @@ function afterLoadIpJSP() {
var algorithm = createLoadBalancerRow.find("#algorithm_select").val();
array1.push("&algorithm="+algorithm);
if(g_firewallRuleUiEnabled == true)
if(g_firewallRuleUiEnabled == "true")
array1.push("&openfirewall=false");
$.ajax({
@ -847,7 +847,7 @@ function ipToRightPanel($midmenuItem1) {
$("#tab_details").click();
if(ipObj.isstaticnat == true) {
if(g_firewallRuleUiEnabled == true) {
if(g_firewallRuleUiEnabled == "true") {
$("#tab_firewall").show();
$("#tab_port_range").hide();
}
@ -861,7 +861,7 @@ function ipToRightPanel($midmenuItem1) {
$("#tab_port_range").hide();
if(ipObj.forvirtualnetwork == true) { // Public network
if(isIpManageable(ipObj.domainid, ipObj.account) == true) { // IP is managable
if(g_firewallRuleUiEnabled == true)
if(g_firewallRuleUiEnabled == "true")
$("#tab_firewall").show();
else
$("#tab_firewall").hide();
@ -1178,7 +1178,7 @@ function showEnableVPNDialog($thisTab) {
array1.push("&account="+ipObj.account);
array1.push("&domainid="+ipObj.domainid);
array1.push("&zoneid="+ipObj.zoneid);
if(g_firewallRuleUiEnabled == true)
if(g_firewallRuleUiEnabled == "true")
array1.push("&openfirewall=true");
$.ajax({