bug 7194: cloudStack UI - IP Address page - create port forwarding rule - (1) split public port into public start port, public end port. (2) split private port into private start port, private end port.

This commit is contained in:
Jessica Wang 2011-06-02 19:27:54 -07:00
parent 2a6215abca
commit 87b3a326f3
2 changed files with 50 additions and 35 deletions

View File

@ -316,12 +316,22 @@ dictionary = {
</div>
<div class="grid_rows even" id="create_port_forwarding_row">
<div class="grid_row_cell" style="width: 15%; ">
<input id="public_port" class="text" style="width: 70%; " type="text" />
<input id="public_port" class="text" style="width: 30%; " type="text" />
<div id="public_port_errormsg" class="errormsg" style="display: none;">Error msg will appear here</div>
<span style="float:left;padding-left:10px"> - </span>
<input id="public_end_port" class="text" style="width: 30%; " type="text" />
<div id="public_end_port_errormsg" class="errormsg" style="display: none;">Error msg will appear here</div>
</div>
<div class="grid_row_cell" style="width: 15%;">
<input id="private_port" class="text" style="width: 70%; " type="text" />
<input id="private_port" class="text" style="width: 30%; " type="text" />
<div id="private_port_errormsg" class="errormsg" style="display: none;">Error msg will appear here</div>
<span style="float:left;padding-left:10px"> - </span>
<input id="private_end_port" class="text" style="width: 30%; " type="text" />
<div id="private_end_port_errormsg" class="errormsg" style="display: none;">Error msg will appear here</div>
</div>
<div class="grid_row_cell" style="width: 15%; ">
<select class="select" id="protocol" style="width:70%;">

View File

@ -258,9 +258,13 @@ function afterLoadIpJSP() {
$createPortForwardingRow.find("#add_link").bind("click", function(event){
var isValid = true;
isValid &= validateDropDownBox("Instance", $createPortForwardingRow.find("#vm"), $createPortForwardingRow.find("#vm_errormsg"));
isValid &= validateInteger("Public Port", $createPortForwardingRow.find("#public_port"), $createPortForwardingRow.find("#public_port_errormsg"), 1, 65535);
isValid &= validateInteger("Private Port", $createPortForwardingRow.find("#private_port"), $createPortForwardingRow.find("#private_port_errormsg"), 1, 65535);
isValid &= validateDropDownBox("Instance", $createPortForwardingRow.find("#vm"), $createPortForwardingRow.find("#vm_errormsg"));
isValid &= validateInteger("Public Port", $createPortForwardingRow.find("#public_port"), $createPortForwardingRow.find("#public_port_errormsg"), 1, 65535, false); //required
isValid &= validateInteger("Public End Port", $createPortForwardingRow.find("#public_end_port"), $createPortForwardingRow.find("#public_end_port_errormsg"), 1, 65535, true); //optional
isValid &= validateInteger("Private Port", $createPortForwardingRow.find("#private_port"), $createPortForwardingRow.find("#private_port_errormsg"), 1, 65535, false); //required
isValid &= validateInteger("Private End Port", $createPortForwardingRow.find("#private_end_port"), $createPortForwardingRow.find("#private_end_port_errormsg"), 1, 65535, true); //optional
if (!isValid)
return;
@ -273,17 +277,26 @@ function afterLoadIpJSP() {
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
var ipObj = $midmenuItem1.data("jsonObj");
var publicPort = $createPortForwardingRow.find("#public_port").val();
var privatePort = $createPortForwardingRow.find("#private_port").val();
var protocol = $createPortForwardingRow.find("#protocol").val();
var virtualMachineId = $createPortForwardingRow.find("#vm").val();
var array1 = [];
array1.push("&ipaddressid="+ipObj.id);
array1.push("&publicport="+publicPort);
array1.push("&privateport="+privatePort);
array1.push("&protocol="+protocol);
var array1 = [];
array1.push("&ipaddressid="+ipObj.id);
var publicPort = $createPortForwardingRow.find("#public_port").val();
array1.push("&publicport="+publicPort);
var publicEndPort = $createPortForwardingRow.find("#public_end_port").val();
if(publicEndPort != null && publicEndPort.length > 0)
array1.push("&publicendport="+publicEndPort);
var privatePort = $createPortForwardingRow.find("#private_port").val();
array1.push("&privateport="+privatePort);
var privateEndPort = $createPortForwardingRow.find("#private_end_port").val();
if(privateEndPort != null && privateEndPort.length > 0)
array1.push("&privateendport="+privateEndPort);
var protocol = $createPortForwardingRow.find("#protocol").val();
array1.push("&protocol="+protocol);
var virtualMachineId = $createPortForwardingRow.find("#vm").val();
array1.push("&virtualmachineid=" + virtualMachineId);
$.ajax({
@ -1496,20 +1509,19 @@ function ipClearPortForwardingTab() {
function portForwardingJsonToTemplate(jsonObj, $template) {
$template.attr("id", "portForwarding_" + fromdb(jsonObj.id)).data("portForwardingId", fromdb(jsonObj.id));
$template.find("#row_container #public_port").text(fromdb(jsonObj.publicport));
$template.find("#row_container_edit #public_port").text(fromdb(jsonObj.publicport));
$template.find("#public_port").text(fromdb(jsonObj.publicport));
$template.find("#public_end_port").text(fromdb(jsonObj.publicendport));
$template.find("#row_container #private_port").text(fromdb(jsonObj.privateport));
$template.find("#row_container_edit #private_port").val(fromdb(jsonObj.privateport));
$template.find("#row_container #protocol").text(fromdb(jsonObj.protocol));
$template.find("#row_container_edit #protocol").text(fromdb(jsonObj.protocol));
$template.find("#private_port").text(fromdb(jsonObj.privateport));
$template.find("#private_end_port").text(fromdb(jsonObj.privateendport));
$template.find("#protocol").text(fromdb(jsonObj.protocol));
var vmName = getVmName(jsonObj.virtualmachinename, jsonObj.virtualmachinedisplayname);
$template.find("#row_container #vm_name").text(vmName);
$template.find("#vm_name").text(vmName);
var virtualMachineId = fromdb(jsonObj.virtualmachineid);
ipSetRuleState(fromdb(jsonObj.state), $template.find("#row_container #state"));
ipSetRuleState(fromdb(jsonObj.state), $template.find("#state"));
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
if($midmenuItem1 == null)
@ -1517,17 +1529,10 @@ function portForwardingJsonToTemplate(jsonObj, $template) {
var ipObj = $midmenuItem1.data("jsonObj");
if(ipObj == null)
return;
var ipAddress = fromdb(ipObj.ipaddress);
var $vmSelect = $template.find("#row_container_edit #vm").empty();
ipPopulateVMDropdown($vmSelect);
$vmSelect.val(virtualMachineId);
var $rowContainer = $template.find("#row_container");
var $rowContainerEdit = $template.find("#row_container_edit");
var ipAddress = fromdb(ipObj.ipaddress);
$template.find("#delete_link").unbind("click").bind("click", function(event){
var $spinningWheel = $rowContainer.find("#spinning_wheel");
var $spinningWheel = $template.find("#spinning_wheel");
$spinningWheel.find("#description").text(g_dictionary["label.deleting.processing"]);
$spinningWheel.show();