summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/status_gateways.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/local/www/status_gateways.php')
-rw-r--r--src/usr/local/www/status_gateways.php217
1 files changed, 107 insertions, 110 deletions
diff --git a/src/usr/local/www/status_gateways.php b/src/usr/local/www/status_gateways.php
index e6fcf9d..71d25d2 100644
--- a/src/usr/local/www/status_gateways.php
+++ b/src/usr/local/www/status_gateways.php
@@ -42,6 +42,13 @@
require("guiconfig.inc");
+define('COLOR', true);
+define('LIGHTGREEN', '#90EE90');
+define('LIGHTCORAL', '#F08080');
+define('KHAKI', '#F0E68C');
+define('LIGHTGRAY', '#D3D3D3');
+define('WHITE', '#FFFFFF');
+
$a_gateways = return_gateways_array();
$gateways_status = array();
$gateways_status = return_gateways_status(true);
@@ -53,117 +60,107 @@ $pgtitle = array(gettext("Status"), gettext("Gateways"));
$shortcut_section = "gateways";
include("head.inc");
+/* active tabs */
+$tab_array = array();
+$tab_array[] = array(gettext("Gateways"), true, "status_gateways.php");
+$tab_array[] = array(gettext("Gateway Groups"), false, "status_gateway_groups.php");
+display_top_tabs($tab_array);
?>
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr><td class="tabnavtbl">
- <?php
- /* active tabs */
- $tab_array = array();
- $tab_array[] = array(gettext("Gateways"), true, "status_gateways.php");
- $tab_array[] = array(gettext("Gateway Groups"), false, "status_gateway_groups.php");
- display_top_tabs($tab_array);
- ?>
- </td></tr>
- <tr>
- <td>
- <div id="mainarea">
- <table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="10%" class="listhdrr"><?=gettext("Name"); ?></td>
- <td width="10%" class="listhdrr"><?=gettext("Gateway"); ?></td>
- <td width="10%" class="listhdrr"><?=gettext("Monitor"); ?></td>
- <td width="8%" class="listhdrr"><?=gettext("RTT"); ?></td>
- <td width="7%" class="listhdrr"><?=gettext("Loss"); ?></td>
- <td width="35%" class="listhdrr"><?=gettext("Status"); ?></td>
- <td width="20%" class="listhdr"><?=gettext("Description"); ?></td>
- </tr>
-<?php
- foreach ($a_gateways as $gname => $gateway) {
+
+<div class="table-responsive">
+ <table class="table table-hover table-compact table-striped">
+ <thead>
+ <tr>
+ <th><?=gettext("Name"); ?></th>
+ <th><?=gettext("Gateway"); ?></th>
+ <th><?=gettext("Monitor"); ?></th>
+ <th><?=gettext("RTT"); ?></th>
+ <th><?=gettext("Loss"); ?></th>
+ <th><?=gettext("Status"); ?></th>
+ <th><?=gettext("Description"); ?></th>
+ </tr>
+ </thead>
+ <tbody>
+<?php foreach ($a_gateways as $gname => $gateway) {
+?>
+ <tr>
+ <td>
+ <?=$gateway['name'];?>
+ </td>
+ <td>
+ <?php echo lookup_gateway_ip_by_name($gname);?>
+ </td>
+ <td>
+<?php if ($gateways_status[$gname])
+ echo $gateways_status[$gname]['monitorip'];
+ else
+ echo $gateway['monitorip'];
+?>
+ </td>
+ <td>
+<?php if ($gateways_status[$gname])
+ echo $gateways_status[$gname]['delay'];
+ else
+ echo gettext("Pending");
+?>
+ <?php $counter++; ?>
+ </td>
+ <td>
+<?php if ($gateways_status[$gname])
+ echo $gateways_status[$gname]['loss'];
+ else
+ echo gettext("Pending");
+
+ $counter++;
?>
- <tr>
- <td class="listlr">
- <?=$gateway['name'];?>
- </td>
- <td class="listr" align="center" >
- <?php echo lookup_gateway_ip_by_name($gname);?>
- </td>
- <td class="listr" align="center" >
- <?php
- if ($gateways_status[$gname]) {
- echo $gateways_status[$gname]['monitorip'];
- } else {
- echo $gateway['monitorip'];
- }
- ?>
- </td>
- <td class="listr" align="center">
- <?php
- if ($gateways_status[$gname]) {
- echo $gateways_status[$gname]['delay'];
- } else {
- echo gettext("Pending");
- }
- ?>
- </td>
- <td class="listr" align="center">
- <?php
- if ($gateways_status[$gname]) {
- echo $gateways_status[$gname]['loss'];
- } else {
- echo gettext("Pending");
- }
- ?>
- </td>
- <td class="listr" >
- <table border="0" cellpadding="0" cellspacing="2">
- <?php
- if ($gateways_status[$gname]) {
- $status = $gateways_status[$gname];
- if (stristr($status['status'], "force_down")) {
- $online = gettext("Offline (forced)");
- $bgcolor = "#F08080"; // lightcoral
- } elseif (stristr($status['status'], "down")) {
- $online = gettext("Offline");
- $bgcolor = "#F08080"; // lightcoral
- } elseif (stristr($status['status'], "loss")) {
- $online = gettext("Warning, Packetloss").': '.$status['loss'];
- $bgcolor = "#F0E68C"; // khaki
- } elseif (stristr($status['status'], "delay")) {
- $online = gettext("Warning, Latency").': '.$status['delay'];
- $bgcolor = "#F0E68C"; // khaki
- } elseif ($status['status'] == "none") {
- $online = gettext("Online");
- $bgcolor = "#90EE90"; // lightgreen
- }
- } else if (isset($gateway['monitor_disable'])) {
- $online = gettext("Online");
- $bgcolor = "#90EE90"; // lightgreen
- } else {
- $online = gettext("Pending");
- $bgcolor = "#D3D3D3"; // lightgray
- }
- echo "<tr><td><table width='100%'><tr><td bgcolor=\"$bgcolor\">&nbsp;$online&nbsp;</td></tr><tr><td>";
- $lastchange = $gateways_status[$gname]['lastcheck'];
- if (!empty($lastchange)) {
- echo gettext("Last check:") . '<br />' . $lastchange;
- }
- echo "</td></tr></table></td></tr>";
- ?>
- </table>
- </td>
- <td class="listbg"> <?=$gateway['descr']; ?></td>
- </tr>
+ </td>
<?php
- } // foreach gateway
+ if ($gateways_status[$gname]) {
+ $status = $gateways_status[$gname];
+ if (stristr($status['status'], "force_down")) {
+ $online = gettext("Offline (forced)");
+ $bgcolor = LIGHTCORAL;
+ } elseif (stristr($status['status'], "down")) {
+ $online = gettext("Offline");
+ $bgcolor = LIGHTCORAL;
+ } elseif (stristr($status['status'], "loss")) {
+ $online = gettext("Warning, Packetloss").': '.$status['loss'];
+ $bgcolor = KHAKI;
+ } elseif (stristr($status['status'], "delay")) {
+ $online = gettext("Warning, Latency").': '.$status['delay'];
+ $bgcolor = KHAKI;
+ } elseif ($status['status'] == "none") {
+ $online = gettext("Online");
+ $bgcolor = LIGHTGREEN;
+ }
+ } else if (isset($gateway['monitor_disable'])) {
+ $online = gettext("Online");
+ $bgcolor = LIGHTGREEN;
+ } else {
+ $online = gettext("Pending");
+ $bgcolor = LIGHTGRAY;
+ }
+
+ $lastchange = $gateways_status[$gname]['lastcheck'];
+
+ if(!COLOR)
+ $bgcolor = WHITE;
?>
- </table>
- </div>
- </td>
- </tr>
-</table>
-
-<?php include("fend.inc"); ?>
-</body>
-</html>
+
+ <td bgcolor="<?=$bgcolor?>">
+ <strong><?=$online?></strong> <?php
+ if(!empty($lastchange)) { ?>
+ <br /><i>Last checked <?=$lastchange?></i>
+<?php } ?>
+ </td>
+
+ <td>
+ <?=$gateway['descr']; ?>
+ </td>
+ </tr>
+<?php } ?> <!-- End-of-foreach -->
+ </tbody>
+ </table>
+</div>
+
+<?php include("foot.inc"); ?>
OpenPOWER on IntegriCloud