RELATION_LIMIT = 5
def show_pane_list
- return @panes if @panes.andand.any?
- @panes = %w(Files Upload Provenance_graph Used_by Advanced)
- @panes = @panes - %w(Upload) unless (@object.editable? rescue false)
- @panes
+ if current_user and CollectionsHelper.match(@object.uuid)
+ panes = %w(Hash_matches)
+ else
+ panes = %w(Files Upload Provenance_graph Used_by Advanced)
+ panes = panes - %w(Upload) unless (@object.editable? rescue false)
+ panes
+ end
end
def set_persistent
end
# This pdh has more than one uuid matching. Show the hash matches page listing those uuids.
- @panes = %w(Hash_matches)
else
jobs_with = lambda do |conds|
Job.limit(RELATION_LIMIT).where(conds)
end
def tab_counts
- @limit = 1
- @filters = [["portable_data_hash", "=", @object.portable_data_hash]]
- @objects = find_objects_for_index
@tab_counts = {}
- @tab_counts['Hash_matches'] = @objects.andand.items_available
+ if show_pane_list.include? "Hash_matches"
+ @limit = 1
+ @filters = [["portable_data_hash", "=", @object.portable_data_hash]]
+ @objects = find_objects_for_index
+ @tab_counts['Hash_matches'] = @objects.andand.items_available
+ end
+ @tab_counts
end
def sharing_popup
assert page.has_no_text?("Sharing and permissions")
end
+ test "Collection portable data hash with more than one page of multiple matches" do
+ pdh = api_fixture('collections')['baz_file']['portable_data_hash']
+ visit page_with_token('admin', "/collections/#{pdh}")
+
+ matches = api_fixture('collections').select {|k,v| v["portable_data_hash"] == pdh}
+ assert matches.size > 1
+
+ (0..10).each do
+ within(".arv-collection-Hash_matches") do
+ page.execute_script "window.scrollBy(0,999000)"
+ begin
+ wait_for_ajax
+ rescue
+ end
+ end
+ end
+
+ matches.each do |k,v|
+ assert page.has_link?(v["name"]), "Page /collections/#{pdh} should contain link '#{v['name']}'"
+ end
+ assert page.has_no_text?("Activity")
+ assert page.has_no_text?("Sharing and permissions")
+ end
+
test "Filtering collection files by regexp" do
col = api_fixture('collections', 'multilevel_collection_1')
visit page_with_token('active', "/collections/#{col['uuid']}")