From: Tim Pierce Date: Tue, 28 Oct 2014 15:14:47 +0000 (-0400) Subject: 4088: filter collection file view by regex X-Git-Tag: 1.1.0~2060^2~3 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/e34135f6779f58852558e03b1b95534c11ca07ae 4088: filter collection file view by regex Added a "Filter" field for supplying a regular expression to filter filenames. Updated integration tests. --- diff --git a/apps/workbench/app/views/collections/_show_files.html.erb b/apps/workbench/app/views/collections/_show_files.html.erb index 051fbf4f62..9b39b61d44 100644 --- a/apps/workbench/app/views/collections/_show_files.html.erb +++ b/apps/workbench/app/views/collections/_show_files.html.erb @@ -17,10 +17,29 @@ +
+ <%= form_tag collection_path(@object.uuid), {method: 'get'} do %> + + + <% end %> +

<% end %> +<% + file_regex = nil + if params[:file_regex] + begin + file_regex = Regexp.new(params[:file_regex]) + rescue RegexpError + # If the pattern is not a valid regex, quote it + # (i.e. use it as a simple substring search) + file_regex = Regexp.new(Regexp.quote(params[:file_regex])) + end + end +%> + <% file_tree = @object.andand.files_tree %> <% if file_tree.nil? or file_tree.empty? %>

This collection is empty.

@@ -40,6 +59,9 @@