Skip to content

Commit

Permalink
STP - various fixes (#13773)
Browse files Browse the repository at this point in the history
* Filter fix
* Add link to device for bridge address and designated root if available
  • Loading branch information
PipoCanaja committed Feb 13, 2022
1 parent 3fb4233 commit 3ac0de1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/Device/Tabs/StpController.php
Expand Up @@ -71,7 +71,7 @@ public function data(Device $device): array
'vlan' => $active_vlan,
'device_id' => $device->device_id,
'stpInstances' => $stpInstances->filter(function ($instance) use ($active_vlan) {
return $active_vlan == 1 && $instance->vlan !== null || $instance->vlan !== $active_vlan;
return $active_vlan == 1 && $instance->vlan !== null || $instance->vlan == $active_vlan;
}),
'stpPorts' => $device->stpPorts()->where('vlan', $active_vlan)->when($active_vlan == 1, function ($query) {
return $query->orWhereNull('vlan');
Expand Down
8 changes: 6 additions & 2 deletions resources/views/device/tabs/stp.blade.php
Expand Up @@ -15,7 +15,9 @@
<td>{{ trans('stp.bridge_address') }}</td>
<td>
{{ \LibreNMS\Util\Rewrite::readableMac($instance['bridgeAddress']) }}
@if($brVendor = \LibreNMS\Util\Rewrite::readableOUI($instance['bridgeAddress']))
@if($url = \LibreNMS\Util\Url::deviceLink(\App\Facades\DeviceCache::get(\App\Models\Stp::where('bridgeAddress', $instance['bridgeAddress'])->value('device_id'))))
({!! $url !!})
@elseif($brVendor = \LibreNMS\Util\Rewrite::readableOUI($instance['bridgeAddress']))
({{ $brVendor }})
@endif
</td>
Expand All @@ -40,7 +42,9 @@
<td>{{ trans('stp.designated_root') }}</td>
<td>
{{ \LibreNMS\Util\Rewrite::readableMac($instance['designatedRoot']) }}
@if($drVendor = \LibreNMS\Util\Rewrite::readableOUI($instance['designatedRoot']))
@if($url = \LibreNMS\Util\Url::deviceLink(\App\Facades\DeviceCache::get(\App\Models\Stp::where('bridgeAddress', $instance['designatedRoot'])->value('device_id'))))
({!! $url !!})
@elseif($drVendor = \LibreNMS\Util\Rewrite::readableOUI($instance['designatedRoot']))
({{ $drVendor }})
@endif
</td>
Expand Down

0 comments on commit 3ac0de1

Please sign in to comment.