From 31e3106b0f4b5ec8cd7e251bc6827a64063c1b0c Mon Sep 17 00:00:00 2001 From: Peter Amstutz <pamstutz@veritasgenetics.com> Date: Fri, 23 Feb 2018 16:29:06 -0500 Subject: [PATCH] 12315: Propagate show_children to infinite scroll pages. Fix & add tests. Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz@veritasgenetics.com> --- .../app/controllers/work_units_controller.rb | 6 ++- .../work_units/_show_all_processes.html.erb | 4 +- .../controllers/work_units_controller_test.rb | 2 +- .../test/integration/work_units_test.rb | 47 ++++++++++++------- 4 files changed, 39 insertions(+), 20 deletions(-) diff --git a/apps/workbench/app/controllers/work_units_controller.rb b/apps/workbench/app/controllers/work_units_controller.rb index dc10d97fb6..d2896821b2 100644 --- a/apps/workbench/app/controllers/work_units_controller.rb +++ b/apps/workbench/app/controllers/work_units_controller.rb @@ -17,6 +17,9 @@ class WorkUnitsController < ApplicationController @limit = 20 @filters = @filters || [] + pipelines = [] + jobs = [] + # get next page of pipeline_instances if PipelineInstance.api_exists?(:index) filters = @filters + [["uuid", "is_a", ["arvados#pipelineInstance"]]] @@ -42,7 +45,8 @@ class WorkUnitsController < ApplicationController if @objects.any? @next_page_filters = next_page_filters('<=') @next_page_href = url_for(partial: :all_processes_rows, - filters: @next_page_filters.to_json) + filters: @next_page_filters.to_json, + show_children: params[:show_children]) preload_links_for_objects(@objects.to_a) else @next_page_href = nil diff --git a/apps/workbench/app/views/work_units/_show_all_processes.html.erb b/apps/workbench/app/views/work_units/_show_all_processes.html.erb index c06a88e5a2..0d6d831699 100644 --- a/apps/workbench/app/views/work_units/_show_all_processes.html.erb +++ b/apps/workbench/app/views/work_units/_show_all_processes.html.erb @@ -11,8 +11,8 @@ SPDX-License-Identifier: AGPL-3.0 %> </div> <div class="checkbox"> <label> - <input id="ExcludeChildProcs" type="checkbox" class="filterable-control" - data-on-value="{"show_c1hildren":true}" + <input id="IncludeChildProcs" type="checkbox" class="filterable-control" + data-on-value="{"show_children":true}" data-off-value="{}" data-filterable-target="#all-processes-scroll" /> Show child processes diff --git a/apps/workbench/test/controllers/work_units_controller_test.rb b/apps/workbench/test/controllers/work_units_controller_test.rb index 342cd7a938..a698b8df3c 100644 --- a/apps/workbench/test/controllers/work_units_controller_test.rb +++ b/apps/workbench/test/controllers/work_units_controller_test.rb @@ -32,7 +32,7 @@ class WorkUnitsControllerTest < ActionController::TestCase '/container_requests/zzzzz-xvhdp-cr4completedcr2']], ].each do |search_filter, expected_min, expected_max, expected, not_expected| test "all_processes page for search filter '#{search_filter}'" do - work_units_index(filters: [['any','@@', search_filter]]) + work_units_index(filters: [['any','@@', search_filter]], show_children: true) assert_response :success # Verify that expected number of processes are found diff --git a/apps/workbench/test/integration/work_units_test.rb b/apps/workbench/test/integration/work_units_test.rb index 511e5119db..4dd449551a 100644 --- a/apps/workbench/test/integration/work_units_test.rb +++ b/apps/workbench/test/integration/work_units_test.rb @@ -12,21 +12,35 @@ class WorkUnitsTest < ActionDispatch::IntegrationTest need_javascript end - test "scroll all_processes page" do - expected_min, expected_max, expected, not_expected = [ - 25, 100, - ['/pipeline_instances/zzzzz-d1hrv-1yfj61234abcdk3', - '/pipeline_instances/zzzzz-d1hrv-jobspeccomponts', - '/jobs/zzzzz-8i9sb-grx15v5mjnsyxk7', - '/jobs/zzzzz-8i9sb-n7omg50bvt0m1nf', - '/container_requests/zzzzz-xvhdp-cr4completedcr2', - '/container_requests/zzzzz-xvhdp-cr4requestercn2'], - ['/pipeline_instances/zzzzz-d1hrv-scarxiyajtshq3l', - '/container_requests/zzzzz-xvhdp-oneof60crs00001'] - ] - + [[true, 25, 100, + ['/pipeline_instances/zzzzz-d1hrv-1yfj61234abcdk3', + '/pipeline_instances/zzzzz-d1hrv-jobspeccomponts', + '/jobs/zzzzz-8i9sb-grx15v5mjnsyxk7', + '/jobs/zzzzz-8i9sb-n7omg50bvt0m1nf', + '/container_requests/zzzzz-xvhdp-cr4completedcr2', + '/container_requests/zzzzz-xvhdp-cr4requestercn2'], + ['/pipeline_instances/zzzzz-d1hrv-scarxiyajtshq3l', + '/container_requests/zzzzz-xvhdp-oneof60crs00001']], + [false, 25, 100, + ['/pipeline_instances/zzzzz-d1hrv-1yfj61234abcdk3', + '/pipeline_instances/zzzzz-d1hrv-jobspeccomponts', + '/container_requests/zzzzz-xvhdp-cr4completedcr2'], + ['/pipeline_instances/zzzzz-d1hrv-scarxiyajtshq3l', + '/container_requests/zzzzz-xvhdp-oneof60crs00001', + '/jobs/zzzzz-8i9sb-grx15v5mjnsyxk7', + '/jobs/zzzzz-8i9sb-n7omg50bvt0m1nf', + '/container_requests/zzzzz-xvhdp-cr4requestercn2' + ]] + ].each do |expects| + test "scroll all_processes page with show_children #{expects[0]}" do + show_children, expected_min, expected_max, expected, not_expected = expects visit page_with_token('active', "/all_processes") + if show_children + find('#IncludeChildProcs').click + wait_for_ajax + end + page_scrolls = expected_max/20 + 2 within('.arv-recent-all-processes') do (0..page_scrolls).each do |i| @@ -43,13 +57,13 @@ class WorkUnitsTest < ActionDispatch::IntegrationTest found_count = found_items.count if expected_min == expected_max assert_equal(true, found_count == expected_min, - "Not found expected number of items. Expected #{expected_min} and found #{found_count}") + "Not found expected number of items. Expected #{expected_min} and found #{found_count}") assert page.has_no_text? 'request failed' else assert_equal(true, found_count>=expected_min, - "Found too few items. Expected at least #{expected_min} and found #{found_count}") + "Found too few items. Expected at least #{expected_min} and found #{found_count}") assert_equal(true, found_count<=expected_max, - "Found too many items. Expected at most #{expected_max} and found #{found_count}") + "Found too many items. Expected at most #{expected_max} and found #{found_count}") end # verify that all expected uuid links are found @@ -61,6 +75,7 @@ class WorkUnitsTest < ActionDispatch::IntegrationTest not_expected.each do |link| assert_no_selector "a[href=\"#{link}\"]" end + end end [ -- 2.30.2