#1010 Search port descriptions

This commit is contained in:
Oliver Gorwits
2023-04-03 22:02:43 +01:00
parent 5baad7311d
commit e268b9d522
3 changed files with 20 additions and 2 deletions

View File

@@ -17,7 +17,7 @@ register_search_tab({
api_endpoint => 1,
api_parameters => [
q => {
description => 'Port name or VLAN or MAC address',
description => 'Port name, VLAN, or MAC address',
required => 1,
},
partial => {
@@ -30,6 +30,11 @@ register_search_tab({
type => 'boolean',
default => 'false',
},
descr => {
description => 'Search in the Port Description field',
type => 'boolean',
default => 'false',
},
ethernet => {
description => 'Only Ethernet type interfaces in results',
type => 'boolean',
@@ -76,6 +81,9 @@ get '/ajax/content/search/port' => require_login sub {
-and => [
-or => [
{ "me.name" => ( param('partial') ? $likeclause : $q ) },
( param('descr') ? (
{ "me.descr" => ( param('partial') ? $likeclause : $q ) },
) : () ),
( ((!defined $mac) or $mac->errstr)
? \[ 'me.mac::text ILIKE ?', $likeval ]
: { 'me.mac' => $mac->as_ieee }