diff options
author | Eirik Oeverby <ltning@anduin.net> | 2010-08-11 23:42:15 +0200 |
---|---|---|
committer | Eirik Oeverby <ltning@anduin.net> | 2010-08-11 23:42:15 +0200 |
commit | e34f19ec25e50104c09f262bcda2e5346b675f36 (patch) | |
tree | fe2e76e3c5a1734566a83079653ab6570a843fc9 | |
parent | 24357d92f8c41f67ba6497282ea684535ba56290 (diff) | |
download | pfsense-e34f19ec25e50104c09f262bcda2e5346b675f36.zip pfsense-e34f19ec25e50104c09f262bcda2e5346b675f36.tar.gz |
Made LB pool status page follow natural (expected) order no matter which host(s) is/are active.
-rwxr-xr-x | usr/local/www/status_lb_pool.php | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/usr/local/www/status_lb_pool.php b/usr/local/www/status_lb_pool.php index c135ef0..b288bd8 100755 --- a/usr/local/www/status_lb_pool.php +++ b/usr/local/www/status_lb_pool.php @@ -167,44 +167,45 @@ if ($_POST) { <td class="listr" align="center" > <table border="0" cellpadding="0" cellspacing="2"> <?php + $pool_hosts=array(); foreach ((array) $pool['servers'] as $server) { - $svr = split("\|", $server); - if($svr[0]!="") { - switch ($relay_hosts[$pool['name'].":".$pool['port']][$svr[0]]['state']) { + $svr['ip']['addr']=$server; + $svr['ip']['state']=$relay_hosts[$pool['name'].":".$pool['port']][$server['ip']]['state']; + $pool_hosts[]=$svr; + } + foreach ((array) $pool['serversdisabled'] as $server) { + $svr['ip']['addr']="$server"; + $svr['ip']['state']='disabled'; + $pool_hosts[]=$svr; + } + asort($pool_hosts); + + foreach ((array) $pool_hosts as $server) { + if($server['ip']['addr']!="") { + switch ($server['ip']['state']) { case 'up': $bgcolor = "lightgreen"; + $checked = "checked"; + break; + case 'disabled': + $bgcolor = "white"; + $checked = ""; break; default: $bgcolor = "lightcoral"; + $checked = "checked"; } echo "<tr>"; switch ($pool['mode']) { case 'loadbalance': - if($svr[0]!="") - echo "<td><input type='checkbox' name='{$pool['name']}|".str_replace('.', '_', $svr[0])."' checked></td>\n"; + echo "<td><input type='checkbox' name='{$pool['name']}|".str_replace('.', '_', $server['ip']['addr'])."' {$checked}></td>\n"; break; case 'failover': - if($svr[0]!="") - echo "<td><input type='radio' name='{$pool['name']}' value='{$svr[0]}' checked></td>\n"; + echo "<td><input type='radio' name='{$pool['name']}' value='{$server['ip']['addr']}' {$checked}></td>\n"; break; } - echo "<td bgcolor={$bgcolor}> {$svr[0]}:{$pool['port']} </td></tr>"; - } - } - foreach ((array) $pool['serversdisabled'] as $server) { - $svr = split("\|", $server); - echo "<tr>"; - switch ($pool['mode']) { - case 'loadbalance': - if($svr[0]!="") - echo "<td><input type='checkbox' name='{$pool['name']}|".str_replace('.', '_', $svr[0])."'></td>\n"; - break; - case 'failover': - if($svr[0]!="") - echo "<td><input type='radio' name='{$pool['name']}' value='{$svr[0]}'></td>\n"; - break; + echo "<td bgcolor={$bgcolor}> {$server['ip']['addr']}:{$pool['port']} </td></tr>"; } - echo "<td> {$svr[0]}:{$pool['port']} </td></tr>"; } ?> </table> |