mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
bug 7458: zone - network - implement Add External Firewall.
This commit is contained in:
parent
6cff798082
commit
b724ff8cfa
@ -271,12 +271,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actionpanel_button_wrapper" id="midmenu_add_directIpRange_button" style="display: none;">
|
||||
<div class="actionpanel_button_wrapper" id="midmenu_add_external_firewall_button" style="display: none;">
|
||||
<div class="actionpanel_button">
|
||||
<div class="actionpanel_button_icons">
|
||||
<img src="images/addvm_actionicon.png" alt="Add Direct IP Range" /></div>
|
||||
<div class="actionpanel_button_links" id="Div10">
|
||||
<fmt:message key="label.add.direct.iprange"/>
|
||||
Add Firewall
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -563,6 +563,87 @@
|
||||
</div>
|
||||
<!-- Add IP Range for public netework dialog (end) -->
|
||||
|
||||
|
||||
<!-- Add External Firewall (begin) -->
|
||||
<div id="dialog_add_external_firewall" title="Add Firewall" style="display: none">
|
||||
<p>
|
||||
Add firewall for zone: <b><span id="zone_name"></span></b>
|
||||
</p>
|
||||
<div class="dialog_formcontent">
|
||||
<form action="#" method="post" id="form_acquire">
|
||||
<ol>
|
||||
<li>
|
||||
<label>
|
||||
IP:</label>
|
||||
<input class="text" type="text" id="ip" />
|
||||
<div id="ip_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
User name:</label>
|
||||
<input class="text" type="text" id="username" />
|
||||
<div id="username_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
Password:</label>
|
||||
<input class="text" type="password" id="password" autocomplete="off" />
|
||||
<div id="password_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<label>
|
||||
Public Interface:</label>
|
||||
<input class="text" type="text" id="public_interface" />
|
||||
<div id="public_interface_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
Private Interface:</label>
|
||||
<input class="text" type="text" id="private_interface" />
|
||||
<div id="private_interface_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
Public Zone:</label>
|
||||
<input class="text" type="text" id="public_zone" />
|
||||
<div id="public_zone_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
Private Zone:</label>
|
||||
<input class="text" type="text" id="private_zone" />
|
||||
<div id="private_zone_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 External Firewall (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>
|
||||
|
||||
@ -572,7 +572,7 @@ function clearAddButtonsOnTop() {
|
||||
$("#midmenu_add_vlan_button").unbind("click").hide();
|
||||
$("#midmenu_add_network_button").unbind("click").hide();
|
||||
$("#midmenu_add_iprange_button").unbind("click").hide();
|
||||
$("#midmenu_add_directIpRange_button").unbind("click").hide();
|
||||
$("#midmenu_add_external_firewall_button").unbind("click").hide();
|
||||
$("#midmenu_Update_SSL_Certificate_button").unbind("click").hide();
|
||||
|
||||
$("#midmenu_startvm_link").unbind("click").hide();
|
||||
|
||||
@ -108,6 +108,7 @@ function publicNetworkToRightPanel($midmenuItem1) {
|
||||
|
||||
$("#public_network_page").show();
|
||||
initAddIpRangeToPublicNetworkButton($("#midmenu_add_iprange_button"), $midmenuItem1);
|
||||
initAddExternalFirewallButton($("#midmenu_add_external_firewall_button"), $midmenuItem1);
|
||||
|
||||
$("#direct_network_page").hide();
|
||||
|
||||
@ -436,6 +437,141 @@ function initAddIpRangeToPublicNetworkButton($button, $midmenuItem1) {
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
function initAddExternalFirewallButton($button, $midmenuItem1) {
|
||||
var jsonObj = $midmenuItem1.data("jsonObj");
|
||||
|
||||
initDialog("dialog_add_external_firewall");
|
||||
|
||||
var $dialogAddExternalFirewall = $("#dialog_add_external_firewall");
|
||||
|
||||
$button.show();
|
||||
$button.unbind("click").bind("click", function(event) {
|
||||
if($("#public_network_page").find("#tab_content_firewall").css("display") == "none")
|
||||
$("#public_network_page").find("#tab_firewall").click();
|
||||
|
||||
$dialogAddExternalFirewall.find("#info_container").hide();
|
||||
$dialogAddExternalFirewall.find("#zone_name").text(fromdb(zoneObj.name));
|
||||
|
||||
$dialogAddExternalFirewall
|
||||
.dialog('option', 'buttons', {
|
||||
"Add": function() {
|
||||
var $thisDialog = $(this);
|
||||
|
||||
// validate values
|
||||
var isValid = true;
|
||||
isValid &= validateString("IP", $thisDialog.find("#ip"), $thisDialog.find("#ip_errormsg"), false); //required
|
||||
isValid &= validateString("User Name", $thisDialog.find("#username"), $thisDialog.find("#username_errormsg"), false); //required
|
||||
isValid &= validateString("Password", $thisDialog.find("#password"), $thisDialog.find("#password_errormsg"), false); //required
|
||||
isValid &= validateString("Public Interface", $thisDialog.find("#public_interface"), $thisDialog.find("#public_interface_errormsg"), true); //optinal
|
||||
isValid &= validateString("Private Interface", $thisDialog.find("#private_interface"), $thisDialog.find("#private_interface_errormsg"), true); //optinal
|
||||
isValid &= validateString("Public Zone", $thisDialog.find("#public_zone"), $thisDialog.find("#public_zone_errormsg"), true); //optinal
|
||||
isValid &= validateString("Private Zone", $thisDialog.find("#private_zone"), $thisDialog.find("#private_zone_errormsg"), true); //optinal
|
||||
if (!isValid)
|
||||
return;
|
||||
|
||||
$thisDialog.find("#spinning_wheel").show()
|
||||
|
||||
var array1 = [];
|
||||
|
||||
array1.push("&zoneid=" + zoneObj.id);
|
||||
|
||||
var username = $thisDialog.find("#username").val();
|
||||
array1.push("&username="+username);
|
||||
|
||||
var password = $thisDialog.find("#password").val();
|
||||
array1.push("&password="+password);
|
||||
|
||||
//*** construct URL (begin) ***
|
||||
var url = [];
|
||||
|
||||
var ip = $thisDialog.find("#ip").val();
|
||||
if(ip.indexOf("http://")==-1)
|
||||
url.push(todb("http://"+ip));
|
||||
else
|
||||
url.push(todb(ip));
|
||||
|
||||
var isQuestionMarkAdded = false;
|
||||
|
||||
var publicInterface = $thisDialog.find("#public_interface").val();
|
||||
if(publicInterface != null && publicInterface.length > 0) {
|
||||
if(isQuestionMarkAdded == false) {
|
||||
url.push("?");
|
||||
isQuestionMarkAdded = true;
|
||||
}
|
||||
else {
|
||||
url.push("&");
|
||||
}
|
||||
url.push("publicInterface="+todb(publicInterface));
|
||||
}
|
||||
|
||||
var privateInterface = $thisDialog.find("#private_interface").val();
|
||||
if(privateInterface != null && privateInterface.length > 0) {
|
||||
if(isQuestionMarkAdded == false) {
|
||||
url.push("?");
|
||||
isQuestionMarkAdded = true;
|
||||
}
|
||||
else {
|
||||
url.push("&");
|
||||
}
|
||||
url.push("privateInterface="+todb(privateInterface));
|
||||
}
|
||||
|
||||
var publicZone = $thisDialog.find("#public_zone").val();
|
||||
if(publicZone != null && publicZone.length > 0) {
|
||||
if(isQuestionMarkAdded == false) {
|
||||
url.push("?");
|
||||
isQuestionMarkAdded = true;
|
||||
}
|
||||
else {
|
||||
url.push("&");
|
||||
}
|
||||
url.push("publicZone="+todb(publicZone));
|
||||
}
|
||||
|
||||
var privateZone = $thisDialog.find("#private_zone").val();
|
||||
if(privateZone != null && privateZone.length > 0) {
|
||||
if(isQuestionMarkAdded == false) {
|
||||
url.push("?");
|
||||
isQuestionMarkAdded = true;
|
||||
}
|
||||
else {
|
||||
url.push("&");
|
||||
}
|
||||
url.push("privateZone="+todb(privateZone));
|
||||
}
|
||||
|
||||
array1.push("&url="+url.join(""));
|
||||
//*** construct URL (end) ***
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=addExternalFirewall"+array1.join("")),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
$thisDialog.find("#spinning_wheel").hide();
|
||||
$thisDialog.dialog("close");
|
||||
|
||||
/*
|
||||
var item = json.createvlaniprangeresponse.vlan;
|
||||
var $newTemplate = $("#iprange_template").clone();
|
||||
publicNetworkIprangeJsonToTemplate(item, $newTemplate);
|
||||
$("#public_network_page").find("#tab_content_ipallocation").find("#tab_container").prepend($newTemplate.show());
|
||||
*/
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
handleError(XMLHttpResponse, function() {
|
||||
handleErrorInDialog(XMLHttpResponse, $thisDialog);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}).dialog("open");
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
var publicNetworkIpRangeActionMap = {
|
||||
"Delete IP Range": {
|
||||
@ -476,6 +612,7 @@ function directNetworkToRightPanel($midmenuItem1) {
|
||||
|
||||
$("#direct_network_page").show();
|
||||
initAddIpRangeToDirectNetworkButton($("#midmenu_add_iprange_button"), $midmenuItem1);
|
||||
$("#midmenu_add_external_firewall_button").unbind("click").hide();
|
||||
|
||||
$("#public_network_page").hide();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user