From cb9667f58c3ad927e571ba797833a7b9edca2365 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Fri, 8 Aug 2014 23:16:18 +0100 Subject: [PATCH] navbar_autocomplete config item to disable main navbar autocomplete --- Netdisco/Changes | 1 + Netdisco/lib/App/Netdisco/Manual/Configuration.pod | 6 ++++++ Netdisco/lib/App/Netdisco/Web/TypeAhead.pm | 2 ++ Netdisco/share/config.yml | 1 + 4 files changed, 10 insertions(+) diff --git a/Netdisco/Changes b/Netdisco/Changes index 71d25ef9..7ab79c19 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -6,6 +6,7 @@ * Support for stuffing other locations into @INC at runtime * New netdisco-do command "show" for diagnostic reporting * Additional debug levels for netdisco-do to show DBIx::Class and net-snmp + * [#107] navbar_autocomplete config item to disable main navbar autocomplete [ENHANCEMENTS] diff --git a/Netdisco/lib/App/Netdisco/Manual/Configuration.pod b/Netdisco/lib/App/Netdisco/Manual/Configuration.pod index e03d1ac9..45302073 100644 --- a/Netdisco/lib/App/Netdisco/Manual/Configuration.pod +++ b/Netdisco/lib/App/Netdisco/Manual/Configuration.pod @@ -103,6 +103,12 @@ database: netdisco=> update users set port_control = true where username = 'guest'; netdisco=> update users set admin = true where username = 'guest'; +=head3 C + +Value: Boolean. Default: C. + +Set this to C to disable the device autocomplete in the main navbar. + =head3 C Value: Boolean. Default: C. diff --git a/Netdisco/lib/App/Netdisco/Web/TypeAhead.pm b/Netdisco/lib/App/Netdisco/Web/TypeAhead.pm index c53e35bc..3994302e 100644 --- a/Netdisco/lib/App/Netdisco/Web/TypeAhead.pm +++ b/Netdisco/lib/App/Netdisco/Web/TypeAhead.pm @@ -8,6 +8,8 @@ use Dancer::Plugin::Auth::Extensible; use App::Netdisco::Util::Web (); # for sort_port ajax '/ajax/data/devicename/typeahead' => require_login sub { + return '[]' unless setting('navbar_autocomplete'); + my $q = param('query') || param('term'); my $set = schema('netdisco')->resultset('Device')->search_fuzzy($q); diff --git a/Netdisco/share/config.yml b/Netdisco/share/config.yml index ac486977..1818672e 100644 --- a/Netdisco/share/config.yml +++ b/Netdisco/share/config.yml @@ -20,6 +20,7 @@ include_paths: [] domain_suffix: "" no_auth: false suggest_guest: false +navbar_autocomplete: true trust_remote_user: false trust_x_remote_user: false #ldap: