mirror of https://github.com/apache/cloudstack.git
new UI - Add Zone and Pod Wizard - implement CreateVLAN.
This commit is contained in:
parent
3514d59f45
commit
63e84a94c4
|
|
@ -123,7 +123,7 @@
|
|||
<div class="zonepopup_selectionpanel">
|
||||
|
||||
<div class="zonepopup_selectionbox">
|
||||
<input type="radio" name="basic_advanced" value="basic_mode" id="basic_mode" class="radio" />
|
||||
<input type="radio" name="basic_advanced" value="basic_mode" id="basic_mode" class="radio" checked />
|
||||
<label class="label">
|
||||
Basic Mode</label>
|
||||
<div class="zonepopup_selectiondescriptionbox">
|
||||
|
|
@ -131,12 +131,13 @@
|
|||
</div>
|
||||
<div class="zonepopup_selectiondescriptionbox_bot">
|
||||
<p>
|
||||
Some decription about Basic Mode will appear here.. Some decription about Basic Mode will appear here.. Some decription about Basic Mode will appear here.. Some decription about Basic Mode will appear here.. Some decription about Basic Mode will appear here.. Some decription about Basic Mode will appear here..</p>
|
||||
Create VLAN when adding a pod
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="zonepopup_selectionbox">
|
||||
<input type="radio" name="basic_advanced" value="advanced_mode" id="advanced_mode" class="radio" checked />
|
||||
<input type="radio" name="basic_advanced" value="advanced_mode" id="advanced_mode" class="radio" />
|
||||
<label class="label">
|
||||
Advanced Mode</label>
|
||||
<div class="zonepopup_selectiondescriptionbox">
|
||||
|
|
@ -144,7 +145,8 @@
|
|||
</div>
|
||||
<div class="zonepopup_selectiondescriptionbox_bot">
|
||||
<p>
|
||||
Some decription about Advance Mode will appear here.. Some decription about Advance Mode will appear here.. Some decription about Advance Mode will appear here.. Some decription about Advance Mode will appear here.. Some decription about Advance Mode will appear here.. </p>
|
||||
Create VLAN when add a zone
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -214,7 +216,7 @@
|
|||
<div id="add_zone_internaldns2_errormsg" class="dialog_formcontent_errormsg" style="display:none;" ></div>
|
||||
</li>
|
||||
<li id="add_zone_vlan_container">
|
||||
<label>Zone VLAN Range:</label>
|
||||
<label>VLAN Range:</label>
|
||||
<input class="text" style="width:92px" type="text" name="add_zone_startvlan" id="add_zone_startvlan"/><span>-</span>
|
||||
<input class="text" style="width:92px" type="text" name="add_zone_endvlan" id="add_zone_endvlan"/>
|
||||
<div id="add_zone_startvlan_errormsg" class="dialog_formcontent_errormsg" style="display:none;" ></div>
|
||||
|
|
@ -317,6 +319,23 @@
|
|||
<div id="add_pod_endip_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</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;">
|
||||
</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;">
|
||||
</div>
|
||||
</li>
|
||||
</ol>
|
||||
</form>
|
||||
</div>
|
||||
|
|
@ -356,7 +375,7 @@
|
|||
<div class="zonepopup_contentpanel">
|
||||
<div id="spinning_wheel" class="zonepoup_loadingbox" style="display:none;">
|
||||
<div class="zonepoup_loader"></div>
|
||||
<p> Adding Zone to Physical Resources</p>
|
||||
<p> Adding zone and pod....</p>
|
||||
</div>
|
||||
|
||||
<div id="after_action_message" class="zonepoup_msgbox"></div>
|
||||
|
|
|
|||
|
|
@ -368,14 +368,16 @@ function initAddZoneShortcut() {
|
|||
break;
|
||||
|
||||
case "basic_mode": //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").hide();
|
||||
$thisWizard.find("#step3").find("#guestip_container, #guestnetmask_container").show();
|
||||
return true;
|
||||
break;
|
||||
|
||||
case "advanced_mode": //create VLAN in zone-level
|
||||
//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").show();
|
||||
$thisWizard.find("#step2").find("#add_zone_vlan_container").show();
|
||||
$thisWizard.find("#step3").find("#guestip_container, #guestnetmask_container").hide();
|
||||
return true;
|
||||
break;
|
||||
|
||||
|
|
@ -404,6 +406,8 @@ function initAddZoneShortcut() {
|
|||
|
||||
case "submit_button": //step 3 => make API call
|
||||
var isValid = addZoneWizardValidatePod($thisWizard);
|
||||
if($thisWizard.find("#step3").find("#guestip_container").css("display") != "none")
|
||||
isValid &= addZoneWizardValidateGuestIPRange($thisWizard);
|
||||
if (!isValid)
|
||||
return;
|
||||
|
||||
|
|
@ -425,8 +429,8 @@ function addZoneWizardValidateZond($thisWizard) {
|
|||
isValid &= validateIp("Internal DNS 1", $thisWizard.find("#add_zone_internaldns1"), $thisWizard.find("#add_zone_internaldns1_errormsg"), false); //required
|
||||
isValid &= validateIp("Internal DNS 2", $thisWizard.find("#add_zone_internaldns2"), $thisWizard.find("#add_zone_internaldns2_errormsg"), true); //optional
|
||||
if($thisWizard.find("#step2").find("#add_zone_vlan_container").css("display") != "none") {
|
||||
isValid &= validateString("Zone - Start VLAN Range", $thisWizard.find("#add_zone_startvlan"), $thisWizard.find("#add_zone_startvlan_errormsg"), false); //required
|
||||
isValid &= validateString("Zone - End VLAN Range", $thisWizard.find("#add_zone_endvlan"), $thisWizard.find("#add_zone_endvlan_errormsg"), true); //optional
|
||||
isValid &= validateString("VLAN Range", $thisWizard.find("#add_zone_startvlan"), $thisWizard.find("#add_zone_startvlan_errormsg"), false); //required
|
||||
isValid &= validateString("VLAN Range", $thisWizard.find("#add_zone_endvlan"), $thisWizard.find("#add_zone_endvlan_errormsg"), true); //optional
|
||||
}
|
||||
isValid &= validateCIDR("Guest CIDR", $thisWizard.find("#add_zone_guestcidraddress"), $thisWizard.find("#add_zone_guestcidraddress_errormsg"), false); //required
|
||||
return isValid;
|
||||
|
|
@ -436,9 +440,16 @@ function addZoneWizardValidatePod($thisWizard) {
|
|||
var isValid = true;
|
||||
isValid &= validateString("Name", $thisWizard.find("#add_pod_name"), $thisWizard.find("#add_pod_name_errormsg"));
|
||||
isValid &= validateCIDR("CIDR", $thisWizard.find("#add_pod_cidr"), $thisWizard.find("#add_pod_cidr_errormsg"));
|
||||
isValid &= validateIp("Start IP Range", $thisWizard.find("#add_pod_startip"), $thisWizard.find("#add_pod_startip_errormsg")); //required
|
||||
isValid &= validateIp("End IP Range", $thisWizard.find("#add_pod_endip"), $thisWizard.find("#add_pod_endip_errormsg"), true); //optional
|
||||
isValid &= validateIp("Gateway", $thisWizard.find("#add_pod_gateway"), $thisWizard.find("#add_pod_gateway_errormsg")); //required when creating
|
||||
isValid &= validateIp("Reserved System IP", $thisWizard.find("#add_pod_startip"), $thisWizard.find("#add_pod_startip_errormsg")); //required
|
||||
isValid &= validateIp("Reserved System IP", $thisWizard.find("#add_pod_endip"), $thisWizard.find("#add_pod_endip_errormsg"), true); //optional
|
||||
return isValid;
|
||||
}
|
||||
|
||||
function addZoneWizardValidateGuestIPRange($thisWizard) {
|
||||
var isValid = true;
|
||||
isValid &= validateIp("Guest IP Range", $thisWizard.find("#startguestip"), $thisWizard.find("#startguestip_errormsg")); //required
|
||||
isValid &= validateIp("Guest IP Range", $thisWizard.find("#endguestip"), $thisWizard.find("#endguestip_errormsg"), true); //optional
|
||||
isValid &= validateIp("Guest Gateway", $thisWizard.find("#guestnetmask"), $thisWizard.find("#guestnetmask_errormsg")); //required when creating
|
||||
return isValid;
|
||||
}
|
||||
|
||||
|
|
@ -471,7 +482,10 @@ function addZoneWizardSubmit($thisWizard) {
|
|||
moreCriteria.push("&vlan=" + encodeURIComponent(vlanStart + "-" + vlanEnd));
|
||||
else
|
||||
moreCriteria.push("&vlan=" + encodeURIComponent(vlanStart));
|
||||
}
|
||||
}
|
||||
else {
|
||||
moreCriteria.push("&vlan=30"); //temporary hacking before bug 7143 is fixed ("VLAN parameter in CreateZone shouldn't be required")
|
||||
}
|
||||
|
||||
var guestcidraddress = trim($thisWizard.find("#add_zone_guestcidraddress").val());
|
||||
moreCriteria.push("&guestcidraddress="+encodeURIComponent(guestcidraddress));
|
||||
|
|
@ -481,14 +495,14 @@ function addZoneWizardSubmit($thisWizard) {
|
|||
moreCriteria.push("&domainid="+domainId);
|
||||
}
|
||||
|
||||
var zoneId, $zoneNode, $podNode;
|
||||
var addZoneSuccessful=false, addPodSuccessful=false, addVLANSuccessful=false;
|
||||
var zoneId, podId, vlanId, $zoneNode, $podNode, gateway;
|
||||
var createZoneSuccessful = false, createPodSuccessful = false, createVLANSuccessful = false;
|
||||
$.ajax({
|
||||
data: createURL("command=createZone"+moreCriteria.join("")),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
addZoneSuccessful = true;
|
||||
success: function(json) {
|
||||
createZoneSuccessful = true;
|
||||
$thisWizard.find("#spinning_wheel").hide();
|
||||
|
||||
$zoneNode = $("#leftmenu_zone_node_template").clone(true);
|
||||
|
|
@ -513,7 +527,7 @@ function addZoneWizardSubmit($thisWizard) {
|
|||
var cidr = trim($thisWizard.find("#add_pod_cidr").val());
|
||||
var startip = trim($thisWizard.find("#add_pod_startip").val());
|
||||
var endip = trim($thisWizard.find("#add_pod_endip").val()); //optional
|
||||
var gateway = trim($thisWizard.find("#add_pod_gateway").val());
|
||||
gateway = trim($thisWizard.find("#add_pod_gateway").val());
|
||||
|
||||
var array1 = [];
|
||||
array1.push("&zoneId="+zoneId);
|
||||
|
|
@ -525,13 +539,15 @@ function addZoneWizardSubmit($thisWizard) {
|
|||
array1.push("&gateway="+encodeURIComponent(gateway));
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=createPod"+array1.join("")),
|
||||
data: createURL("command=createPod"+array1.join("")),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
addPodSuccessful = true;
|
||||
async: false,
|
||||
success: function(json) {
|
||||
createPodSuccessful = true;
|
||||
$thisWizard.find("#spinning_wheel").hide();
|
||||
|
||||
var item = json.createpodresponse.pod;
|
||||
var item = json.createpodresponse.pod;
|
||||
podId = item.id;
|
||||
$podNode = $("#leftmenu_pod_node_template").clone(true);
|
||||
podJSONToTreeNode(item, $podNode);
|
||||
$zoneNode.find("#zone_content").show();
|
||||
|
|
@ -558,15 +574,56 @@ function addZoneWizardSubmit($thisWizard) {
|
|||
});
|
||||
}
|
||||
|
||||
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 array1 = [];
|
||||
array1.push("&vlan=untagged");
|
||||
array1.push("&zoneid=" + zoneId);
|
||||
array1.push("&podId=" + podId);
|
||||
array1.push("&forVirtualNetwork=false"); //direct VLAN
|
||||
array1.push("&gateway="+encodeURIComponent(gateway));
|
||||
array1.push("&netmask="+encodeURIComponent(netmask));
|
||||
array1.push("&startip="+encodeURIComponent(startip));
|
||||
if(endip != null && endip.length > 0)
|
||||
array1.push("&endip="+encodeURIComponent(endip));
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=createVlanIpRange" + array1.join("")),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
createVLANSuccessful = true;
|
||||
var item = json.createvlaniprangeresponse.vlan;
|
||||
vlanId = item.id;
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
handleError(XMLHttpResponse, function() {
|
||||
handleErrorInDialog(XMLHttpResponse, $thisWizard);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var afterActionMsg = "";
|
||||
if(addZoneSuccessful = true)
|
||||
afterActionMsg += "Zone was adding successfully<br>";
|
||||
if(createZoneSuccessful)
|
||||
afterActionMsg += "Zone was created successfully<br>";
|
||||
else
|
||||
afterActionMsg += "failed to add zone<br>";
|
||||
if(addPodSuccessful = true)
|
||||
afterActionMsg += "Pod was adding successfully<br>";
|
||||
afterActionMsg += "failed to create zone<br>";
|
||||
|
||||
if(createPodSuccessful)
|
||||
afterActionMsg += "Pod was created successfully<br>";
|
||||
else
|
||||
afterActionMsg += "failed to add pod<br>";
|
||||
afterActionMsg += "failed to create pod<br>";
|
||||
|
||||
if($thisWizard.find("#step3").find("#guestip_container").css("display") != "none") {
|
||||
if(createVLANSuccessful)
|
||||
afterActionMsg += "Guest IP range was created successfully<br>";
|
||||
else
|
||||
afterActionMsg += "failed to create Guest IP range<br>";
|
||||
}
|
||||
|
||||
$thisWizard.find("#after_action_message").html(afterActionMsg);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue