From 897e6cc8175865575a809e9fcc6d40ea566ee930 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Thu, 21 Aug 2014 11:03:58 -0400 Subject: [PATCH] 3504: Fixed preload_links_for_objects to use @objects.to_a. Fix collections page to restore link names. Remove obsolete tests for "persist" button. Tweak pipeline instance tests. --- .../app/controllers/projects_controller.rb | 2 +- .../views/collections/_choose_rows.html.erb | 6 +++- .../app/views/collections/show.html.erb | 2 +- .../test/integration/collections_test.rb | 33 ------------------- .../integration/pipeline_instances_test.rb | 4 +-- 5 files changed, 9 insertions(+), 38 deletions(-) diff --git a/apps/workbench/app/controllers/projects_controller.rb b/apps/workbench/app/controllers/projects_controller.rb index 1f4cd3fd4d..d9ec0a6965 100644 --- a/apps/workbench/app/controllers/projects_controller.rb +++ b/apps/workbench/app/controllers/projects_controller.rb @@ -178,7 +178,7 @@ class ProjectsController < ApplicationController @next_page_href = next_page_href(partial: :contents_rows) end - preload_links_for_objects(@objects) + preload_links_for_objects(@objects.to_a) end def show diff --git a/apps/workbench/app/views/collections/_choose_rows.html.erb b/apps/workbench/app/views/collections/_choose_rows.html.erb index 036e619ce1..27b66e4482 100644 --- a/apps/workbench/app/views/collections/_choose_rows.html.erb +++ b/apps/workbench/app/views/collections/_choose_rows.html.erb @@ -3,7 +3,11 @@ data-preview-href="<%= chooser_preview_url_for object %>" style="margin-left: 1em; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #DDDDDD"> - <%= object.name %> + <% if object.respond_to? :name %> + <%= object.name %> + <% else %> + <%= object.uuid %> + <% end %> <% links_for_object(object).each do |tag| %> <% if tag.link_class == 'tag' %> <%= tag.name %> diff --git a/apps/workbench/app/views/collections/show.html.erb b/apps/workbench/app/views/collections/show.html.erb index 183d6d38d6..cc19000725 100644 --- a/apps/workbench/app/views/collections/show.html.erb +++ b/apps/workbench/app/views/collections/show.html.erb @@ -22,7 +22,7 @@

- <% if @object.uuid.match /[0-9a-f]{32}/ %> + <% if @name_link.nil? and @object.uuid.match /[0-9a-f]{32}/ %> Content hash <%= @object.portable_data_hash %> <% else %> <%= if @object.respond_to? :name diff --git a/apps/workbench/test/integration/collections_test.rb b/apps/workbench/test/integration/collections_test.rb index 19720cb752..0e5f2191dd 100644 --- a/apps/workbench/test/integration/collections_test.rb +++ b/apps/workbench/test/integration/collections_test.rb @@ -3,39 +3,6 @@ require 'selenium-webdriver' require 'headless' class CollectionsTest < ActionDispatch::IntegrationTest - def change_persist oldstate, newstate - find "div[data-persistent-state='#{oldstate}']" - page.assert_no_selector "div[data-persistent-state='#{newstate}']" - find('.btn', text: oldstate.capitalize).click - find '.btn', text: newstate.capitalize - page.assert_no_selector '.btn', text: oldstate.capitalize - find "div[data-persistent-state='#{newstate}']" - page.assert_no_selector "div[data-persistent-state='#{oldstate}']" - end - - test "Flip persistent switch at /collections" do - Capybara.current_driver = Capybara.javascript_driver - uuid = api_fixture('collections')['foo_file']['uuid'] - visit page_with_token('active', '/collections') - within "tr[data-object-uuid='#{uuid}']" do - change_persist 'cache', 'persistent' - end - # Refresh page and make sure the change was committed. - visit current_path - within "tr[data-object-uuid='#{uuid}']" do - change_persist 'persistent', 'cache' - end - end - - test 'Flip persistent switch on collection#show' do - Capybara.current_driver = Capybara.javascript_driver - uuid = api_fixture('collections')['foo_file']['uuid'] - visit page_with_token('active', "/collections/#{uuid}") - change_persist 'cache', 'persistent' - visit current_path - change_persist 'persistent', 'cache' - end - test "Collection page renders default name links" do uuid = api_fixture('collections')['foo_file']['uuid'] coll_name = api_fixture('links')['foo_collection_name_in_aproject']['name'] diff --git a/apps/workbench/test/integration/pipeline_instances_test.rb b/apps/workbench/test/integration/pipeline_instances_test.rb index 6385393b24..9c0eb88e39 100644 --- a/apps/workbench/test/integration/pipeline_instances_test.rb +++ b/apps/workbench/test/integration/pipeline_instances_test.rb @@ -40,8 +40,8 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest visit '/projects' find('.arv-project-list a,button', text: 'A Project').click find('.btn', text: 'Add data').click - find('span', text: 'foo_tag').click within('.modal-dialog') do + first('span', text: 'foo_tag').click find('.btn', text: 'Add').click end using_wait_time(Capybara.default_wait_time * 3) do @@ -49,7 +49,7 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest end click_link 'Jobs and pipelines' - find('tr[data-kind="arvados#pipelineInstance"]', text: 'New pipeline instance'). + find('tr[data-kind="arvados#pipelineInstance"]', text: '(none)'). find('a', text: 'Show'). click -- 2.30.2