search device_module table for serial when searching devices

This commit is contained in:
Oliver Gorwits
2014-07-28 22:26:31 +01:00
parent 18f507ec56
commit 96c778e233
2 changed files with 13 additions and 2 deletions

View File

@@ -92,6 +92,15 @@ all the interface IP aliases configured on the Device.
__PACKAGE__->has_many( device_ips => 'App::Netdisco::DB::Result::DeviceIp', 'ip' );
=head2 device_modules
Returns rows from the C<device_module> table which relate to this Device. That
is, all the constituent modiles within the Device.
=cut
__PACKAGE__->has_many( device_modules => 'App::Netdisco::DB::Result::DeviceModule', 'ip' );
=head2 vlans
Returns the C<device_vlan> entries for this Device. That is, the list of VLANs

View File

@@ -275,7 +275,7 @@ The following fields are inspected for a match:
=item contact
=item serial
=item serial (including modules)
=item location
@@ -287,6 +287,7 @@ The following fields are inspected for a match:
=item ip (including aliases)
=back
=cut
@@ -318,6 +319,7 @@ sub search_fuzzy {
-or => [
'me.contact' => { '-ilike' => $q },
'me.serial' => { '-ilike' => $q },
'device_modules.serial' => { '-ilike' => $q },
'me.location' => { '-ilike' => $q },
'me.name' => { '-ilike' => $q },
'me.description' => { '-ilike' => $q },
@@ -330,7 +332,7 @@ sub search_fuzzy {
},
{
order_by => [qw/ me.dns me.ip /],
join => 'device_ips',
join => [qw/device_ips device_modules/],
distinct => 1,
}
);