From fb58b62b1ad3b03157e1661fbf2fd1c9e463d88a Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Tue, 24 Oct 2023 18:51:41 +0100 Subject: [PATCH] fix jobqueue actions dropdown to get all available --- lib/App/Netdisco/Web/TypeAhead.pm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/App/Netdisco/Web/TypeAhead.pm b/lib/App/Netdisco/Web/TypeAhead.pm index 89b3857e..f74591ec 100644 --- a/lib/App/Netdisco/Web/TypeAhead.pm +++ b/lib/App/Netdisco/Web/TypeAhead.pm @@ -60,21 +60,20 @@ ajax '/ajax/data/queue/typeahead/action' => require_role admin => sub { next; } - next unless $plugin =~ m/::Plugin::([^:]+)::/; + next if $plugin =~ m/::Plugin::Hook$/; + next unless $plugin =~ m/::Plugin::([^:]+)(?:::|$)/; + push @actions, lc $1; } my $q = quotemeta( param('query') || param('term') || param('action') ); - @actions = + push @actions, grep { $q ? m/^$q/ : true } - List::MoreUtils::uniq - sort grep { defined } - @actions, schema(vars->{'tenant'})->resultset('Admin')->get_distinct_col('action'); content_type 'application/json'; - to_json \@actions; + to_json [ List::MoreUtils::uniq sort @actions ]; }; ajax '/ajax/data/queue/typeahead/status' => require_role admin => sub {