3177: store input pdh value even when input dataclass is File. Update two tests to...
authorradhika <radhika@curoverse.com>
Thu, 6 Nov 2014 13:01:39 +0000 (08:01 -0500)
committerradhika <radhika@curoverse.com>
Thu, 6 Nov 2014 13:01:39 +0000 (08:01 -0500)
apps/workbench/app/controllers/pipeline_instances_controller.rb
apps/workbench/app/helpers/application_helper.rb
apps/workbench/test/integration/pipeline_instances_test.rb

index fa724b82b4480f1d481c35070442ad65d603f071..ef97b1e5bfa6dea260de1d4fea699e0c46287521 100644 (file)
@@ -64,11 +64,12 @@ class PipelineInstancesController < ApplicationController
         if component[:script_parameters]
           component[:script_parameters].each do |param, value_info|
             if value_info.is_a? Hash
-              value_info_class = resource_class_for_uuid(value_info[:value])
+              value_info_partitioned = value_info[:value].partition('/')
+              value_info_class = resource_class_for_uuid(value_info_partitioned[0])
               if value_info_class == Link
                 # Use the link target, not the link itself, as script
                 # parameter; but keep the link info around as well.
-                link = Link.find value_info[:value]
+                link = Link.find value_info_partitioned[0]
                 value_info[:value] = link.head_uuid
                 value_info[:link_uuid] = link.uuid
                 value_info[:link_name] = link.name
@@ -81,10 +82,10 @@ class PipelineInstancesController < ApplicationController
                 # to ensure reproducibility, the script_parameter for a
                 # collection should be the portable_data_hash
                 # keep the collection name and uuid for human-readability
-                obj = Collection.find value_info[:value]
-                value_info[:value] = obj.portable_data_hash
+                obj = Collection.find value_info_partitioned[0]
+                value_info[:value] = obj.portable_data_hash + value_info_partitioned[1] + value_info_partitioned[2]
                 value_info[:selection_uuid] = obj.uuid
-                value_info[:selection_name] = obj.name
+                value_info[:selection_name] = obj.name + value_info_partitioned[1] + value_info_partitioned[2]
               end
             end
           end
index 65eb73681d5de02e9bcdc484b46000a4be672be7..213f5c2792b9ab42840abd8f3207d176c83b797d 100644 (file)
@@ -287,7 +287,7 @@ module ApplicationHelper
          preconfigured_search_str: (preconfigured_search_str || ""),
          action_data: {
            merge: true,
-           use_checkbox_selection: dataclass == File ? true : false,
+           use_checkbox_selection: dataclass == File ? true : nil,
            selection_param: selection_param,
            success: 'page-refresh'
          }.to_json,
index 7095a87442ab9179f39a9918ec2fc061148eea66..f4860ffd7dbf401a2ab1f65e7c70003696b9ad26 100644 (file)
@@ -29,13 +29,6 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest
 
     instance_page = current_path
 
-    # Go over to the collections page and select something
-    visit '/collections'
-    within('tr', text: 'GNU_General_Public_License') do
-      find('input[type=checkbox]').click
-    end
-    find('#persistent-selection-count').click
-
     # Add this collection to the project
     visit '/projects'
     find("#projects-menu").click
@@ -106,13 +99,6 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest
   test 'Create pipeline inside a project and run' do
     visit page_with_token('active_trustedclient')
 
-    # Go over to the collections page and select something
-    visit '/collections'
-    within('tr', text: 'GNU_General_Public_License') do
-      find('input[type=checkbox]').click
-    end
-    find('#persistent-selection-count').click
-
     # Add this collection to the project using collections menu from top nav
     visit '/projects'
     find("#projects-menu").click
@@ -322,9 +308,9 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest
     click_link 'API response'
     api_response = JSON.parse(find('div#advanced_api_response pre').text)
     input_params = api_response['components']['part-one']['script_parameters']['input']
-    assert_equal input_params['value'], col['portable_data_hash']
-    assert_equal input_params['selection_name'], col['name']
-    assert_equal input_params['selection_uuid'], col['uuid']
+    assert_equal(input_params['value'], col['portable_data_hash'], "Not found expected input param value")
+    assert_equal(input_params['selection_name'], col['name'], "Not found expected input param name")
+    assert_equal(input_params['selection_uuid'], col['uuid'], "Not found expected input param uuid")
 
     # "Run" button present and enabled
     page.assert_no_selector 'a.disabled,button.disabled', text: 'Run'