fix search by device interface IP
This commit is contained in:
		| @@ -90,7 +90,7 @@ get '/device' => sub { | ||||
|     my $q = param('q'); | ||||
|     my $dev = schema('netdisco')->resultset('Device')->single({ | ||||
|         -or => [ | ||||
|             'me.ip::text' => $q, | ||||
|             \[ 'host(me.ip) = ?' => [ bind_value => $q ] ], | ||||
|             'me.dns' => $q, | ||||
|         ], | ||||
|     }); | ||||
|   | ||||
| @@ -78,8 +78,11 @@ get '/search' => sub { | ||||
|             if ($nd and $nd->count) { | ||||
|                 if ($nd->count == 1) { | ||||
|                     # redirect to device details for the one device | ||||
|                     return redirect uri_for('/device', | ||||
|                         {tab => 'details', q => $q, f => ''}); | ||||
|                     return redirect uri_for('/device', { | ||||
|                       tab => 'details', | ||||
|                       q => ($nd->first->dns || $nd->first->ip), | ||||
|                       f => '', | ||||
|                     }); | ||||
|                 } | ||||
|  | ||||
|                 # multiple devices | ||||
|   | ||||
		Reference in New Issue
	
	Block a user