IP Address page - create load balancer rule - populate algorithm dropdown with network data instead of hard-coding.

This commit is contained in:
Jessica Wang 2010-12-23 20:22:14 -08:00
parent 66e0ca1298
commit 5577e0c9ca
2 changed files with 13 additions and 2 deletions

View File

@ -305,10 +305,12 @@
<div id="private_port_errormsg" class="errormsg" style="display: none;">Error msg will appear here</div>
</div>
<div class="grid_row_cell" style="width: 15%;">
<select id="algorithm_select" class="select" style="width: 70%;">
<select id="algorithm_select" class="select" style="width: 70%;">
<!--
<option value="roundrobin">roundrobin</option>
<option value="leastconn">leastconn</option>
<option value="source">source</option>
-->
</select>
</div>
<div class="grid_row_cell" style="width: 29%;">

View File

@ -425,6 +425,8 @@ function ipJsonToLoadBalancerTab() {
if(ipObj == null)
return;
var networkObj = $midmenuItem1.data("networkObj");
var ipAddress = ipObj.ipaddress;
if(ipAddress == null || ipAddress.length == 0)
return;
@ -432,7 +434,14 @@ function ipJsonToLoadBalancerTab() {
var $thisTab = $("#right_panel_content #tab_content_load_balancer");
$thisTab.find("#tab_container").hide();
$thisTab.find("#tab_spinning_wheel").show();
if(networkObj.service[6].name == "Lb" && networkObj.service[6].capability[0].name == "SupportedLbAlgorithms") {
var algorithms = networkObj.service[6].capability[0].value; //e.g. "roundrobin,leastconn,sourceip"
var array1 = algorithms.split(",");
var $algorithmField = $("#create_load_balancer_row").find("#algorithm_select").empty();
for(var i=0; i<array1.length; i++)
$algorithmField.append("<option value='"+array1[i]+"'>"+array1[i]+"</option>")
}
refreshCreateLoadBalancerRow();
$.ajax({