diff --git a/ui/jsp/resource.jsp b/ui/jsp/resource.jsp index 8581269751a..9c4b8c8651c 100644 --- a/ui/jsp/resource.jsp +++ b/ui/jsp/resource.jsp @@ -394,7 +394,9 @@
- Please enter the following info to add a new pod + Step 4: Add an IP range to public network in zone +
You have successfully added your first Zone and Pod. After clicking 'OK', this UI will automatically refresh to give you access to the rest of cloud features.
") - .dialog('option', 'buttons', { - "OK": function() { - window.location.reload(); - } - }).dialog("open"); - } + $("#pod_total").text(podTotal.toString()); }, error: function(XMLHttpResponse) { handleError(XMLHttpResponse, function() { @@ -1253,11 +1327,61 @@ function addZoneWizardSubmit($thisWizard) { }); } }); + // create pod (end) + + // add IP range to public network in zone (begin) + if($("input[name=basic_advanced]:checked").val() == "Advanced") { + var isDirect = false; + var isTagged = $thisWizard.find("#step4").find("#add_publicip_vlan_tagged").val() == "tagged"; + + var vlan = trim($thisWizard.find("#step4").find("#add_publicip_vlan_vlan").val()); + if (isTagged) { + vlan = "&vlan="+vlan; + } else { + vlan = "&vlan=untagged"; + } + + var scopeParams = ""; + if($thisWizard.find("#step4").find("#add_publicip_vlan_scope").val() == "account-specific") { + scopeParams = "&domainId="+trim($thisWizard.find("#step4").find("#add_publicip_vlan_domain").val())+"&account="+trim($thisWizard.find("#step4").find("#add_publicip_vlan_account").val()); + } else if (isDirect) { + scopeParams = "&isshared=true"; + } + + var array1 = []; + var gateway = $thisWizard.find("#step4").find("#add_publicip_vlan_gateway").val(); + array1.push("&gateway="+todb(gateway)); + + var netmask = $thisWizard.find("#step4").find("#add_publicip_vlan_netmask").val(); + array1.push("&netmask="+todb(netmask)); + + var startip = $thisWizard.find("#step4").find("#add_publicip_vlan_startip").val(); + array1.push("&startip="+todb(startip)); + + var endip = $thisWizard.find("#step4").find("#add_publicip_vlan_endip").val(); //optional field (might be empty) + if(endip != null && endip.length > 0) + array1.push("&endip="+todb(endip)); + + $.ajax({ + data: createURL("command=createVlanIpRange&forVirtualNetwork=true&zoneId="+zoneId+vlan+scopeParams+array1.join("")), + dataType: "json", + success: function(json) { + $thisWizard.find("#after_submit_screen").find("#add_iprange_tick_cross").removeClass().addClass("zonepopup_reviewtick"); + $thisWizard.find("#after_submit_screen").find("#add_iprange_message").removeClass().text("Public IP range was created successfully"); + var item = json.createvlaniprangeresponse.vlan; + vlanId = item.id; + }, + error: function(XMLHttpResponse) { + handleError(XMLHttpResponse, function() { + handleErrorInDialog(XMLHttpResponse, $thisWizard.find("#step4")); + }); + } + }); + } + // add IP range to public network in zone (end) } if(podId != null && $thisWizard.find("#step3").find("#guestip_container").css("display") != "none") { - $thisWizard.find("#after_submit_screen").find("#add_guestiprange_message_container").show(); - var netmask = $thisWizard.find("#step3").find("#guestnetmask").val(); var startip = $thisWizard.find("#step3").find("#startguestip").val(); var endip = $thisWizard.find("#step3").find("#endguestip").val(); @@ -1279,23 +1403,20 @@ function addZoneWizardSubmit($thisWizard) { dataType: "json", async: false, success: function(json) { - $thisWizard.find("#after_submit_screen").find("#add_guestiprange_tick_cross").removeClass().addClass("zonepopup_reviewtick"); - $thisWizard.find("#after_submit_screen").find("#add_guestiprange_message").removeClass().text("Guest IP range was created successfully"); + $thisWizard.find("#after_submit_screen").find("#add_iprange_tick_cross").removeClass().addClass("zonepopup_reviewtick"); + $thisWizard.find("#after_submit_screen").find("#add_iprange_message").removeClass().text("Guest IP range was created successfully"); var item = json.createvlaniprangeresponse.vlan; vlanId = item.id; }, error: function(XMLHttpResponse) { handleError(XMLHttpResponse, function() { - $thisWizard.find("#after_submit_screen").find("#add_guestiprange_tick_cross").removeClass().addClass("zonepopup_reviewcross"); - $thisWizard.find("#after_submit_screen").find("#add_guestiprange_message").removeClass().addClass("error").text(("Failed to create Guest IP range: " + parseXMLHttpResponse(XMLHttpResponse))); + $thisWizard.find("#after_submit_screen").find("#add_iprange_tick_cross").removeClass().addClass("zonepopup_reviewcross"); + $thisWizard.find("#after_submit_screen").find("#add_iprange_message").removeClass().addClass("error").text(("Failed to create Guest IP range: " + parseXMLHttpResponse(XMLHttpResponse))); }); } }); - } - else { - $thisWizard.find("#after_submit_screen").find("#add_guestiprange_message_container").hide(); - } + } $thisWizard.find("#spinning_wheel").hide(); }