r1539 + fix RS pool LB management
[racktables] / inc / interface.php
index 0924e9d00bdbdfc40814dc69685aecd098b7f455..7c456b063438a9338aec130326417db170136254 100644 (file)
@@ -3805,26 +3805,33 @@ function renderRSPoolLBForm ($pool_id = 0)
        showMessageOrError();
 
        $poolInfo = getRSPoolInfo ($pool_id);
+       $vs_list = array ();
+       foreach (getVSList() as $vsid => $vsinfo)
+               $vs_list[$vsid] = buildVServiceName ($vsinfo) . (empty ($vsinfo['name']) ? '' : " (${vsinfo['name']})");
        startPortlet ('Manage existing (' . count ($poolInfo['lblist']) . ')');
        echo "<table cellspacing=0 cellpadding=5 align=center class=widetable>\n";
-       echo "<tr><th>&nbsp;</th><th>Object</th><th>VS config</th><th>RS config</th><th>&nbsp;</th></tr>\n";
-       foreach ($poolInfo['lblist'] as $object_id => $lbinfo)
-       {
-               $oi = getObjectInfo ($object_id);
-               echo "<form action='${root}process.php'>";
-               echo "<input type=hidden name=page value='${pageno}'>\n";
-               echo "<input type=hidden name=tab value='${tabno}'>\n";
-               echo "<input type=hidden name=op value=updLB>";
-               echo "<input type=hidden name=pool_id value='${pool_id}'>";
-               echo "<input type=hidden name=object_id value='${object_id}'>";
-               echo "<tr valign=top><td><a href='${root}process.php?page=${pageno}&tab=${tabno}&op=delLB&pool_id=${pool_id}&object_id=${object_id}'>";
-               printImageHREF ('delete', 'Unconfigure');
-               echo "</a></td>";
-               echo "<td class=tdleft><a href='${root}?page=object&object_id=${object_id}'>${oi['dname']}</a></td>";
-               echo "<td><textarea name=vsconfig>${lbinfo['vsconfig']}</textarea></td>";
-               echo "<td><textarea name=rsconfig>${lbinfo['rsconfig']}</textarea></td>";
-               echo "<td><input type=submit value=OK></td></tr></form>\n";
-       }
+       echo "<tr><th>&nbsp;</th><th>LB</th><th>VS</th><th>VS config</th><th>RS config</th><th>&nbsp;</th></tr>\n";
+       foreach ($poolInfo['lblist'] as $object_id => $vslist)
+               foreach ($vslist as $vs_id => $configs)
+               {
+                       $oi = getObjectInfo ($object_id);
+                       echo "<form action='${root}process.php'>";
+                       echo "<input type=hidden name=page value='${pageno}'>\n";
+                       echo "<input type=hidden name=tab value='${tabno}'>\n";
+                       echo "<input type=hidden name=op value=updLB>";
+                       echo "<input type=hidden name=pool_id value='${pool_id}'>";
+                       echo "<input type=hidden name=vs_id value='${vs_id}'>";
+                       echo "<input type=hidden name=object_id value='${object_id}'>";
+                       echo "<tr valign=top><td><a href='${root}process.php?page=${pageno}&tab=${tabno}&op=delLB&pool_id=${pool_id}&object_id=${object_id}'>";
+                       printImageHREF ('delete', 'Unconfigure');
+                       echo "</a></td>";
+                       echo "<td class=tdleft><a href='${root}?page=object&object_id=${object_id}'>${oi['dname']}</a></td>";
+                       echo "<td class=tdleft><a href='${root}?page=vservice&id=${vs_id}'>";
+                       echo buildVServiceName (getVServiceInfo ($vs_id));
+                       echo "<td><textarea name=vsconfig>${configs['vsconfig']}</textarea></td>";
+                       echo "<td><textarea name=rsconfig>${configs['rsconfig']}</textarea></td>";
+                       echo "<td><input type=submit value=OK></td></tr></form>\n";
+               }
        echo "</table>\n";
        finishPortlet();
 
@@ -3835,14 +3842,16 @@ function renderRSPoolLBForm ($pool_id = 0)
        echo "<input type=hidden name=tab value='${tabno}'>\n";
        echo "<input type=hidden name=op value=addLB>";
        echo "<input type=hidden name=pool_id value='${pool_id}'>";
-       echo "<tr valign=top><th>Object</th><td><select name='object_id' tabindex=1>";
+       echo "<tr valign=top><th>LB / VS</th><td class=tdleft><select name='object_id' tabindex=1>";
        foreach (array(4, 7, 8) as $type)
        {
                $objects = getObjectList ($type);
                foreach ($objects as $object)
                        echo "<option value='${object['id']}'>${object['dname']}</option>";
        }
-       echo "</select></td><td><input type=submit value=OK tabindex=2></td></tr>\n";
+       echo "</select> ";
+       printSelect ($vs_list, 'vs_id');
+       echo "</td><td><input type=submit value=OK tabindex=2></td></tr>\n";
        echo "<tr><th>VS config</th><td colspan=2><textarea name=vsconfig rows=10 cols=80></textarea></td></tr>";
        echo "<tr><th>RS config</th><td colspan=2><textarea name=rsconfig rows=10 cols=80></textarea></td></tr>";
        echo "</form></table>\n";
@@ -3991,7 +4000,7 @@ function renderRSPoolList ()
 {
        global $root;
        $pool_list = getRSPoolList();
-       if ($pool_list == NULL)
+       if ($pool_list === NULL)
        {
                showError ('getRSPoolList() failed', __FUNCTION__);
                return;