and added alias pop-ups to load_balancer_virtual_server.php
This commit is contained in:
Stephen Beaver 2016-04-15 11:00:00 -04:00
parent 91cd1923b1
commit 0200db178e
2 changed files with 36 additions and 3 deletions

View File

@ -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>

View File

@ -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. ' .