mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01:00
bug 7448: zone tree - network - implement Add IP Range for direct network.
This commit is contained in:
parent
157156dd35
commit
8d87271dad
@ -572,6 +572,47 @@
|
||||
</div>
|
||||
<!-- Add IP Range for public netework dialog (end) -->
|
||||
|
||||
<!-- Add IP Range for direct netework dialog (begin) -->
|
||||
<div id="dialog_add_iprange_to_directnetwork" title="Add IP Range to Direct Network" style="display: none">
|
||||
<p>
|
||||
Add an IP range to direct network <b><span id="directnetwork_name"></span></b> in zone <b><span id="zone_name"></span></b>
|
||||
</p>
|
||||
<div class="dialog_formcontent">
|
||||
<form action="#" method="post" id="form_acquire">
|
||||
<ol>
|
||||
<li>
|
||||
<label for="user_name">
|
||||
IP Range:</label>
|
||||
<input class="text" style="width: 67px" type="text" name="add_publicip_vlan_startip"
|
||||
id="add_publicip_vlan_startip" /><span>-</span>
|
||||
<input class="text" style="width: 67px" type="text" name="add_publicip_vlan_endip"
|
||||
id="add_publicip_vlan_endip" />
|
||||
<div id="add_publicip_vlan_startip_errormsg" class="dialog_formcontent_errormsg"
|
||||
style="display: none;">
|
||||
</div>
|
||||
<div id="add_publicip_vlan_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 IP Range for direct netework dialog (end) -->
|
||||
|
||||
<!-- Add network dialog for zone (begin) -->
|
||||
<div id="dialog_add_network_for_zone" title="Add Network" style="display: none">
|
||||
|
||||
@ -99,7 +99,7 @@ function publicNetworkToMidmenu(jsonObj, $midmenuItem1) {
|
||||
*/
|
||||
|
||||
$midmenuItem1.find("#first_row").text("Public Network");
|
||||
$midmenuItem1.find("#second_row").text("Network ID: " + fromdb(jsonObj.id));
|
||||
$midmenuItem1.find("#second_row").text("VLAN: multiple");
|
||||
}
|
||||
|
||||
function publicNetworkToRightPanel($midmenuItem1) {
|
||||
@ -514,7 +514,7 @@ function directNetworkToMidmenu(jsonObj, $midmenuItem1) {
|
||||
*/
|
||||
|
||||
$midmenuItem1.find("#first_row").text(fromdb(jsonObj.name).substring(0,25));
|
||||
$midmenuItem1.find("#second_row").text("VLAN ID: " + fromdb(jsonObj.vlan));
|
||||
$midmenuItem1.find("#second_row").text("VLAN : " + fromdb(jsonObj.vlan));
|
||||
}
|
||||
|
||||
function directNetworkToRightPanel($midmenuItem1) {
|
||||
@ -522,6 +522,8 @@ function directNetworkToRightPanel($midmenuItem1) {
|
||||
$("#right_panel_content").data("$midmenuItem1", $midmenuItem1);
|
||||
|
||||
$("#direct_network_page").show();
|
||||
initAddIpRangeToDirectNetworkButton($("#midmenu_add_iprange_button"), $midmenuItem1);
|
||||
|
||||
$("#public_network_page").hide();
|
||||
|
||||
$("#direct_network_page").find("#tab_details").click();
|
||||
@ -874,5 +876,62 @@ function initAddNetworkButton($button) {
|
||||
});
|
||||
}
|
||||
|
||||
function initAddIpRangeToDirectNetworkButton($button, $midmenuItem1) {
|
||||
var jsonObj = $midmenuItem1.data("jsonObj");
|
||||
initDialog("dialog_add_iprange_to_directnetwork");
|
||||
var $dialogAddIpRangeToDirectNetwork = $("#dialog_add_iprange_to_directnetwork");
|
||||
|
||||
$dialogAddIpRangeToDirectNetwork.find("#directnetwork_name").text(fromdb(jsonObj.name));
|
||||
$dialogAddIpRangeToDirectNetwork.find("#zone_name").text(fromdb(zoneObj.name));
|
||||
|
||||
$button.show();
|
||||
$button.unbind("click").bind("click", function(event) {
|
||||
$("#direct_network_page").find("#tab_ipallocation").click();
|
||||
//$dialogAddIpRangeToDirectNetwork.find("#add_publicip_vlan_startip, #add_publicip_vlan_endip").val("");
|
||||
|
||||
$dialogAddIpRangeToDirectNetwork
|
||||
.dialog('option', 'buttons', {
|
||||
"Add": function() {
|
||||
var $thisDialog = $(this);
|
||||
|
||||
// validate values
|
||||
var isValid = true;
|
||||
isValid &= validateIp("Start IP Range", $thisDialog.find("#add_publicip_vlan_startip"), $thisDialog.find("#add_publicip_vlan_startip_errormsg")); //required
|
||||
isValid &= validateIp("End IP Range", $thisDialog.find("#add_publicip_vlan_endip"), $thisDialog.find("#add_publicip_vlan_endip_errormsg"), true); //optional
|
||||
if (!isValid)
|
||||
return;
|
||||
|
||||
$thisDialog.find("#spinning_wheel").show()
|
||||
|
||||
var startip = trim($thisDialog.find("#add_publicip_vlan_startip").val());
|
||||
var endip = trim($thisDialog.find("#add_publicip_vlan_endip").val());
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=createVlanIpRange&forVirtualNetwork=false&networkid="+todb(jsonObj.id)+"&startip="+todb(startip)+"&endip="+todb(endip)),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
$thisDialog.find("#spinning_wheel").hide();
|
||||
$thisDialog.dialog("close");
|
||||
|
||||
var item = json.createvlaniprangeresponse.vlan;
|
||||
var $newTemplate = $("#iprange_template").clone();
|
||||
directNetworkIprangeJsonToTemplate(item, $newTemplate);
|
||||
$("#right_panel_content #direct_network_page #tab_content_ipallocation").find("#tab_container").append($newTemplate.show());
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
handleError(XMLHttpResponse, function() {
|
||||
handleErrorInDialog(XMLHttpResponse, $thisDialog);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}).dialog("open");
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
//***** Direct Network (end) ******************************************************************************************************
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user