r1681 + getIPAddress(): return RS data; avoid double inet_aton() -> inet_ntoa() conve...
authorDenis Ovsienko <infrastation@yandex.ru>
Fri, 15 Feb 2008 13:39:10 +0000 (13:39 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Fri, 15 Feb 2008 13:39:10 +0000 (13:39 +0000)
+ renderIPAddress(): render RS list for address

inc/functions.php
inc/interface.php

index 26cc224e7a7dbd2f9be040c6e18cb75a44c66896..f0212e2acc557279d58b5a39155ab00640ed3c2e 100644 (file)
@@ -607,10 +607,27 @@ function getIPAddress ($ip=0)
        $result->closeCursor();
        unset ($result);
 
-       $query = "select id, inet_ntoa(vip) as vip, vport, proto, name from IPVirtualService where vip = inet_aton('${ip}')";
+       $query = "select id, vport, proto, name from IPVirtualService where vip = inet_aton('${ip}')";
        $result = $dbxlink->query ($query);
        while ($row = $result->fetch (PDO::FETCH_ASSOC))
-               $ret['vslist'][] = $row;
+       {
+               $new = $row;
+               $new['vip'] = $ip;
+               $ret['vslist'][] = $new;
+       }
+       $result->closeCursor();
+       unset ($result);
+
+       $query = "select inservice, rsport, IPRSPool.id as pool_id, IPRSPool.name as poolname from " .
+               "IPRealServer inner join IPRSPool on rspool_id = IPRSPool.id " .
+               "where rsip = inet_aton('${ip}')";
+       $result = $dbxlink->query ($query);
+       while ($row = $result->fetch (PDO::FETCH_ASSOC))
+       {
+               $new = $row;
+               $new['rsip'] = $ip;
+               $ret['rslist'][] = $new;
+       }
        $result->closeCursor();
        unset ($result);
 
index 3163d547d016b69e34a5e2ee3a30da40bb235b91..94c2bdc5efd70cf7de024d54e1bcf92a30772790 100644 (file)
@@ -1957,11 +1957,32 @@ function renderIPAddress ()
                {
                        echo "<tr><td class=tdleft><a href='${root}?page=vservice&id=${vsinfo['id']}'>";
                        echo buildVServiceName ($vsinfo) . "</a></td><td class=tdleft>";
-                       echo $vsinfo['name'] . "</td></tr>";
+                       echo $vsinfo['name'] . "</td></tr>\n";
                }
                echo "</table><br><br>";
                finishPortlet();
        }
+
+       if (count ($address['rslist']))
+       {
+               startPortlet ('Real servers (' . count ($address['rslist']) . ')');
+               echo "<table class='widetable' cesspadding=5 cellspacing=0 border=0 align='center'>\n";
+               echo "<tr><th>in service</th><th>port</th><th>RS pool</th></tr>\n";
+               foreach ($address['rslist'] as $rsinfo)
+               {
+                       echo "<tr><td>";
+                       if ($rsinfo['inservice'] == 'yes')
+                               printImageHREF ('inservice', 'in service');
+                       else
+                               printImageHREF ('notinservice', 'NOT in service');
+                       echo "${rsinfo['rsport']}</td><td class=tdleft><a href='${root}?page=rspool&id=${rsinfo['pool_id']}'>";
+                       echo $rsinfo['poolname'] . "</a></td></tr>\n";
+               }
+               echo "</table><br><br>";
+               finishPortlet();
+       }
+
+
 //     echo "</td><td>";
 //     echo "</td></tr></table>";
 }