diff options
-rw-r--r-- | src/usr/local/www/load_balancer_virtual_server.php | 35 | ||||
-rw-r--r-- | src/usr/local/www/load_balancer_virtual_server_edit.php | 4 |
2 files changed, 36 insertions, 3 deletions
diff --git a/src/usr/local/www/load_balancer_virtual_server.php b/src/usr/local/www/load_balancer_virtual_server.php index c2296b4..b85d189 100644 --- a/src/usr/local/www/load_balancer_virtual_server.php +++ b/src/usr/local/www/load_balancer_virtual_server.php @@ -118,6 +118,26 @@ for ($i = 0; isset($config['load_balancer']['virtual_server'][$i]); $i++) { } } +// Return the index of any alias matching the specified name and type +function alias_idx($name, $type) { + global $config; + + if (empty($config['aliases']['alias'])) { + return(-1); + } + + $idx = 0; + foreach ($config['aliases']['alias'] as $alias) { + if (($alias['name'] == $name) && ($alias['type'] == $type)) { + return($idx); + } + + $idx++; + } + + return(-1); +} + $pgtitle = array(gettext("Services"), gettext("Load Balancer"), gettext("Virtual Servers")); $shortcut_section = "relayd-virtualservers"; @@ -166,11 +186,24 @@ display_top_tabs($tab_array); if (!empty($a_vs)) { $i = 0; foreach ($a_vs as $a_v) { + ?> <tr> <td><?=htmlspecialchars($a_v['name'])?></td> <td><?=htmlspecialchars($a_v['relay_protocol'])?></td> - <td><?=htmlspecialchars($a_v['ipaddr'])?></td> +<?php + + $aidx = alias_idx($a_v['ipaddr'], "host"); + + if ($aidx >= 0) { + print("<td>\n"); + print('<a href="/firewall_aliases_edit.php?id=' . $aidx . '" data-toggle="popover" data-trigger="hover focus" title="Alias details" data-content="' . alias_info_popup($aidx) . '" data-html="true">'); + print(htmlspecialchars($a_v['ipaddr']) . '</a></td>'); + } else { + print('<td>' . htmlspecialchars($a_v['ipaddr']) . '</td>'); + } + +?> <td><?=htmlspecialchars($a_v['port'])?></td> <td><?=$a_v['poolname']?></td> <td><?=$a_v['sitedown']?></td> diff --git a/src/usr/local/www/load_balancer_virtual_server_edit.php b/src/usr/local/www/load_balancer_virtual_server_edit.php index 38373ad..9e49154 100644 --- a/src/usr/local/www/load_balancer_virtual_server_edit.php +++ b/src/usr/local/www/load_balancer_virtual_server_edit.php @@ -219,10 +219,10 @@ $section->addInput(new Form_Input( $pconfig['descr'] )); - -$section->addInput(new Form_IpAddress( +$section->addInput(new Form_Input( 'ipaddr', 'IP Address', + 'text', $pconfig['ipaddr'] ))->setHelp('This is normally the WAN IP address for the server to listen on. ' . 'All connections to this IP and port will be forwarded to the pool cluster. ' . |