Commit 342337f3 authored by Ad Schellevis's avatar Ad Schellevis

(status_gateway_groups) show missing gateways and status "monitoring...

(status_gateway_groups) show missing gateways and status "monitoring disabled", for https://github.com/opnsense/core/issues/1132
parent 765164a0
...@@ -71,7 +71,12 @@ include("head.inc"); ...@@ -71,7 +71,12 @@ include("head.inc");
$priorities = array(); $priorities = array();
foreach($gateway_group['item'] as $item) { foreach($gateway_group['item'] as $item) {
$itemsplit = explode("|", $item); $itemsplit = explode("|", $item);
$priorities[$itemsplit[1]] = $a_gateways[$itemsplit[0]]; if (!isset($priorities[$itemsplit[1]])) {
$priorities[$itemsplit[1]] = array();
}
if (!empty($a_gateways[$itemsplit[0]])) {
$priorities[$itemsplit[1]][] = $a_gateways[$itemsplit[0]];
}
} }
ksort($priorities); ksort($priorities);
?> ?>
...@@ -81,7 +86,12 @@ include("head.inc"); ...@@ -81,7 +86,12 @@ include("head.inc");
<td> <td>
<table class="table table-condensed"> <table class="table table-condensed">
<?php <?php
foreach ($priorities as $priority => $gateway): foreach ($priorities as $priority => $gateways):?>
<tr>
<td><?=sprintf(gettext("Tier %s"), $priority);?></td>
<td>
<?php
foreach ($gateways as $gateway):
$monitor = isset($gateway['monitor']) && is_ipaddr($gateway['monitor']) ? $gateway['monitor'] : $gateway['gateway']; $monitor = isset($gateway['monitor']) && is_ipaddr($gateway['monitor']) ? $gateway['monitor'] : $gateway['gateway'];
$status = $gateways_status[$monitor]['status']; $status = $gateways_status[$monitor]['status'];
if (stristr($status, "down")) { if (stristr($status, "down")) {
...@@ -96,21 +106,23 @@ include("head.inc"); ...@@ -96,21 +106,23 @@ include("head.inc");
} elseif ($status == "none") { } elseif ($status == "none") {
$online = gettext("Online"); $online = gettext("Online");
$bgcolor = "#90EE90"; // lightgreen $bgcolor = "#90EE90"; // lightgreen
} elseif (!empty($gateway['monitor_disable'])) {
$online = gettext("Monitoring disabled");
$bgcolor = "#F0E68C"; // lightcoral
} else { } else {
$online = gettext("Gathering data"); $online = gettext("Gathering data");
$bgcolor = "#ADD8E6"; // lightblue $bgcolor = "#ADD8E6"; // lightblue
} }
?> ?>
<tr>
<td><?=sprintf(gettext("Tier %s"), $priority);?></td>
<td>
<div style="background: <?=$bgcolor;?>"> <div style="background: <?=$bgcolor;?>">
&nbsp; &nbsp;
<i class="fa fa-globe"></i> <i class="fa fa-globe"></i>
<?=$gateway['name'];?>, <?=$online;?> <?=$gateway['name'];?>, <?=$online;?>
</div> </div>
</td> <?php
</tr> endforeach;?>
</td>
</tr>
<?php <?php
endforeach; ?> endforeach; ?>
</table> </table>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment