--- /dev/null
+<%= form_tag({}, {id: "containerRequests"}) do |f| %>
+
+<table class="table table-condensed table-fixedlayout arv-recent-container-requests">
+ <colgroup>
+ <col width="10%" />
+ <col width="15%" />
+ <col width="25%" />
+ <col width="15%" />
+ <col width="15%" />
+ <col width="15%" />
+ <col width="5%" />
+ </colgroup>
+ <thead>
+ <tr class="contain-align-left">
+ <th>
+ Status
+ </th><th>
+ ContainerRequest
+ </th><th>
+ Description
+ </th><th>
+ Workflow
+ </th><th>
+ Owner
+ </th><th>
+ Created at
+ </th><th>
+ </th>
+ </tr>
+ </thead>
+
+ <tbody data-infinite-scroller="#recent-container-requests" id="recent-container-requests"
+ data-infinite-content-href="<%= url_for partial: :recent_rows %>" >
+ </tbody>
+</table>
+
+<% end %>
--- /dev/null
+<%
+ containers = @objects.map(&:container_uuid).compact.uniq
+ preload_objects_for_dataclass(Container, containers) if containers.any?
+
+ workflows = @objects.collect {|o| o.properties[:template_uuid]}.compact.uniq
+ preload_objects_for_dataclass(Workflow, workflows) if workflows.any?
+
+ owner_uuids = @objects.map(&:owner_uuid).compact.uniq
+ preload_objects_for_dataclass(User, owner_uuids) if owner_uuids.any?
+ preload_objects_for_dataclass(Group, owner_uuids) if owner_uuids.any?
+
+ objs = containers + workflows + owner_uuids
+ preload_links_for_objects objs if objs.any?
+%>
+
+<% @objects.sort_by { |obj| obj.created_at }.reverse.each do |obj| %>
+ <% wu = obj.work_unit obj.name %>
+
+ <tr data-object-uuid="<%= wu.uuid %>" class="cr-<%= wu.uuid %>">
+ <td>
+ <span class="label label-<%= wu.state_bootstrap_class %>"><%= wu.state_label %></span>
+ </td><td>
+ <%= link_to_if_arvados_object obj, friendly_name: true %>
+ </td><td>
+ <%= obj.description || '' %>
+ </td><td>
+ <%= link_to_if_arvados_object wu.template_uuid, friendly_name: true %>
+ </td><td>
+ <%= link_to_if_arvados_object wu.owner_uuid, friendly_name: true %>
+ </td><td>
+ <%= wu.created_at.to_s %>
+ </td><td>
+ <%= render partial: 'delete_object_button', locals: {object:obj} %>
+ </td>
+ </tr>
+<% end %>
--- /dev/null
+<% content_for :tab_line_buttons do %>
+ <div class="input-group">
+ <input type="text" class="form-control filterable-control recent-container-requests-filterable-control"
+ placeholder="Search container requests"
+ data-filterable-target="#recent-container-requests"
+ value="<%= params[:search] %>"
+ />
+ </div>
+<% end %>
+
+<%= render file: 'application/index.html.erb', locals: local_assigns %>
page.assert_selector 'ellipse+text', text: cr['name'], visible: false
page.assert_selector 'g.node>title', text: cr['uuid'], visible: false
end
+
+ [
+ 'active',
+ 'admin',
+ ].each do |token|
+ test "index page as #{token} user" do
+ visit page_with_token(token, "/container_requests")
+
+ running_owner_active = api_fixture("container_requests", "requester_for_running")
+ anon_accessible_cr = api_fixture("container_requests", "running_anonymous_accessible")
+
+ # both of these CRs should be accessible to the user
+ assert_selector "a[href=\"/container_requests/#{running_owner_active['uuid']}\"]", text: running_owner_active[:name]
+ assert_selector "a[href=\"/container_requests/#{anon_accessible_cr['uuid']}\"]", text: anon_accessible_cr[:name]
+
+ # both the active user (owner) and admin can delete the "running" container_request
+ within(".cr-#{running_owner_active['uuid']}") do
+ assert_not_nil first('.glyphicon-trash')
+ end
+
+ # only admin user can delete the anonymously accessible container_request
+ within(".cr-#{anon_accessible_cr['uuid']}") do
+ if token == 'admin'
+ assert_not_nil first('.glyphicon-trash')
+ else
+ assert_nil first('.glyphicon-trash')
+ end
+ end
+
+ # verify the search box in the page
+ find('.recent-container-requests-filterable-control').set("anonymous")
+ sleep 0.350 # Wait for 250ms debounce timer (see filterable.js)
+ wait_for_ajax
+ assert_no_selector "a[href=\"/container_requests/#{running_owner_active['uuid']}\"]", text: running_owner_active[:name]
+ assert_selector "a[href=\"/container_requests/#{anon_accessible_cr['uuid']}\"]", text: anon_accessible_cr[:name]
+ end
+ end
end