3438: Show input title when choosing Collections for pipeline instances.
authorBrett Smith <brett@curoverse.com>
Thu, 7 Aug 2014 14:44:53 +0000 (10:44 -0400)
committerBrett Smith <brett@curoverse.com>
Thu, 7 Aug 2014 14:44:53 +0000 (10:44 -0400)
Closes #3438.

apps/workbench/app/helpers/application_helper.rb
apps/workbench/app/models/pipeline_instance.rb
apps/workbench/app/views/pipeline_instances/_show_inputs.html.erb
apps/workbench/test/integration/pipeline_instances_test.rb

index ec29b03a2d3f77e8dedfe62370b7c0119d985e0b..11300367b9acaa2520578a1c0acffb17082dad73 100644 (file)
@@ -260,8 +260,13 @@ module ApplicationHelper
           display_value = value_info[:link_name]
         end
       end
+      if (attr == :components) and (subattr.size > 2)
+        chooser_title = "Choose a dataset for #{object.component_input_title(subattr[0], subattr[2])}:"
+      else
+        chooser_title = "Choose a dataset:"
+      end
       modal_path = choose_collections_path \
-      ({ title: 'Choose a dataset:',
+      ({ title: chooser_title,
          filters: [['tail_uuid', '=', object.owner_uuid]].to_json,
          action_name: 'OK',
          action_href: pipeline_instance_path(id: object.uuid),
index c3b14755f3fb6f8dbdf77d3630e689797cca8eea..fa9fab68eb6e149ecef2e062ff332aa9a6f42fd4 100644 (file)
@@ -28,7 +28,7 @@ class PipelineInstance < ArvadosBase
       end
     end
   end
-  
+
   def attribute_editable? attr, *args
     super && (attr.to_sym == :name ||
               (attr.to_sym == :components and
@@ -42,4 +42,11 @@ class PipelineInstance < ArvadosBase
   def self.creatable?
     false
   end
+
+  def component_input_title(component_name, input_name)
+    component = components[component_name]
+    return nil if component.nil?
+    component[:script_parameters].andand[input_name.to_sym].andand[:title] ||
+      "\"#{input_name.to_s}\" parameter for #{component[:script]} script in #{component_name} component"
+  end
 end
index 5106710b0eb1c580ca5f393f265b806f64c914c6..45739192861efe22d26a287ed6f7610c3c1d9e36 100644 (file)
@@ -12,8 +12,7 @@
                   not pvalue_spec[:value])) %>
             <% n_inputs += 1 %>
             <label for="<% "#{cname}-#{pname}" %>">
-              <%= pvalue_spec[:title] ||
-                  "\"#{pname.to_s}\" parameter for #{component[:script]} script in #{cname} component" %>
+              <%= @object.component_input_title(cname, pname) %>
             </label>
             <div>
               <p class="form-control-static">
index f5d6e633f340ea85cb7e438c35b208e7c3a13510..56e2c6909fc12e204b8bdbcd4e1ca23ad4a32196 100644 (file)
@@ -57,6 +57,8 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest
       click
 
     within('.modal-dialog') do
+      assert(has_text?("Foo/bar pair"),
+             "pipeline input picker missing name of input")
       first('span', text: 'foo_tag').click
       find('button', text: 'OK').click
     end