From 854ab5a9b85196e8ad0422448e9b4da96df2ebb5 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Mon, 26 Feb 2018 17:46:06 +0000 Subject: [PATCH] system: gateway group status into main list; closes #2201 --- plist | 1 - .../app/models/OPNsense/Base/Menu/Menu.xml | 2 +- .../mvc/app/models/OPNsense/Core/ACL/ACL.xml | 6 - src/www/status_gateway_groups.php | 141 ------------------ src/www/system_gateway_groups.php | 95 ++++++++---- src/www/system_gateways.php | 12 +- 6 files changed, 77 insertions(+), 180 deletions(-) delete mode 100644 src/www/status_gateway_groups.php diff --git a/plist b/plist index e21b66914..12311c941 100644 --- a/plist +++ b/plist @@ -1076,7 +1076,6 @@ /usr/local/www/services_unbound_overrides.php /usr/local/www/status_dhcp_leases.php /usr/local/www/status_dhcpv6_leases.php -/usr/local/www/status_gateway_groups.php /usr/local/www/status_graph.php /usr/local/www/status_habackup.php /usr/local/www/status_interfaces.php diff --git a/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml b/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml index c095aae3f..67fd1db14 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml @@ -54,9 +54,9 @@ + - diff --git a/src/opnsense/mvc/app/models/OPNsense/Core/ACL/ACL.xml b/src/opnsense/mvc/app/models/OPNsense/Core/ACL/ACL.xml index f0c8929a0..169cfda4b 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Core/ACL/ACL.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Core/ACL/ACL.xml @@ -512,12 +512,6 @@ status_dhcpv6_leases.php* - - Status: Gateway Groups - - status_gateway_groups.php* - - Status: Interfaces diff --git a/src/www/status_gateway_groups.php b/src/www/status_gateway_groups.php deleted file mode 100644 index 7d06450fc..000000000 --- a/src/www/status_gateway_groups.php +++ /dev/null @@ -1,141 +0,0 @@ -. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ - -require_once("guiconfig.inc"); -require_once("services.inc"); - -// request report data -$a_gateway_groups = &config_read_array('gateways', 'gateway_group'); -$gateways_status = return_gateways_status(true); -$a_gateways = return_gateways_array(); - -legacy_html_escape_form_data($a_gateways); -legacy_html_escape_form_data($a_gateway_groups); - -$service_hook = 'apinger'; - -include("head.inc"); - -?> - - - - -
-
-
-
-
-
- - - - - - - - - - - - - - - - - - -
- - $gateways):?> - - - - - -
- $gateway): - $online = gettext('Pending'); - $gateway_label_class = 'default'; - if ($gateways_status[$gname]) { - $status = $gateways_status[$gname]['status']; - if (stristr($status, 'force_down')) { - $online = gettext('Offline (forced)'); - $gateway_label_class = 'danger'; - } elseif (stristr($status, 'down')) { - $online = gettext('Offline'); - $gateway_label_class = 'danger'; - } elseif (stristr($status, 'loss')) { - $online = gettext('Warning, Packetloss').': '.$status['loss']; - $gateway_label_class = 'warning'; - } elseif (stristr($status, 'delay')) { - $online = gettext('Warning, Latency').': '.$status['delay']; - $gateway_label_class = 'warning'; - } elseif ($status == 'none') { - $online = gettext('Online'); - $gateway_label_class = 'success'; - } elseif (!empty($gateway['monitor_disable'])) { - $online = gettext('Online'); - $gateway_label_class = 'success'; - } - } -?> -
- - , -
- -
-
-
-
-
-
-
-
- - diff --git a/src/www/system_gateway_groups.php b/src/www/system_gateway_groups.php index 0f8c6ae6e..3591b8912 100644 --- a/src/www/system_gateway_groups.php +++ b/src/www/system_gateway_groups.php @@ -34,6 +34,8 @@ require_once("services.inc"); require_once("rrd.inc"); $a_gateway_groups = &config_read_array('gateways', 'gateway_group'); +$gateways_status = return_gateways_status(true); +$a_gateways = return_gateways_array(); if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_POST['act']) && $_POST['act'] == "del" ) { @@ -77,6 +79,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { } legacy_html_escape_form_data($a_gateway_groups); +legacy_html_escape_form_data($a_gateways); $service_hook = 'apinger'; @@ -133,54 +136,96 @@ $( document ).ready(function() { - - - - - + + + + - - + - - - + - - + diff --git a/src/www/system_gateways.php b/src/www/system_gateways.php index 2b1c9db2a..7d7d3c4f2 100644 --- a/src/www/system_gateways.php +++ b/src/www/system_gateways.php @@ -369,10 +369,10 @@ $( document ).ready(function() { $online = gettext('Offline'); $gateway_label_class = 'danger'; } elseif (stristr($status['status'], 'loss')) { - $online = gettext('Warning, Packetloss').': '.$status['loss']; + $online = gettext('Warning (packetloss)'); $gateway_label_class = 'warning'; } elseif (stristr($status['status'], 'delay')) { - $online = gettext('Warning, Latency').': '.$status['delay']; + $online = gettext('Warning (latency)'); $gateway_label_class = 'warning'; } elseif ($status['status'] == 'none') { $online = gettext('Online'); @@ -393,19 +393,19 @@ $( document ).ready(function() { @@ -428,7 +428,7 @@ $( document ).ready(function() { if ($i > 0) : ?>
+ -
+ foreach ($priorities as $priority => $gateways):?> + + + + + +
+ foreach ($gateways as $gname => $gateway): + $online = gettext('Pending'); + $gateway_label_class = 'default'; + if ($gateways_status[$gname]) { + $status = $gateways_status[$gname]['status']; + if (stristr($status, 'force_down')) { + $online = gettext('Offline (forced)'); + $gateway_label_class = 'danger'; + } elseif (stristr($status, 'down')) { + $online = gettext('Offline'); + $gateway_label_class = 'danger'; + } elseif (stristr($status, 'loss')) { + $online = gettext('Warning (packetloss)'); + $gateway_label_class = 'warning'; + } elseif (stristr($status, 'delay')) { + $online = gettext('Warning (latency)'); + $gateway_label_class = 'warning'; + } elseif ($status == 'none') { + $online = gettext('Online'); + $gateway_label_class = 'success'; + } elseif (!empty($gateway['monitor_disable'])) { + $online = gettext('Online'); + $gateway_label_class = 'success'; + } + } +?> +
+ + , +
+ +
+ + title="" data-toggle="tooltip"> + title="" data-toggle="tooltip">
"> + data-toggle="tooltip" title=""> - "> + data-toggle="tooltip" title="">