Show all subnets (scrollable), and sort, in sidebar Prefix search

This commit is contained in:
Oliver Gorwits
2014-02-22 19:11:27 +00:00
parent db24e4af27
commit 32f2e1d5fa
3 changed files with 7 additions and 7 deletions

View File

@@ -17,6 +17,7 @@
* Try to make the Job Queue page a little faster * Try to make the Job Queue page a little faster
* Require the Net::LDAP module for all installs * Require the Net::LDAP module for all installs
* Move system information to the Netdisco "home" page * Move system information to the Netdisco "home" page
* Show all subnets (scrollable), and sort, in sidebar Prefix search
[BUG FIXES] [BUG FIXES]

View File

@@ -60,7 +60,7 @@ ajax '/ajax/data/subnet/typeahead' => require_login sub {
$q = "$q\%" if $q !~ m/\%/; $q = "$q\%" if $q !~ m/\%/;
my $nets = schema('netdisco')->resultset('Subnet')->search( my $nets = schema('netdisco')->resultset('Subnet')->search(
{ 'me.net::text' => { '-ilike' => $q }}, { 'me.net::text' => { '-ilike' => $q }},
{ columns => ['net'] } ); { columns => ['net'], order_by => 'net' } );
content_type 'application/json'; content_type 'application/json';
to_json [map {$_->net} $nets->all]; to_json [map {$_->net} $nets->all];

View File

@@ -43,14 +43,13 @@
}); });
// activate typeahead on prefix/subnet box // activate typeahead on prefix/subnet box
$('#nd_ipinventory-subnet').typeahead({ $('#nd_ipinventory-subnet').autocomplete({
source: function (query, process) { source: function (request, response) {
return $.get( uri_base + '/ajax/data/subnet/typeahead', { query: query }, function (data) { return $.get( uri_base + '/ajax/data/subnet/typeahead', request, function (data) {
return process(data); return response(data);
}); });
} }
,matcher: function () { return true; } // trust backend ,delay: 150
,delay: 250
,minLength: 3 ,minLength: 3
}); });
}); });