[ARVADOS] updated: 812f2714c2908e5b427a8e37032ddcd46fb08297

git at public.curoverse.com git at public.curoverse.com
Thu Sep 4 16:04:29 EDT 2014


Summary of changes:
 .../app/views/application/_choose.html.erb         | 24 ++++++++++------
 .../test/integration/pipeline_instances_test.rb    | 33 ++++++++++++++++++++++
 services/api/test/fixtures/pipeline_templates.yml  | 21 ++++++++++++++
 3 files changed, 69 insertions(+), 9 deletions(-)

       via  812f2714c2908e5b427a8e37032ddcd46fb08297 (commit)
      from  0eb5711ade0f74e556b0a1c10909dbf0bdecb63f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 812f2714c2908e5b427a8e37032ddcd46fb08297
Author: Brett Smith <brett at curoverse.com>
Date:   Thu Sep 4 16:05:57 2014 -0400

    3704: Treat project filters consistently in Workbench chooser.
    
    Before this, a chooser that was loaded on a specific project would
    return empty results if the user selected a different project.  This
    is because it would search for items with two different owner_uuids,
    both the project selected at load time, and the project the user
    selected later.  This patch fixes that by separating the project
    filter from other filters, and preseeding it in the same place where
    it's updated by the project selection AJAX.  Closes #3704, #3778.

diff --git a/apps/workbench/app/views/application/_choose.html.erb b/apps/workbench/app/views/application/_choose.html.erb
index 27ea600..fc16139 100644
--- a/apps/workbench/app/views/application/_choose.html.erb
+++ b/apps/workbench/app/views/application/_choose.html.erb
@@ -7,16 +7,19 @@
       </div>
 
       <div class="modal-body">
+        <% project_filters, chooser_filters = (params[:filters] || []).partition do |attr, op, val|
+             attr == "owner_uuid" and op == "="
+           end %>
         <div class="input-group">
           <% if params[:by_project].to_s != "false" %>
-            <% selected_project_name = 'All projects'
-               @filters.andand.each do |attr, op, val|
-                 if attr == 'owner_uuid' and op == '='
-                   if val == current_user.uuid
-                     selected_project_name = "Home"
-                   else
-                     selected_project_name = Group.find(val).name rescue val
-                   end
+            <% if project_filters.empty?
+                 selected_project_name = 'All projects'
+               else
+                 val = project_filters.last.last
+                 if val == current_user.uuid
+                   selected_project_name = "Home"
+                 else
+                   selected_project_name = Group.find(val).name rescue val
                  end
                end
                %>
@@ -54,7 +57,10 @@
                style="height: 100%; overflow-y: scroll"
                data-infinite-scroller="#choose-scroll"
                id="choose-scroll"
-               data-infinite-content-params-from-chooser="<%= {filters: params[:filters] || []}.to_json %>"
+               data-infinite-content-params-from-chooser="<%= {filters: chooser_filters}.to_json %>"
+               <% if project_filters.any? %>
+                 data-infinite-content-params-from-project-dropdown="<%= {filters: project_filters, project_uuid: project_filters.last.last}.to_json %>"
+               <% end %>
                data-infinite-content-href="<%= url_for partial: true %>">
           </div>
           <% if preview_pane %>
diff --git a/apps/workbench/test/integration/pipeline_instances_test.rb b/apps/workbench/test/integration/pipeline_instances_test.rb
index 85928df..e019813 100644
--- a/apps/workbench/test/integration/pipeline_instances_test.rb
+++ b/apps/workbench/test/integration/pipeline_instances_test.rb
@@ -168,4 +168,37 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest
     assert(page.has_text?("script_parameters"),
            "components JSON not found")
   end
+
+  PROJECT_WITH_SEARCH_COLLECTION = "A Subproject"
+  def check_parameter_search(proj_name)
+    template = api_fixture("pipeline_templates")["parameter_with_search"]
+    search_text = template["components"]["with-search"]["script_parameters"]["input"]["search_for"]
+    visit page_with_token("active", "/pipeline_templates/#{template['uuid']}")
+    click_on "Run this pipeline"
+    within(".modal-dialog") do  # Set project for the new pipeline instance
+      find(".selectable", text: proj_name).click
+      click_on "Choose"
+    end
+    assert(has_text?("From template"), "did not land on pipeline instance page")
+    first("a.btn,button", text: "Choose").click
+    within(".modal-body") do
+      if (proj_name != PROJECT_WITH_SEARCH_COLLECTION)
+        # Switch finder modal to Subproject to find the Collection.
+        click_on proj_name
+        click_on PROJECT_WITH_SEARCH_COLLECTION
+      end
+      assert_equal(search_text, first("input").value,
+                   "parameter search not preseeded")
+      assert(has_text?(api_fixture("collections")["baz_collection_name_in_asubproject"]["name"]),
+             "baz Collection not in preseeded search results")
+    end
+  end
+
+  test "Workbench respects search_for parameter in templates" do
+    check_parameter_search(PROJECT_WITH_SEARCH_COLLECTION)
+  end
+
+  test "Workbench preserves search_for parameter after project switch" do
+    check_parameter_search("A Project")
+  end
 end
diff --git a/services/api/test/fixtures/pipeline_templates.yml b/services/api/test/fixtures/pipeline_templates.yml
index 012cd99..e56fcfa 100644
--- a/services/api/test/fixtures/pipeline_templates.yml
+++ b/services/api/test/fixtures/pipeline_templates.yml
@@ -57,3 +57,24 @@ components_is_jobspec:
         dataclass: Collection
         title: "Foo/bar pair"
         description: "Provide a collection containing at least two files."
+
+parameter_with_search:
+  uuid: zzzzz-p5p6p-paramwsearch345
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  created_at: 2014-04-14 12:35:04 -0400
+  updated_at: 2014-04-14 12:35:04 -0400
+  modified_at: 2014-04-14 12:35:04 -0400
+  modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+  modified_by_user_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  name: Pipeline Template with Input Parameter with Search
+  components:
+    with-search:
+      script: foo
+      script_version: master
+      script_parameters:
+        input:
+          required: true
+          dataclass: Collection
+          title: "Foo/bar pair"
+          description: "Provide a collection containing at least two files."
+          search_for: sometime  # Matches baz_collection_in_asubproject

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list