From 2a32eb7fdba90d74738f60c5d432e12c36eb85b2 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 15 Feb 2018 08:43:29 +0000 Subject: [PATCH] system: merge single gateway status into main page #2201 --- plist | 1 - .../app/models/OPNsense/Base/Menu/Menu.xml | 13 +- .../mvc/app/models/OPNsense/Core/ACL/ACL.xml | 6 - src/www/status_gateways.php | 131 ---------------- src/www/system_gateways.php | 143 ++++++++++++------ src/www/widgets/include/gateways.inc | 2 +- src/www/widgets/widgets/gateways.widget.php | 4 +- 7 files changed, 107 insertions(+), 193 deletions(-) delete mode 100644 src/www/status_gateways.php diff --git a/plist b/plist index 512829878..e21b66914 100644 --- a/plist +++ b/plist @@ -1077,7 +1077,6 @@ /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_gateways.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 bfcd8f506..c095aae3f 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml @@ -49,16 +49,15 @@ - - + + - - - + + - - + + 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 2558fac79..f0c8929a0 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Core/ACL/ACL.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Core/ACL/ACL.xml @@ -518,12 +518,6 @@ status_gateway_groups.php* - - Status: Gateways - - status_gateways.php* - - Status: Interfaces diff --git a/src/www/status_gateways.php b/src/www/status_gateways.php deleted file mode 100644 index 0cadbc77e..000000000 --- a/src/www/status_gateways.php +++ /dev/null @@ -1,131 +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"); -require_once("interfaces.inc"); - -$a_gateways = return_gateways_array(); -$gateways_status = return_gateways_status(true); -legacy_html_escape_form_data($a_gateways); - -$service_hook = 'apinger'; - -include("head.inc"); - -?> - - -
-
-
-
-
-
- - - - - - - - - - - - - - $gateway):?> - - - - - - - - - - - - -
- - - -
- - -
-
- -
-
-
-
-
-
-
- - diff --git a/src/www/system_gateways.php b/src/www/system_gateways.php index bf3ff9fcb..40561ca74 100644 --- a/src/www/system_gateways.php +++ b/src/www/system_gateways.php @@ -1,31 +1,31 @@ . - 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. -*/ + * Copyright (C) 2014-2015 Deciso B.V. + * Copyright (C) 2010 Seth Mos + * 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("interfaces.inc"); @@ -107,15 +107,18 @@ function delete_gateway_item($id, $a_gateways) unset($config['gateways']['gateway_item'][$a_gateways[$id]['attribute']]); } - // fetch gateways and let's pretend the order is safe to use... $a_gateways = return_gateways_array(true, false, true); $a_gateways_arr = array(); -foreach ($a_gateways as $gw) { +foreach ($a_gateways as $gname => $gw) { + /* not sure why this is rewrapped, so retain the key for status here instead */ + $gw['gname'] = $gname; $a_gateways_arr[] = $gw; } $a_gateways = $a_gateways_arr; +$gateways_status = return_gateways_status(true); + // form processing if ($_SERVER['REQUEST_METHOD'] === 'POST') { $pconfig = $_POST; @@ -294,11 +297,14 @@ $( document ).ready(function() {   - - - - - + + + + + + + + @@ -322,12 +328,12 @@ $( document ).ready(function() { "> - "> + "> "> - " data-toggle="tooltip" title=""> + " data-toggle="tooltip" title=""> @@ -335,33 +341,72 @@ $( document ).ready(function() { (default)" : "";?> - + - + - + - - + + + + + + +
+ + +
+ + + + + "> + data-toggle="tooltip" title=""> - "> + data-toggle="tooltip" title=""> @@ -370,13 +415,21 @@ $( document ).ready(function() { $i++; endforeach;?> - - + + + + + + + + + + 0) : ?> '); tr_content.push(''+gateway['name']+'
'+gateway['address']+'
'); - tr_content.push(''+gateway['delay']+''); - tr_content.push(''+gateway['loss']+''); + tr_content.push(''+gateway['delay']+''); + tr_content.push(''+gateway['loss']+''); tr_content.push(''+gateway['status_translated']+''); tr_content.push(''); tbody.append(tr_content.join(''));