#667 Network Map: Filter by VLAN doesnt work as expected
This commit is contained in:
@@ -141,6 +141,18 @@ __PACKAGE__->has_many(
|
|||||||
'ip', { join_type => 'RIGHT' }
|
'ip', { join_type => 'RIGHT' }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
=head2 port_vlans_filter
|
||||||
|
|
||||||
|
A JOIN condition which can be used to filter a set of Devices to those known
|
||||||
|
carrying a given VLAN on its ports. Uses an INNER JOIN to achieve this.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
__PACKAGE__->has_many(
|
||||||
|
port_vlans_filter => 'App::Netdisco::DB::Result::DevicePortVlan',
|
||||||
|
'ip', { join_type => 'INNER' }
|
||||||
|
);
|
||||||
|
|
||||||
# helper which assumes we've just RIGHT JOINed to Vlans table
|
# helper which assumes we've just RIGHT JOINed to Vlans table
|
||||||
sub vlan { return (shift)->vlans->first }
|
sub vlan { return (shift)->vlans->first }
|
||||||
|
|
||||||
|
|||||||
@@ -211,8 +211,8 @@ ajax '/ajax/data/device/netmap' => require_login sub {
|
|||||||
# filter by vlan for all or neighbors only
|
# filter by vlan for all or neighbors only
|
||||||
if ($vlan) {
|
if ($vlan) {
|
||||||
$devices = $devices->search(
|
$devices = $devices->search(
|
||||||
{ 'vlans.vlan' => $vlan },
|
{ 'port_vlans_filter.vlan' => $vlan },
|
||||||
{ join => 'vlans' }
|
{ join => 'port_vlans_filter' }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user