r1524 + implemented RS lister page
authorDenis Ovsienko <infrastation@yandex.ru>
Mon, 14 Jan 2008 19:20:47 +0000 (19:20 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Mon, 14 Jan 2008 19:20:47 +0000 (19:20 +0000)
inc/database.php
inc/interface.php
inc/navigation.php

index 4f9bf62dfadbbb199d68d903ff39e82d76eb8e7e..1027607f3ecaa5739db3e48f4c960008a67acbec 100644 (file)
@@ -2453,4 +2453,23 @@ function commitUpdateRSPool ($pool_id = 0, $name = '', $vsconfig = '', $rsconfig
                return TRUE;
 }
 
+function getRSList ()
+{
+       global $dbxlink;
+       $query = "select id, inet_ntoa(rsip) as rsip, rsport, rspool_id, rsconfig " .
+               "from IPRealServer order by rspool_id, IPRealServer.rsip, rsport";
+       $result = $dbxlink->query ($query);
+       if ($result == NULL)
+       {
+               showError ('SQL query failed', __FUNCTION__);
+               return NULL;
+       }
+       $rslist = array ();
+       while ($row = $result->fetch (PDO::FETCH_ASSOC))
+               foreach (array ('rsip', 'rsport', 'rspool_id', 'rsconfig') as $cname)
+                       $rslist[$row['id']][$cname] = $row[$cname];
+       $result->closeCursor();
+       return $rslist;
+}
+
 ?>
index 94cdc36928595fbc666c9cf51abef21444fc5a93..8d40ddbb78be0dc6e69b854b2181833571cd8da2 100644 (file)
@@ -4079,4 +4079,22 @@ function editRSPools ()
        finishPortlet();
 }
 
+function renderRealServerList ()
+{
+       $rslist = getRSList ();
+       $pool_list = getRSPoolList ();
+       echo "<table class=widetable border=0 cellpadding=10 cellspacing=0 align=center>\n";
+       echo "<tr><th>RS pool</th><th>real IP address</th><th>real port</th><th>RS configuration</th></tr>";
+       foreach ($rslist as $rsinfo)
+       {
+               echo "<tr valign=top><td><a href='${root}?page=rspool&id=${rsinfo['rspool_id']}'>";
+               echo empty ($pool_list[$rsinfo['rspool_id']]['name']) ? 'ANONYMOUS' : $pool_list[$rsinfo['rspool_id']]['name'];
+               echo '</a></td>';
+               echo "<td><a href='${root}?page=ipaddress&ip=${rsinfo['rsip']}'>${rsinfo['rsip']}</a></td>";
+               echo "<td>${rsinfo['rsport']}</td>";
+               echo "<td><pre>${rsinfo['rsconfig']}</pre></td>";
+               echo "</tr>\n";
+       }
+       echo "</table>";
+}
 ?>
index f6e92fd3d2d65a0786c59390a0e7fb263b68eecd..42055cbfabd4d30dfb59d926a46264e03e2f7176 100644 (file)
@@ -191,8 +191,9 @@ $ophandler['rspool']['editlblist']['addLB'] = 'addLoadBalancer';
 $ophandler['rspool']['editlblist']['delLB'] = 'deleteLoadBalancer';
 $ophandler['rspool']['editlblist']['updLB'] = 'updateLoadBalancer';
 
-$page['rservers']['title'] = '[Real servers]';
+$page['rservers']['title'] = 'Real servers';
 $page['rservers']['parent'] = 'ipv4space';
+$page['rservers']['handler'] = 'renderRealServerList';
 
 $page['lbs']['title'] = '[Load balancers]';
 $page['lbs']['parent'] = 'ipv4space';