// data-example-attr="foo" are shown, and all others are hidden. When
// the user selects the "Show all" option, all rows are shown.
//
+// <input type="checkbox" data-on-value="{}" data-off-value="{}" ... />
+//
+// Merges on- or off-value with other params in query. Only works with
+// infinite-scroll.
+//
// Notes:
//
// When multiple filterable-control widgets operate on the same
updateFilterableQueryNow($(this));
});
}).
+ on('change', 'input[type=checkbox].filterable-control', function(e) {
+ if (this != e.target) return;
+ var $target = $($(this).attr('data-filterable-target'));
+ var currentquery = $target.data('filterable-query');
+ if (currentquery === undefined) currentquery = '';
+ if ($target.is('[data-infinite-scroller]')) {
+ var datakey = 'infiniteContentParamsFrom'+this.id;
+ var whichvalue = $(this).is(':checked') ? 'on-value' : 'off-value';
+ if (JSON.stringify($target.data(datakey)) == JSON.stringify($(this).data(whichvalue)))
+ return;
+ $target.data(datakey, $(this).data(whichvalue));
+ updateFilterableQueryNow($target);
+ $target.trigger('refresh-content');
+ }
+ }).
on('paste keyup input', 'input[type=text].filterable-control', function(e) {
var regexp;
if (this != e.target) return;
@limit = 20
@filters = @filters || []
+ pipelines = []
+ jobs = []
+
# get next page of pipeline_instances
if PipelineInstance.api_exists?(:index)
filters = @filters + [["uuid", "is_a", ["arvados#pipelineInstance"]]]
pipelines = PipelineInstance.limit(@limit).order(["created_at desc"]).filter(filters)
end
- # get next page of jobs
- if Job.api_exists?(:index)
- filters = @filters + [["uuid", "is_a", ["arvados#job"]]]
- jobs = Job.limit(@limit).order(["created_at desc"]).filter(filters)
+ if params[:show_children]
+ # get next page of jobs
+ if Job.api_exists?(:index)
+ filters = @filters + [["uuid", "is_a", ["arvados#job"]]]
+ jobs = Job.limit(@limit).order(["created_at desc"]).filter(filters)
+ end
end
# get next page of container_requests
filters = @filters + [["uuid", "is_a", ["arvados#containerRequest"]]]
+ if !params[:show_children]
+ filters << ["requesting_container_uuid", "=", nil]
+ end
crs = ContainerRequest.limit(@limit).order(["created_at desc"]).filter(filters)
@objects = (jobs.to_a + pipelines.to_a + crs.to_a).sort_by(&:created_at).reverse.first(@limit)
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
SPDX-License-Identifier: AGPL-3.0 %>
-<div class="container" style="width: 100%">
- <div class="row">
- <div class="pull-right">
- <input type="text" class="form-control filterable-control recent-all-processes-filterable-control"
- placeholder="Search all processes"
- data-filterable-target="#all-processes-scroll"
- value="<%= params[:search] %>">
- </input>
- </div>
+<div class="pull-right">
+ <div class="form-group">
+ <input type="text" class="form-control filterable-control recent-all-processes-filterable-control"
+ placeholder="Search all processes"
+ data-filterable-target="#all-processes-scroll"
+ value="<%= params[:search] %>" size="40" />
+ </div>
+ <div class="checkbox">
+ <label>
+ <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
+ </label>
</div>
+</div>
+
+<div>
<div>
<div>
<table class="table table-condensed table-fixedlayout arv-recent-all-processes">
</thead>
<tbody data-infinite-scroller="#all-processes-scroll" id="all-processes-scroll"
+ data-infinite-content-params-from-exclude-child-procs="{}"
data-infinite-content-href="<%= url_for partial: :all_processes_rows %>" >
</tbody>
</table>
'/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
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 |show_children, expected_min, expected_max, expected, not_expected|
+ test "scroll all_processes page with show_children=#{show_children}" do
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|
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
not_expected.each do |link|
assert_no_selector "a[href=\"#{link}\"]"
end
+ end
end
[