mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 00:07:26 +00:00
system: merge single gateway status into main page #2201
This commit is contained in:
parent
5a0306e66f
commit
2a32eb7fdb
1
plist
1
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
|
||||
|
||||
@ -49,16 +49,15 @@
|
||||
<Log order="100" VisibleName="Log File" url="/diag_logs_routing.php"/>
|
||||
</Routes>
|
||||
<Gateways order="30" cssClass="fa fa-location-arrow fa-fw">
|
||||
<All url="/system_gateways.php">
|
||||
<All url="/system_gateways.php*" visibility="hidden"/>
|
||||
<Single order="10" url="/system_gateways.php">
|
||||
<List url="/system_gateways.php*" visibility="hidden"/>
|
||||
<Edit url="/system_gateways_edit.php*" visibility="hidden"/>
|
||||
</All>
|
||||
<AllStatus VisibleName="Status" url="/status_gateways.php"/>
|
||||
<Group url="/system_gateway_groups.php">
|
||||
</Single>
|
||||
<Group order="20" url="/system_gateway_groups.php">
|
||||
<Edit url="/system_gateway_groups_edit.php*" visibility="hidden"/>
|
||||
</Group>
|
||||
<GroupStatus VisibleName="Group Status" url="/status_gateway_groups.php"/>
|
||||
<Log VisibleName="Log File" url="/diag_logs_gateways.php"/>
|
||||
<GroupStatus order="21" VisibleName="Group Status" url="/status_gateway_groups.php"/>
|
||||
<Log VisibleName="Log File" order="30" url="/diag_logs_gateways.php"/>
|
||||
</Gateways>
|
||||
<Settings order="20" cssClass="fa fa-cogs fa-fw">
|
||||
<General order="100" url="/system_general.php">
|
||||
|
||||
@ -518,12 +518,6 @@
|
||||
<pattern>status_gateway_groups.php*</pattern>
|
||||
</patterns>
|
||||
</page-status-gatewaygroups>
|
||||
<page-status-gateways>
|
||||
<name>Status: Gateways</name>
|
||||
<patterns>
|
||||
<pattern>status_gateways.php*</pattern>
|
||||
</patterns>
|
||||
</page-status-gateways>
|
||||
<page-status-interfaces>
|
||||
<name>Status: Interfaces</name>
|
||||
<patterns>
|
||||
|
||||
@ -1,131 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2014-2015 Deciso B.V.
|
||||
Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>.
|
||||
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");
|
||||
|
||||
?>
|
||||
<body>
|
||||
<?php include("fbegin.inc"); ?>
|
||||
<section class="page-content-main">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<section class="col-xs-12">
|
||||
<div class="tab-content content-box col-xs-12">
|
||||
<div class="responsive-table">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?=gettext("Name"); ?></td>
|
||||
<td class="hidden-xs"><?=gettext("Gateway"); ?></td>
|
||||
<td class="hidden-xs"><?=gettext("Monitor"); ?></td>
|
||||
<td class="hidden-xs"><?=gettext("RTT"); ?></td>
|
||||
<td class="hidden-xs"><?=gettext("Loss"); ?></td>
|
||||
<td><?=gettext("Status"); ?></td>
|
||||
<td><?=gettext("Description"); ?></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($a_gateways as $gname => $gateway):?>
|
||||
<tr>
|
||||
<td>
|
||||
<?=$gateway['name'];?>
|
||||
</td>
|
||||
<td class="hidden-xs">
|
||||
<?=$gateway['gateway'];?>
|
||||
</td>
|
||||
<td class="hidden-xs">
|
||||
<?= !empty($gateways_status[$gname]) ? $gateways_status[$gname]['monitorip'] : $gateway['monitorip'];?>
|
||||
</td>
|
||||
<td class="hidden-xs">
|
||||
<?= !empty($gateways_status[$gname]) ? $gateways_status[$gname]['delay'] : gettext("Pending") ;?>
|
||||
</td>
|
||||
<td class="hidden-xs">
|
||||
<?= !empty($gateways_status[$gname]) ? $gateways_status[$gname]['loss'] : gettext("Pending"); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($gateways_status[$gname]) {
|
||||
$status = $gateways_status[$gname];
|
||||
if (stristr($status['status'], "force_down")) {
|
||||
$online = gettext("Offline (forced)");
|
||||
$gateway_label_class = 'danger';
|
||||
} elseif (stristr($status['status'], "down")) {
|
||||
$online = gettext("Offline");
|
||||
$gateway_label_class = 'danger';
|
||||
} elseif (stristr($status['status'], "loss")) {
|
||||
$online = gettext("Warning, Packetloss").': '.$status['loss'];
|
||||
$gateway_label_class = 'warning';
|
||||
} elseif (stristr($status['status'], "delay")) {
|
||||
$online = gettext("Warning, Latency").': '.$status['delay'];
|
||||
$gateway_label_class = 'waning';
|
||||
} elseif ($status['status'] == "none") {
|
||||
$online = gettext("Online");
|
||||
$gateway_label_class = 'success';
|
||||
}
|
||||
} else if (isset($gateway['monitor_disable'])) {
|
||||
$online = gettext("Online");
|
||||
$gateway_label_class = 'success';
|
||||
} else {
|
||||
$online = gettext("Pending");
|
||||
$gateway_label_class = 'default';
|
||||
}
|
||||
?>
|
||||
<div class="label label-<?= $gateway_label_class ?>">
|
||||
<i class="fa fa-globe"></i>
|
||||
<?=$online;?>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<?=$gateway['descr']; ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php include("foot.inc"); ?>
|
||||
@ -1,31 +1,31 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2014-2015 Deciso B.V.
|
||||
Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>.
|
||||
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 <seth.mos@dds.nl>
|
||||
* 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() {
|
||||
<tr>
|
||||
<th colspan="2"> </th>
|
||||
<th><?=gettext("Name"); ?></th>
|
||||
<th><?=gettext("Interface"); ?></th>
|
||||
<th><?=gettext("Gateway"); ?></th>
|
||||
<th><?=gettext("Monitor IP"); ?></th>
|
||||
<th><?=gettext("Description"); ?></th>
|
||||
<th></th>
|
||||
<th class="hidden-xs hidden-sm hidden-md"><?=gettext("Interface"); ?></th>
|
||||
<th class="hidden-xs hidden-sm hidden-md"><?=gettext("Gateway"); ?></th>
|
||||
<th class="hidden-xs hidden-sm hidden-md"><?=gettext("Monitor IP"); ?></th>
|
||||
<th class="text-nowrap hidden-xs"><?=gettext("RTT"); ?></th>
|
||||
<th class="text-nowrap hidden-xs"><?=gettext("Loss"); ?></th>
|
||||
<th><?=gettext("Status"); ?></th>
|
||||
<th class="hidden-xs hidden-sm hidden-md"><?=gettext("Description"); ?></th>
|
||||
<th class="text-nowrap"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -322,12 +328,12 @@ $( document ).ready(function() {
|
||||
<span class="fa fa-trash text-muted" data-toggle="tooltip" title="<?=gettext("Gateway is inactive because interface is missing");?>"></span>
|
||||
<?php
|
||||
elseif (is_numeric($gateway['attribute'])) :?>
|
||||
<a href="#" class="act_toggle" data-id="<?=$i;?>" data-toggle="tooltip" title="<?=(!isset($gateway['disabled'])) ? gettext("disable gateway") : gettext("enable gateway");?>">
|
||||
<a href="#" class="act_toggle" data-id="<?=$i;?>" data-toggle="tooltip" title="<?=(!isset($gateway['disabled'])) ? gettext("Disable") : gettext("Enable");?>">
|
||||
<span class="glyphicon glyphicon-play <?=isset($gateway['disabled']) || isset($gateway['inactive']) ? "text-muted" : "text-success";?>"></span>
|
||||
</a>
|
||||
<?php
|
||||
else :?>
|
||||
<span class="glyphicon glyphicon-play <?=isset($gateway['disabled']) || isset($gateway['inactive']) ? "text-muted" : "text-success";?>" data-toggle="tooltip" title="<?=(!isset($filterent['disabled'])) ? gettext("disable gateway") : gettext("enable gateway");?>"></span>
|
||||
<span class="glyphicon glyphicon-play <?=isset($gateway['disabled']) || isset($gateway['inactive']) ? "text-muted" : "text-success";?>" data-toggle="tooltip" title="<?=(!isset($filterent['disabled'])) ? gettext("Disable") : gettext("Enable");?>"></span>
|
||||
<?php
|
||||
endif;?>
|
||||
</td>
|
||||
@ -335,33 +341,72 @@ $( document ).ready(function() {
|
||||
<?=$gateway['name'];?>
|
||||
<?=isset($gateway['defaultgw']) ? "<strong>(default)</strong>" : "";?>
|
||||
</td>
|
||||
<td>
|
||||
<td class="hidden-xs hidden-sm hidden-md">
|
||||
<?=convert_friendly_interface_to_friendly_descr($gateway['friendlyiface']);?>
|
||||
</td>
|
||||
<td>
|
||||
<td class="hidden-xs hidden-sm hidden-md">
|
||||
<?=$gateway['gateway'];?>
|
||||
</td>
|
||||
<td>
|
||||
<td class="hidden-xs hidden-sm hidden-md">
|
||||
<?=$gateway['monitor'];?>
|
||||
</td>
|
||||
<td>
|
||||
<?=$gateway['descr'];?>
|
||||
<td class="text-nowrap hidden-xs">
|
||||
<?= !empty($gateways_status[$gateway['gname']]) ? $gateways_status[$gateway['gname']]['delay'] : gettext("Pending") ;?>
|
||||
</td>
|
||||
<td class="text-nowrap hidden-xs">
|
||||
<?= !empty($gateways_status[$gateway['gname']]) ? $gateways_status[$gateway['gname']]['loss'] : gettext("Pending"); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($gateways_status[$gateway['gname']]) {
|
||||
$status = $gateways_status[$gateway['gname']];
|
||||
if (stristr($status['status'], "force_down")) {
|
||||
$online = gettext("Offline (forced)");
|
||||
$gateway_label_class = 'danger';
|
||||
} elseif (stristr($status['status'], "down")) {
|
||||
$online = gettext("Offline");
|
||||
$gateway_label_class = 'danger';
|
||||
} elseif (stristr($status['status'], "loss")) {
|
||||
$online = gettext("Warning, Packetloss").': '.$status['loss'];
|
||||
$gateway_label_class = 'warning';
|
||||
} elseif (stristr($status['status'], "delay")) {
|
||||
$online = gettext("Warning, Latency").': '.$status['delay'];
|
||||
$gateway_label_class = 'waning';
|
||||
} elseif ($status['status'] == "none") {
|
||||
$online = gettext("Online");
|
||||
$gateway_label_class = 'success';
|
||||
}
|
||||
} else if (isset($gateway['monitor_disable'])) {
|
||||
$online = gettext("Online");
|
||||
$gateway_label_class = 'success';
|
||||
} else {
|
||||
$online = gettext("Pending");
|
||||
$gateway_label_class = 'default';
|
||||
}
|
||||
?>
|
||||
<div class="label label-<?= $gateway_label_class ?>">
|
||||
<i class="fa fa-globe"></i>
|
||||
<?=$online;?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="hidden-xs hidden-sm hidden-md">
|
||||
<?=$gateway['descr'];?>
|
||||
</td>
|
||||
<td class="text-nowrap">
|
||||
<a href="system_gateways_edit.php?id=<?=$i;?>" class="btn btn-default btn-xs"
|
||||
data-toggle="tooltip" title="<?=gettext("edit gateway");?>">
|
||||
data-toggle="tooltip" title="<?=gettext("Edit");?>">
|
||||
<span class="glyphicon glyphicon-pencil"></span>
|
||||
</a>
|
||||
<?php
|
||||
if (is_numeric($gateway['attribute'])) :?>
|
||||
<button data-id="<?=$i;?>" title="<?=gettext("delete gateway"); ?>" data-toggle="tooltip"
|
||||
<button data-id="<?=$i;?>" title="<?=gettext("Delete"); ?>" data-toggle="tooltip"
|
||||
class="act_delete btn btn-default btn-xs">
|
||||
<span class="fa fa-trash text-muted"></span>
|
||||
</button>
|
||||
<?php
|
||||
endif;?>
|
||||
<a href="system_gateways_edit.php?dup=<?=$i;?>" class="btn btn-default btn-xs"
|
||||
data-toggle="tooltip" title="<?=gettext("clone gateway");?>">
|
||||
data-toggle="tooltip" title="<?=gettext("Clone");?>">
|
||||
<span class="fa fa-clone text-muted"></span>
|
||||
</a>
|
||||
</td>
|
||||
@ -370,13 +415,21 @@ $( document ).ready(function() {
|
||||
$i++;
|
||||
endforeach;?>
|
||||
<tr>
|
||||
<td colspan="7"></td>
|
||||
<td>
|
||||
<td colspan="2"></td>
|
||||
<td></td>
|
||||
<td class="hidden-xs hidden-sm hidden-md"></td>
|
||||
<td class="hidden-xs hidden-sm hidden-md"></td>
|
||||
<td class="hidden-xs hidden-sm hidden-md"></td>
|
||||
<td class="text-nowrap hidden-xs"></td>
|
||||
<td class="text-nowrap hidden-xs"></td>
|
||||
<td></td>
|
||||
<td class="hidden-xs hidden-sm hidden-md"></td>
|
||||
<td class="text-nowrap">
|
||||
<?php
|
||||
if ($i > 0) :
|
||||
?>
|
||||
<button type="submit" id="btn_delete" name="del_x" class="btn btn-default btn-xs" data-toggle="tooltip"
|
||||
title="<?=gettext("delete selected items");?>">
|
||||
title="<?=gettext("Delete selected items");?>">
|
||||
<span class="fa fa-trash text-muted"></span>
|
||||
</button>
|
||||
<?php
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
|
||||
$gateways_title = gettext('Gateways');
|
||||
$gateways_title_link = 'status_gateways.php';
|
||||
$gateways_title_link = 'system_gateways.php';
|
||||
|
||||
@ -39,8 +39,8 @@
|
||||
// add new gateway
|
||||
tr_content.push('<tr id="'+tr_id+'">');
|
||||
tr_content.push('<td><small><strong>'+gateway['name']+'</strong><br/>'+gateway['address']+'</small></td>');
|
||||
tr_content.push('<td>'+gateway['delay']+'</td>');
|
||||
tr_content.push('<td>'+gateway['loss']+'</td>');
|
||||
tr_content.push('<td class="text-nowrap">'+gateway['delay']+'</td>');
|
||||
tr_content.push('<td class="text-nowrap">'+gateway['loss']+'</td>');
|
||||
tr_content.push('<td><span>'+gateway['status_translated']+'</span></td>');
|
||||
tr_content.push('</tr>');
|
||||
tbody.append(tr_content.join(''));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user