Add Zone Wizard - basic mode - move Add Guest IP Range section from step3(createPod) to step4(AddIPRange).

This commit is contained in:
Jessica Wang 2011-01-06 10:33:06 -08:00
parent 49e2e6776e
commit a804b1283f
2 changed files with 93 additions and 100 deletions

View File

@ -361,31 +361,7 @@
</div> </div>
<div id="add_pod_endip_errormsg" class="dialog_formcontent_errormsg" style="display: none; "> <div id="add_pod_endip_errormsg" class="dialog_formcontent_errormsg" style="display: none; ">
</div> </div>
</li> </li>
<li id="guestip_container">
<label style="width: 115px;">
Guest IP Range:</label>
<input class="text" style="width: 92px" type="text" id="startguestip" /><span>-</span>
<input class="text" style="width: 92px" type="text" id="endguestip" />
<div id="startguestip_errormsg" class="dialog_formcontent_errormsg" style="display: none; margin-left:133px;">
</div>
<div id="endguestip_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li id="guestnetmask_container">
<label style="width: 115px;">
Guest Netmask:</label>
<input class="text" type="text" id="guestnetmask" />
<div id="guestnetmask_errormsg" class="dialog_formcontent_errormsg" style="display: none; margin-left:0;">
</div>
</li>
<li id="guestgateway_container">
<label style="width: 115px;">
Guest Gateway:</label>
<input class="text" type="text" id="guestgateway" />
<div id="guestgateway_errormsg" class="dialog_formcontent_errormsg" style="display: none; margin-left:0;">
</div>
</li>
</ol> </ol>
</form> </form>
</div> </div>
@ -394,11 +370,8 @@
<div class="vmpop_prevbutton" id="back_to_step_2" style="display: block;"> <div class="vmpop_prevbutton" id="back_to_step_2" style="display: block;">
Back Back
</div> </div>
<div class="vmpop_nextbutton" id="go_to_step_4" style="display: none;"> <div class="vmpop_nextbutton" id="go_to_step_4" style="display: block;">
Go to Step 4</div> Go to Step 4</div>
<div class="vmpop_nextbutton" id="submit_in_step3" style="display: block;">
Submit
</div>
</div> </div>
</div> </div>
</div> </div>
@ -427,14 +400,40 @@
<div class="zonepopup_maincontentarea"> <div class="zonepopup_maincontentarea">
<div class="zonepopup_titlebox"> <div class="zonepopup_titlebox">
<h2> <h2>
Step 4: <strong>Add an IP range to public network in zone</strong></h2> Step 4: <strong>Add an IP range</strong></h2>
<p> <p>
</p> </p>
</div> </div>
<div class="zonepopup_contentpanel"> <div class="zonepopup_contentpanel">
<div class="zonepoup_formcontent"> <div class="zonepoup_formcontent">
<form action="#" method="post" id="form_acquire"> <form action="#" method="post" id="form_acquire">
<ol> <ol id="guestip_list">
<li id="guestip_container">
<label style="width: 115px;">
Guest IP Range:</label>
<input class="text" style="width: 92px" type="text" id="startguestip" /><span>-</span>
<input class="text" style="width: 92px" type="text" id="endguestip" />
<div id="startguestip_errormsg" class="dialog_formcontent_errormsg" style="display: none; margin-left:133px;">
</div>
<div id="endguestip_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li id="guestnetmask_container">
<label style="width: 115px;">
Guest Netmask:</label>
<input class="text" type="text" id="guestnetmask" />
<div id="guestnetmask_errormsg" class="dialog_formcontent_errormsg" style="display: none; margin-left:0;">
</div>
</li>
<li id="guestgateway_container">
<label style="width: 115px;">
Guest Gateway:</label>
<input class="text" type="text" id="guestgateway" />
<div id="guestgateway_errormsg" class="dialog_formcontent_errormsg" style="display: none; margin-left:0;">
</div>
</li>
</ol>
<ol id="publicip_list" style="display:none">
<li id="add_publicip_vlan_container"> <li id="add_publicip_vlan_container">
<label for="add_publicip_vlan_tagged"> <label for="add_publicip_vlan_tagged">
VLAN:</label> VLAN:</label>
@ -516,10 +515,10 @@
<div class="zonepopup_navigationpanel"> <div class="zonepopup_navigationpanel">
<div class="vmpop_prevbutton" id="back_to_step_3" style="display: block;"> <div class="vmpop_prevbutton" id="back_to_step_3" style="display: block;">
Back Back
</div> </div>
<div class="vmpop_nextbutton" id="submit_in_step4" style="display: block;"> <div class="vmpop_nextbutton" id="submit" style="display: block;">
Submit Submit
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1065,18 +1065,20 @@ function initAddZoneWizard() {
case "Basic": //create VLAN in pod-level case "Basic": //create VLAN in pod-level
//hide Zone VLAN Range in Add Zone(step 2), show Guest IP Range in Add Pod(step3) //hide Zone VLAN Range in Add Zone(step 2), show Guest IP Range in Add Pod(step3)
$thisWizard.find("#step2").find("#add_zone_vlan_container, #add_zone_guestcidraddress_container").hide(); $thisWizard.find("#step2").find("#add_zone_vlan_container, #add_zone_guestcidraddress_container").hide();
$thisWizard.find("#step3").find("#guestip_container, #guestnetmask_container, #guestgateway_container, #submit_in_step3").show();
$thisWizard.find("#step3").find("#go_to_step_4").hide(); //$thisWizard.find("#step3").find("#guestip_container, #guestnetmask_container, #guestgateway_container").show();
$thisWizard.find("#step4").find("#guestip_list").show();
$thisWizard.find("#step4").find("#publicip_list").hide();
return true; return true;
break; break;
case "Advanced": //create VLAN in zone-level case "Advanced": //create VLAN in zone-level
//show Zone VLAN Range in Add Zone(step 2), hide Guest IP Range in Add Pod(step3) //show Zone VLAN Range in Add Zone(step 2), hide Guest IP Range in Add Pod(step3)
$thisWizard.find("#step2").find("#add_zone_vlan_container, #add_zone_guestcidraddress_container").show(); $thisWizard.find("#step2").find("#add_zone_vlan_container, #add_zone_guestcidraddress_container").show();
$thisWizard.find("#step3").find("#guestip_container, #guestnetmask_container, #guestgateway_container, #submit_in_step3").hide();
$thisWizard.find("#step3").find("#go_to_step_4").show(); //$thisWizard.find("#step3").find("#guestip_container, #guestnetmask_container, #guestgateway_container").hide();
$thisWizard.find("#step4").find("#guestip_list").hide();
// default value of "#add_publicip_vlan_scope" is "zone-wide". Calling change() will hide "#add_publicip_vlan_domain_container", "#add_publicip_vlan_account_container". $thisWizard.find("#step4").find("#publicip_list").show();
$addZoneWizard.find("#step4").find("#add_publicip_vlan_scope").change(); $addZoneWizard.find("#step4").find("#add_publicip_vlan_scope").change();
return true; return true;
@ -1135,9 +1137,7 @@ function initAddZoneWizard() {
break; break;
case "go_to_step_4": //step 3 => step 4 case "go_to_step_4": //step 3 => step 4
var isValid = addZoneWizardValidatePod($thisWizard); var isValid = addZoneWizardValidatePod($thisWizard);
if($thisWizard.find("#step3").find("#guestip_container").css("display") != "none")
isValid &= addZoneWizardValidateGuestIPRange($thisWizard);
if (!isValid) if (!isValid)
return; return;
@ -1159,28 +1159,20 @@ function initAddZoneWizard() {
$thisWizard.find("#step2").hide(); $thisWizard.find("#step2").hide();
$thisWizard.find("#step1").show(); $thisWizard.find("#step1").show();
break; break;
case "submit_in_step3": //step 3 => make API call case "submit": //step 4 => make API call
var isValid = addZoneWizardValidatePod($thisWizard); var isValid = true;
if($thisWizard.find("#step3").find("#guestip_container").css("display") != "none") if($thisWizard.find("#step4").find("#guestip_list").css("display") != "none")
isValid &= addZoneWizardValidateGuestIPRange($thisWizard); isValid = addZoneWizardValidateGuestIPRange($thisWizard);
if (!isValid) if($thisWizard.find("#step4").find("#publicip_list").css("display") != "none")
return; isValid &= addZoneWizardValidatePublicIPRange($thisWizard);
$thisWizard.find("#step3").hide();
$thisWizard.find("#after_submit_screen").show();
addZoneWizardSubmit($thisWizard);
break;
case "submit_in_step4": //step 4 => make API call
var isValid = addZoneWizardValidatePublicIPRange($thisWizard);
if (!isValid) if (!isValid)
return; return;
$thisWizard.find("#step4").hide(); $thisWizard.find("#step4").hide();
$thisWizard.find("#after_submit_screen").show(); $thisWizard.find("#after_submit_screen").show();
addZoneWizardSubmit($thisWizard); addZoneWizardSubmit($thisWizard);
break; break;
} }
return false; return false;
}); });
@ -1368,8 +1360,47 @@ function addZoneWizardSubmit($thisWizard) {
}); });
// create pod (end) // create pod (end)
// add IP range to public network in zone (begin) // add guest IP range to basic zone (begin)
if(networktype == "Advanced") { if($thisWizard.find("#step4").find("#guestip_list").css("display") != "none") {
var netmask = $thisWizard.find("#step4").find("#guestip_list").find("#guestnetmask").val();
var startip = $thisWizard.find("#step4").find("#guestip_list").find("#startguestip").val();
var endip = $thisWizard.find("#step4").find("#guestip_list").find("#endguestip").val();
var guestgateway = $thisWizard.find("#step4").find("#guestip_list").find("#guestgateway").val();
var array1 = [];
array1.push("&vlan=untagged");
array1.push("&zoneid=" + zoneId);
array1.push("&podId=" + podId);
array1.push("&forVirtualNetwork=false"); //direct VLAN
array1.push("&gateway="+todb(guestgateway));
array1.push("&netmask="+todb(netmask));
array1.push("&startip="+todb(startip));
if(endip != null && endip.length > 0)
array1.push("&endip="+todb(endip));
$.ajax({
data: createURL("command=createVlanIpRange" + array1.join("")),
dataType: "json",
async: false,
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("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_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)));
});
}
});
}
// add guest IP range to basic zone (end)
// add public IP range to basic zone (begin)
if($thisWizard.find("#step4").find("#publicip_list").css("display") != "none") {
var isDirect = false; var isDirect = false;
var isTagged = $thisWizard.find("#step4").find("#add_publicip_vlan_tagged").val() == "tagged"; var isTagged = $thisWizard.find("#step4").find("#add_publicip_vlan_tagged").val() == "tagged";
@ -1419,46 +1450,9 @@ function addZoneWizardSubmit($thisWizard) {
} }
}); });
} }
// add IP range to public network in zone (end) // add public IP range to basic zone (end)
} }
if(podId != null && $thisWizard.find("#step3").find("#guestip_container").css("display") != "none") {
var netmask = $thisWizard.find("#step3").find("#guestnetmask").val();
var startip = $thisWizard.find("#step3").find("#startguestip").val();
var endip = $thisWizard.find("#step3").find("#endguestip").val();
var guestgateway = $thisWizard.find("#step3").find("#guestgateway").val();
var array1 = [];
array1.push("&vlan=untagged");
array1.push("&zoneid=" + zoneId);
array1.push("&podId=" + podId);
array1.push("&forVirtualNetwork=false"); //direct VLAN
array1.push("&gateway="+todb(guestgateway));
array1.push("&netmask="+todb(netmask));
array1.push("&startip="+todb(startip));
if(endip != null && endip.length > 0)
array1.push("&endip="+todb(endip));
$.ajax({
data: createURL("command=createVlanIpRange" + array1.join("")),
dataType: "json",
async: false,
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("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_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)));
});
}
});
}
$thisWizard.find("#after_submit_screen").find("#spinning_wheel").hide(); $thisWizard.find("#after_submit_screen").find("#spinning_wheel").hide();
} }