diff --git a/Netdisco/Changes b/Netdisco/Changes index 1c271fd1..0d6a785b 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -1,11 +1,16 @@ 2.005000_003 - 2013-02-24 + [NEW FEATURES] + + * Partial Match option when searching on device port name + [ENHANCEMENTS] * random() and LIMIT the number of daemon jobs requested from Netdisco queue * Remove Daemon's job queue DBIC schema from user config * Add log messages to the Daemon * Use Path::Class for path and file name construction consistently + * Avoid use of DNS when looking up devices in DB by IP 2.005000_002 - 2013-02-10 diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Node.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Node.pm index ab49509f..08fa3e30 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Node.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Node.pm @@ -50,7 +50,7 @@ ajax '/ajax/content/search/node' => sub { } else { if (param('partial')) { - $node = "\%$node\%"; + $node = "\%$node\%" if $node !~ m/%/; } elsif (setting('domain_suffix')) { $node .= setting('domain_suffix') diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Port.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Port.pm index 6a18fdb8..bdabb865 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Port.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Port.pm @@ -15,10 +15,17 @@ ajax '/ajax/content/search/port' => sub { my $set; if ($q =~ m/^\d+$/) { - $set = schema('netdisco')->resultset('DevicePort')->search({vlan => $q}); + $set = schema('netdisco')->resultset('DevicePort') + ->search({vlan => $q}); } else { - $set = schema('netdisco')->resultset('DevicePort')->search({name => $q}); + my $query = $q; + if (param('partial')) { + $q = "\%$q\%" if $q !~ m/%/; + $query = { -ilike => $q }; + } + $set = schema('netdisco')->resultset('DevicePort') + ->search({name => $query}); } return unless $set->count; diff --git a/Netdisco/share/views/sidebar/search/port.tt b/Netdisco/share/views/sidebar/search/port.tt new file mode 100644 index 00000000..1c3f0ef0 --- /dev/null +++ b/Netdisco/share/views/sidebar/search/port.tt @@ -0,0 +1,13 @@ + +

Port Search Options

+ +
+ + +
+