mirror of https://github.com/apache/cloudstack.git
bug 7038: Pod page - has option to Add Direct IP Range if its zone is basic-mode.
This commit is contained in:
parent
927981794c
commit
c88ead415f
|
|
@ -380,4 +380,49 @@
|
|||
(info)</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Add VLAN IP Range Dialog for pod (begin) -->
|
||||
<div id="dialog_add_vlan_for_pod" title="Add Direct IP Range" style="display:none">
|
||||
<p>Please enter the following info to add a new direct IP range on untagged VLAN to pod: <b><span id="pod_name_label"></span></b></p>
|
||||
<div class="dialog_formcontent">
|
||||
<form action="#" method="post" id="form5">
|
||||
<ol>
|
||||
<li>
|
||||
<label for="gateway">Gateway:</label>
|
||||
<input class="text" type="text" id="gateway"/>
|
||||
<div id="gateway_errormsg" class="dialog_formcontent_errormsg" style="display:none;" ></div>
|
||||
</li>
|
||||
<li>
|
||||
<label for="netmask">Netmask:</label>
|
||||
<input class="text" type="text" id="netmask"/>
|
||||
<div id="netmask_errormsg" class="dialog_formcontent_errormsg" style="display:none;" ></div>
|
||||
</li>
|
||||
<li>
|
||||
<label>IP Range:</label>
|
||||
<input class="text" style="width:67px" type="text" id="startip"/><span>-</span>
|
||||
<input class="text" style="width:67px" type="text" id="endip"/>
|
||||
<div id="startip_errormsg" class="dialog_formcontent_errormsg" style="display:none;" ></div>
|
||||
<div id="endip_errormsg" class="dialog_formcontent_errormsg" style="display:none;" ></div>
|
||||
</li>
|
||||
</ol>
|
||||
</form>
|
||||
</div>
|
||||
<!--Loading box-->
|
||||
<div id="spinning_wheel" class="ui_dialog_loaderbox" style="display: none;">
|
||||
<div class="ui_dialog_loader">
|
||||
</div>
|
||||
<p>
|
||||
Adding....</p>
|
||||
</div>
|
||||
<!--Confirmation msg box-->
|
||||
<!--Note: for error msg, just have to add error besides everything for eg. add error(class) next to ui_dialog_messagebox error, ui_dialog_msgicon error, ui_dialog_messagebox_text error. -->
|
||||
<div id="info_container" class="ui_dialog_messagebox error" style="display: none;">
|
||||
<div id="icon" class="ui_dialog_msgicon error">
|
||||
</div>
|
||||
<div id="info" class="ui_dialog_messagebox_text error">
|
||||
(info)</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Add VLAN IP Range Dialog for pod (end) -->
|
||||
<!-- ***** dialogs (begin) ***** -->
|
||||
|
|
|
|||
|
|
@ -91,10 +91,14 @@ function podJsonToDetailsTab() {
|
|||
}
|
||||
}
|
||||
});
|
||||
if(zoneVlan == null) //basic network (VLAN in pod-level)
|
||||
if(zoneVlan == null) { //basic-mode network (pod-wide VLAN)
|
||||
$("#tab_network").show();
|
||||
else //advanced network (VLAN in zone-level)
|
||||
initAddPodVLANButton($("#midmenu_add3_link")); //???
|
||||
}
|
||||
else { //advanced-mode network (zone-wide VLAN)
|
||||
$("#tab_network").hide();
|
||||
$("#midmenu_add3_link").unbind("click").hide();
|
||||
}
|
||||
|
||||
|
||||
//actions ***
|
||||
|
|
@ -296,7 +300,7 @@ function initAddHostButton($midmenuAddLink1, currentPageInRightPanel) {
|
|||
if (!isValid)
|
||||
return;
|
||||
|
||||
$thisDialog.find("#spinning_wheel").show()
|
||||
$thisDialog.find("#spinning_wheel").show();
|
||||
|
||||
var array1 = [];
|
||||
array1.push("&zoneId="+zoneId);
|
||||
|
|
@ -397,8 +401,7 @@ function initAddPrimaryStorageButton($midmenuAddLink2, currentPageInRightPanel)
|
|||
|
||||
var zoneId, podId, sourceClusterId;
|
||||
if(currentPageInRightPanel == "pod_page") {
|
||||
var podObj = $("#tab_content_details").data("jsonObj");
|
||||
var podObj = $("#tab_content_details").data("jsonObj");
|
||||
var podObj = $("#tab_content_details").data("jsonObj");
|
||||
zoneId = podObj.zoneid;
|
||||
podId = podObj.id;
|
||||
dialogAddPool.find("#zone_name").text(fromdb(podObj.zonename));
|
||||
|
|
@ -539,6 +542,83 @@ function initAddPrimaryStorageButton($midmenuAddLink2, currentPageInRightPanel)
|
|||
});
|
||||
}
|
||||
|
||||
function initAddPodVLANButton($button) {
|
||||
initDialog("dialog_add_vlan_for_pod");
|
||||
|
||||
$button.find("#label").text("Add Direct IP Range");
|
||||
$button.show();
|
||||
$button.unbind("click").bind("click", function(event) {
|
||||
$("#tab_network").click();
|
||||
|
||||
var podObj = $("#tab_content_details").data("jsonObj");
|
||||
var zoneId = podObj.zoneid;
|
||||
var podId = podObj.id;
|
||||
var podName = podObj.name;
|
||||
|
||||
$("#dialog_add_vlan_for_pod").find("#pod_name_label").text(podName);
|
||||
|
||||
$("#dialog_add_vlan_for_pod")
|
||||
.dialog('option', 'buttons', {
|
||||
"Add": function() {
|
||||
var $thisDialog = $(this);
|
||||
|
||||
// validate values
|
||||
var isValid = true;
|
||||
isValid &= validateIp("Gateway", $thisDialog.find("#gateway"), $thisDialog.find("#gateway_errormsg"));
|
||||
isValid &= validateIp("Netmask", $thisDialog.find("#netmask"), $thisDialog.find("#netmask_errormsg"));
|
||||
isValid &= validateIp("Start IP Range", $thisDialog.find("#startip"), $thisDialog.find("#startip_errormsg")); //required
|
||||
isValid &= validateIp("End IP Range", $thisDialog.find("#endip"), $thisDialog.find("#endip_errormsg"), true); //optional
|
||||
if (!isValid)
|
||||
return;
|
||||
|
||||
$thisDialog.find("#spinning_wheel").show();
|
||||
|
||||
var gateway = trim($thisDialog.find("#gateway").val());
|
||||
var netmask = trim($thisDialog.find("#netmask").val());
|
||||
var startip = trim($thisDialog.find("#startip").val());
|
||||
var endip = trim($thisDialog.find("#endip").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) {
|
||||
$thisDialog.find("#spinning_wheel").hide();
|
||||
$thisDialog.dialog("close");
|
||||
|
||||
var item = json.createvlaniprangeresponse.vlan;
|
||||
var $subgridItem = $("#network_tab_template").clone(true);
|
||||
podNetworkJsonToTemplate(item, $subgridItem);
|
||||
$subgridItem.find("#after_action_info").text("Direct VLAN was added successfully.");
|
||||
$subgridItem.find("#after_action_info_container").removeClass("error").addClass("success").show();
|
||||
$("#tab_content_network").find("#tab_container").append($subgridItem.fadeIn("slow"));
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
handleError(XMLHttpResponse, function() {
|
||||
handleErrorInDialog(XMLHttpResponse, $thisDialog);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}).dialog("open");
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
function nfsURL(server, path) {
|
||||
var url;
|
||||
if(server.indexOf("://")==-1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue