From 32f2e1d5fae30dfd0d8949e27405a8d16cac041f Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sat, 22 Feb 2014 19:11:27 +0000 Subject: [PATCH] Show all subnets (scrollable), and sort, in sidebar Prefix search --- Netdisco/Changes | 1 + Netdisco/lib/App/Netdisco/Web/TypeAhead.pm | 2 +- Netdisco/share/views/js/report.js | 11 +++++------ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Netdisco/Changes b/Netdisco/Changes index 3315bfc1..7a485d4b 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -17,6 +17,7 @@ * Try to make the Job Queue page a little faster * Require the Net::LDAP module for all installs * Move system information to the Netdisco "home" page + * Show all subnets (scrollable), and sort, in sidebar Prefix search [BUG FIXES] diff --git a/Netdisco/lib/App/Netdisco/Web/TypeAhead.pm b/Netdisco/lib/App/Netdisco/Web/TypeAhead.pm index 16780f88..c53e35bc 100644 --- a/Netdisco/lib/App/Netdisco/Web/TypeAhead.pm +++ b/Netdisco/lib/App/Netdisco/Web/TypeAhead.pm @@ -60,7 +60,7 @@ ajax '/ajax/data/subnet/typeahead' => require_login sub { $q = "$q\%" if $q !~ m/\%/; my $nets = schema('netdisco')->resultset('Subnet')->search( { 'me.net::text' => { '-ilike' => $q }}, - { columns => ['net'] } ); + { columns => ['net'], order_by => 'net' } ); content_type 'application/json'; to_json [map {$_->net} $nets->all]; diff --git a/Netdisco/share/views/js/report.js b/Netdisco/share/views/js/report.js index f4dd9200..abb513bf 100644 --- a/Netdisco/share/views/js/report.js +++ b/Netdisco/share/views/js/report.js @@ -43,14 +43,13 @@ }); // activate typeahead on prefix/subnet box - $('#nd_ipinventory-subnet').typeahead({ - source: function (query, process) { - return $.get( uri_base + '/ajax/data/subnet/typeahead', { query: query }, function (data) { - return process(data); + $('#nd_ipinventory-subnet').autocomplete({ + source: function (request, response) { + return $.get( uri_base + '/ajax/data/subnet/typeahead', request, function (data) { + return response(data); }); } - ,matcher: function () { return true; } // trust backend - ,delay: 250 + ,delay: 150 ,minLength: 3 }); });