Fix to show Routing Count in Pagemenu Selector (#12111)

This commit is contained in:
SourceDoctor
2020-09-20 01:24:53 +02:00
committed by GitHub
parent 509dc027f1
commit 65b294c7cb
2 changed files with 13 additions and 13 deletions
@@ -38,15 +38,15 @@ class RoutingController implements DeviceTab
{
$device = DeviceCache::getPrimary();
$this->tabs = [
'ospf' => $device->ospfInstances()->exists(),
'bgp' => $device->bgppeers()->exists(),
'vrf' => $device->vrfs()->exists(),
'cef' => $device->cefSwitching()->exists(),
'mpls' => $device->mplsLsps()->exists(),
'cisco-otv' => Component::query()->where('device_id', $device->device_id)->where('type', 'Cisco-OTV')->exists(),
'loadbalancer_rservers' => $device->rServers()->exists(),
'ipsec_tunnels' => $device->ipsecTunnels()->exists(),
'routes' => $device->routes()->exists(),
'ospf' => $device->ospfInstances()->count(),
'bgp' => $device->bgppeers()->count(),
'vrf' => $device->vrfs()->count(),
'cef' => $device->cefSwitching()->count(),
'mpls' => $device->mplsLsps()->count(),
'cisco-otv' => Component::query()->where('device_id', $device->device_id)->where('type', 'Cisco-OTV')->count(),
'loadbalancer_rservers' => $device->rServers()->count(),
'ipsec_tunnels' => $device->ipsecTunnels()->count(),
'routes' => $device->routes()->count(),
];
}
@@ -73,7 +73,7 @@ class RoutingController implements DeviceTab
public function data(Device $device): array
{
return [
'routing_tabs' => array_keys(array_filter($this->tabs))
'routing_tabs' => array_filter($this->tabs)
];
}
}
+3 -3
View File
@@ -31,7 +31,7 @@ $pagetitle[] = 'Routing';
echo "<span style='font-weight: bold;'>Routing</span> &#187; ";
unset($sep);
foreach ($routing_tabs as $type) {
foreach ($routing_tabs as $type => $type_count) {
if (!$vars['proto']) {
$vars['proto'] = $type;
}
@@ -42,7 +42,7 @@ foreach ($routing_tabs as $type) {
echo '<span class="pagemenu-selected">';
}
echo generate_link($type_text[$type].' ('.$device_routing_count[$type].')', $link_array, array('proto' => $type));
echo generate_link($type_text[$type].' ('.$type_count.')', $link_array, array('proto' => $type));
if ($vars['proto'] == $type) {
echo '</span>';
}
@@ -56,7 +56,7 @@ $protocol = basename($vars['proto']);
if (is_file("includes/html/pages/device/routing/$protocol.inc.php")) {
include "includes/html/pages/device/routing/$protocol.inc.php";
} else {
foreach ($routing_tabs as $type) {
foreach ($routing_tabs as $type => $type_count) {
if ($type != 'overview') {
if (is_file("includes/html/pages/device/routing/overview/$type.inc.php")) {
$g_i++;