From 8dcb4daaa7e740f5957043321ccf2c1a7bd2ccb6 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Sun, 24 Aug 2014 23:43:53 -0400 Subject: [PATCH] 3149: Propagate filters from remote->dialog->infinite. Fix tests. --- apps/workbench/app/assets/javascripts/select_modal.js | 10 +++++----- apps/workbench/app/views/application/_choose.html.erb | 1 + .../test/integration/pipeline_instances_test.rb | 8 +++++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/apps/workbench/app/assets/javascripts/select_modal.js b/apps/workbench/app/assets/javascripts/select_modal.js index 1fec3dcb95..dda230f50b 100644 --- a/apps/workbench/app/assets/javascripts/select_modal.js +++ b/apps/workbench/app/assets/javascripts/select_modal.js @@ -75,10 +75,10 @@ $(document).on('click', '.selectable', function() { var project_uuid = $(this).attr('data-project-uuid'); $(this).attr('href', '#'); // Skip normal click handler if (project_uuid) { - params = {'filters[]': JSON.stringify(['owner_uuid', - '=', - project_uuid]), - project_uuid: project_uuid + params = {'filters': [['owner_uuid', + '=', + project_uuid]], + 'project_uuid': project_uuid }; } // Use current selection as dropdown button label @@ -88,7 +88,7 @@ $(document).on('click', '.selectable', function() { html($(this).text() + ' '); // Set (or unset) filter params and refresh filterable rows $($(this).closest('[data-filterable-target]').attr('data-filterable-target')). - data('infinite-content-params', params). + data('infinite-content-params-from-project-dropdown', params). trigger('refresh-content'); }).on('ready', function() { $('form[data-search-modal] a').on('click', function() { diff --git a/apps/workbench/app/views/application/_choose.html.erb b/apps/workbench/app/views/application/_choose.html.erb index aea27f461a..27ea600446 100644 --- a/apps/workbench/app/views/application/_choose.html.erb +++ b/apps/workbench/app/views/application/_choose.html.erb @@ -54,6 +54,7 @@ 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-href="<%= url_for partial: true %>"> <% if preview_pane %> diff --git a/apps/workbench/test/integration/pipeline_instances_test.rb b/apps/workbench/test/integration/pipeline_instances_test.rb index 9c0eb88e39..fa2c309ef6 100644 --- a/apps/workbench/test/integration/pipeline_instances_test.rb +++ b/apps/workbench/test/integration/pipeline_instances_test.rb @@ -41,6 +41,9 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest find('.arv-project-list a,button', text: 'A Project').click find('.btn', text: 'Add data').click within('.modal-dialog') do + find('.dropdown-toggle').click + find('a', text: 'Home').click + wait_for_ajax first('span', text: 'foo_tag').click find('.btn', text: 'Add').click end @@ -62,10 +65,10 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest within('.modal-dialog') do assert(has_text?("Foo/bar pair"), "pipeline input picker missing name of input") + wait_for_ajax first('span', text: 'foo_tag').click find('button', text: 'OK').click end - wait_for_ajax # "Run" button is now enabled @@ -107,7 +110,6 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest # create a pipeline instance find('.btn', text: 'Run a pipeline').click within('.modal-dialog') do - assert page.has_text? 'Two Part Pipeline Template' find('.selectable', text: 'Two Part Pipeline Template').click find('.btn', text: 'Next: choose inputs').click end @@ -120,10 +122,10 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest within('.modal-dialog') do assert_selector 'button.dropdown-toggle', text: 'A Project' + wait_for_ajax first('span', text: 'foo_tag').click find('button', text: 'OK').click end - wait_for_ajax # "Run" button present and enabled -- 2.30.2