3504: Fixed preload_links_for_objects to use @objects.to_a. Fix collections
authorPeter Amstutz <peter.amstutz@curoverse.com>
Thu, 21 Aug 2014 15:03:58 +0000 (11:03 -0400)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Thu, 21 Aug 2014 15:03:58 +0000 (11:03 -0400)
page to restore link names.  Remove obsolete tests for "persist" button.  Tweak
pipeline instance tests.

apps/workbench/app/controllers/projects_controller.rb
apps/workbench/app/views/collections/_choose_rows.html.erb
apps/workbench/app/views/collections/show.html.erb
apps/workbench/test/integration/collections_test.rb
apps/workbench/test/integration/pipeline_instances_test.rb

index 1f4cd3fd4d0688a68f94ea996ef019cd1e3901c2..d9ec0a6965323eb29d10b4b2d695218eaabfdbfe 100644 (file)
@@ -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
index 036e619ce116edf2c17cb9cadd669fe1aad58c46..27b66e4482314f3121a0f46e8ae9dd21cfe20766 100644 (file)
@@ -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">
       <i class="fa fa-fw fa-archive"></i>
-      <%= 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' %>
           <span class="label label-info"><%= tag.name %></span>
index 183d6d38d6601b647082c0b227304eb70a20aba2..cc19000725526059fb6ded363928b9cd4823195b 100644 (file)
@@ -22,7 +22,7 @@
     <div class="panel panel-info">
       <div class="panel-heading">
        <h3 class="panel-title">
-          <% 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
index 19720cb752cfc83823e77337956d08c29b4227b6..0e5f2191ddf694921a9d38011378cf1da2ee2980 100644 (file)
@@ -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']
index 6385393b24f2c82cbb068e85aea4918d9844d379..9c0eb88e3941b6ec88939c806948adb26f9bf0ba 100644 (file)
@@ -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