From 64313ed85a57abd0dc7bd45979a33c071153551c Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Tue, 24 Oct 2023 20:05:35 +0100 Subject: [PATCH] fix again the job type dropdown on jobqueue --- lib/App/Netdisco/Web/TypeAhead.pm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/App/Netdisco/Web/TypeAhead.pm b/lib/App/Netdisco/Web/TypeAhead.pm index f74591ec..694b8351 100644 --- a/lib/App/Netdisco/Web/TypeAhead.pm +++ b/lib/App/Netdisco/Web/TypeAhead.pm @@ -66,14 +66,19 @@ ajax '/ajax/data/queue/typeahead/action' => require_role admin => sub { push @actions, lc $1; } - my $q = quotemeta( param('query') || param('term') || param('action') ); push @actions, - grep { $q ? m/^$q/ : true } - grep { defined } schema(vars->{'tenant'})->resultset('Admin')->get_distinct_col('action'); + my $q = quotemeta( param('query') || param('term') || param('action') ); + content_type 'application/json'; - to_json [ List::MoreUtils::uniq sort @actions ]; + to_json [ + grep { $q ? m/^$q/ : true } + grep { defined } + List::MoreUtils::uniq + sort + @actions + ]; }; ajax '/ajax/data/queue/typeahead/status' => require_role admin => sub {