From 3fefb5b7f084a68187a3100ba13df95e30223d27 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Mon, 27 Aug 2012 21:17:08 +0100 Subject: [PATCH] Port filter supports basic */?/%/_ wildcards (closes #25) --- Changes | 1 + Netdisco/lib/Netdisco/Web/Device.pm | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Changes b/Changes index 77535ac2..e0b87c4e 100644 --- a/Changes +++ b/Changes @@ -6,6 +6,7 @@ * Typeahead on the main navbar search (for devices only) * Support for have_nodeip_dns_col setting (closes #14) * Set focus to navbar search on initial login or when changing to home (closes #24) + * Port filter supports basic */?/%/_ wildcards (closes #25) [ENHANCEMENTS] diff --git a/Netdisco/lib/Netdisco/Web/Device.pm b/Netdisco/lib/Netdisco/Web/Device.pm index 7669c64f..77feda73 100644 --- a/Netdisco/lib/Netdisco/Web/Device.pm +++ b/Netdisco/lib/Netdisco/Web/Device.pm @@ -113,6 +113,10 @@ ajax '/ajax/content/device/ports' => sub { return unless $set->count; } else { + $q =~ s/\*/%/g if index($q, '*') >= 0; + $q =~ s/\?/_/g if index($q, '?') >= 0; + $q = { '-ilike' => $q }; + if ($set->search({'me.port' => $q})->count) { $set = $set->search({'me.port' => $q}); }