X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/dffa580d39b977746f6950b835b78b949a862c9d..1d5934b254afc9e6082a154b5c365df968b3a65f:/apps/workbench/app/views/collections/show_file_links.html.erb
diff --git a/apps/workbench/app/views/collections/show_file_links.html.erb b/apps/workbench/app/views/collections/show_file_links.html.erb
index 9d61a6a2d9..8a2ce6b826 100644
--- a/apps/workbench/app/views/collections/show_file_links.html.erb
+++ b/apps/workbench/app/views/collections/show_file_links.html.erb
@@ -1,36 +1,86 @@
+<%# Copyright (C) The Arvados Authors. All rights reserved.
+
+SPDX-License-Identifier: AGPL-3.0 %>
+
+<% coll_name = "Collection #{@object.uuid}" %>
+<% link_opts = {controller: 'collections', action: 'show_file',
+ uuid: @object.uuid, reader_token: params[:reader_token]} %>
- <% if content_for? :page_title %>
- <%= yield :page_title %> / <%= Rails.configuration.site_name %>
- <% else %>
- <%= Rails.configuration.site_name %>
- <% end %>
+ <%= coll_name %> / <%= Rails.configuration.site_name %>
+
-<% content_for :page_title do %>
- <%= (@object.respond_to?(:properties) ? @object.properties[:page_title] : nil) ||
- @object.friendly_link_name %>
-<% end %>
-<% if @object.andand.files.andand.any? %>
- <% link_opts = {controller: 'collections', action: 'show_file',
- uuid: @object.uuid, reader_token: params[:reader_token]} %>
-
- <% @object.files.map { |spec|
- CollectionsHelper::file_path(spec)
- }.each do |path| %>
- - <%= link_to(path, link_opts.merge(file: path)) %>
+<%= coll_name %>
+
+This collection of data files is being shared with you through
+Arvados. You can download individual files listed below. To download
+the entire collection with wget, try:
+
+
$ wget --mirror --no-parent --no-host --cut-dirs=3 <%=
+ url_for(link_opts.merge(action: 'show_file_links', only_path: false,
+ trailing_slash: true))
+ %>
+
+File Listing
+
+<% file_tree = @object.andand.files_tree %>
+<% if file_tree.andand.any? %>
+
+ <% dirstack = [file_tree.first.first] %>
+ <% file_tree.take(10000).each_with_index do |(dirname, filename, size), index| %>
+ <% file_path = CollectionsHelper::file_path([dirname, filename]) %>
+ <% while dirstack.any? and (dirstack.last != dirname) %>
+ <% dirstack.pop %>
+ <% end %>
+
+ <% if size.nil? # This is a subdirectory. %>
+ <% dirstack.push(File.join(dirname, filename)) %>
+ <%= filename %>
+
+ <% else %>
+ <%= link_to(filename,
+ link_opts.merge(file: file_path),
+ {title: "Download #{file_path}"}) %>
+
+ <% end %>
<% end %>
-
+ <%= raw(dirstack.map { |_| "" }.join("")) %>
<% else %>
No files in this collection.
<% end %>
+
+
+