VLANs global page, missing changes (#16484)

I had some additional changes that got missed in the main merge.
They are included here.

fix #16472
This commit is contained in:
Tony Murray
2024-10-06 00:13:30 -05:00
committed by GitHub
parent 8c6964adf9
commit d0d7b0cf09
2 changed files with 25 additions and 2 deletions

View File

@@ -10,6 +10,15 @@ use LibreNMS\Util\Url;
class VlanPortsController extends TableController
{
protected function searchFields(Request $request): array
{
return [
'ifName',
'ifDescr',
'ifAlias',
];
}
protected function sortFields($request): array
{
return [
@@ -31,7 +40,7 @@ class VlanPortsController extends TableController
return Port::with('device')
->leftJoin('ports_vlans', 'ports.port_id', 'ports_vlans.port_id')
->where(function ($query) {
$query->where('ifVlan', $this->vlanId)
$query->where(fn ($q) => $q->where('ifVlan', $this->vlanId)->whereNull('ports_vlans.vlan'))
->orWhere('ports_vlans.vlan', $this->vlanId);
})
->select([
@@ -58,7 +67,7 @@ class VlanPortsController extends TableController
{
return [
'device' => Url::deviceLink($model->device),
'port' => Url::portLink($model),
'port' => Url::portLink($model, $model->getFullLabel()),
// left joined columns
'untagged' => $model['untagged'],
'state' => $model['state'],