[ARVADOS] updated: 96a45311873821f4a9d4f2fde8f904aa7eaefb44

Git user git at public.curoverse.com
Thu Jul 7 16:23:21 EDT 2016


Summary of changes:
 .../app/controllers/all_processes_controller.rb    | 14 ++--
 .../app/views/projects/_show_dashboard.html.erb    |  9 +--
 .../views/work_unit/_show_all_processes.html.erb   |  4 +-
 .../test/controllers/projects_controller_test.rb   | 28 +++++---
 .../test/integration/all_processes_test.rb         | 74 ++++++++++++++++++++++
 .../test/integration/application_layout_test.rb    |  3 +-
 6 files changed, 108 insertions(+), 24 deletions(-)
 create mode 100644 apps/workbench/test/integration/all_processes_test.rb

       via  96a45311873821f4a9d4f2fde8f904aa7eaefb44 (commit)
      from  3e21feb8369cfe0f6b9f5f25e2e952db3bc424c8 (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 96a45311873821f4a9d4f2fde8f904aa7eaefb44
Author: radhika <radhika at curoverse.com>
Date:   Thu Jul 7 16:22:46 2016 -0400

    9319: update dashboard links and add test.

diff --git a/apps/workbench/app/controllers/all_processes_controller.rb b/apps/workbench/app/controllers/all_processes_controller.rb
index fd4a603..4be7fcf 100644
--- a/apps/workbench/app/controllers/all_processes_controller.rb
+++ b/apps/workbench/app/controllers/all_processes_controller.rb
@@ -23,16 +23,20 @@ class AllProcessesController < ApplicationController
   end
 
   def find_objects_for_index
+    @limit = 20
+
     @filters = @next_page_filters || @filters || []
 
+    procs = {}
+
+    # get next page of pipeline_instances
     filters = @filters + [%w(uuid is_a) + [%w(arvados#pipelineInstance)]]
-    pipelines = PipelineInstance.order(["created_at desc"]).filter(filters)
+    pipelines = PipelineInstance.limit(@limit).order(["created_at desc"]).filter(filters)
+    pipelines.results.each { |pi| procs[pi] = pi.created_at }
 
+    # get next page of container_requests
     filters = @filters + [%w(uuid is_a) + [%w(arvados#containerRequest)]] + [['requesting_container_uuid', '=', nil]]
-    crs = ContainerRequest.order(["created_at desc"]).filter(filters)
-    
-    procs = {}
-    pipelines.results.each { |pi| procs[pi] = pi.created_at }
+    crs = ContainerRequest.limit(@limit).order(["created_at desc"]).filter(filters)
     crs.results.each { |c| procs[c] = c.created_at }
 
     @objects = Hash[procs.sort_by {|key, value| value}].keys.reverse.first(@limit)
diff --git a/apps/workbench/app/views/projects/_show_dashboard.html.erb b/apps/workbench/app/views/projects/_show_dashboard.html.erb
index bf4b7f1..585bc4a 100644
--- a/apps/workbench/app/views/projects/_show_dashboard.html.erb
+++ b/apps/workbench/app/views/projects/_show_dashboard.html.erb
@@ -18,8 +18,8 @@
                 <% end %>
               </span>
               <span>
-                  <%= link_to pipeline_instances_path, class: 'btn btn-default btn-xs' do %>
-                    All pipelines <i class="fa fa-fw fa-arrow-circle-right"></i>
+                  <%= link_to all_processes_path, class: 'btn btn-default btn-xs' do %>
+                    All processes <i class="fa fa-fw fa-arrow-circle-right"></i>
                   <% end %>
               </span>
             </span>
@@ -109,11 +109,6 @@
                 <% end %>
               </span>
             <% end %>
-            <span>
-              <%= link_to jobs_path, class: 'btn btn-default btn-xs' do %>
-                All jobs <i class="fa fa-fw fa-arrow-circle-right"></i>
-              <% end %>
-            </span>
           </span>
         </div>
         <div class="panel-body compute-node-summary-pane">
diff --git a/apps/workbench/app/views/work_unit/_show_all_processes.html.erb b/apps/workbench/app/views/work_unit/_show_all_processes.html.erb
index afb65ea..4cd2897 100644
--- a/apps/workbench/app/views/work_unit/_show_all_processes.html.erb
+++ b/apps/workbench/app/views/work_unit/_show_all_processes.html.erb
@@ -1,7 +1,7 @@
 <div class="container">
   <div class="row">
     <div class="pull-right">
-      <input type="text" class="form-control filterable-control all-processes-filterable-control"
+      <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] %>">
@@ -10,7 +10,7 @@
   </div>
   <div>
     <div>
-      <table class="table table-condensed table-fixedlayout arv-all-processes">
+      <table class="table table-condensed table-fixedlayout arv-recent-all-processes">
         <colgroup>
           <col width="25%" />
           <col width="10%" />
diff --git a/apps/workbench/test/controllers/projects_controller_test.rb b/apps/workbench/test/controllers/projects_controller_test.rb
index c0519bc..fa87e84 100644
--- a/apps/workbench/test/controllers/projects_controller_test.rb
+++ b/apps/workbench/test/controllers/projects_controller_test.rb
@@ -387,14 +387,26 @@ class ProjectsControllerTest < ActionController::TestCase
   end
 
   [
-    ["jobs", "/jobs"],
-    ["pipelines", "/pipeline_instances"],
-    ["collections", "/collections"],
-  ].each do |target,path|
-    test "test dashboard button all #{target}" do
-      get :index, {}, session_for(:active)
-      assert_includes @response.body, "href=\"#{path}\""
-      assert_includes @response.body, "All #{target}"
+    [:admin, true],
+    [:active, false],
+  ].each do |user, expect_all_nodes|
+    test "in dashboard other index page links as #{user}" do
+      get :index, {}, session_for(user)
+
+      [["processes", "/all_processes"],
+       ["collections", "/collections"],
+      ].each do |target, path|
+        assert_includes @response.body, "href=\"#{path}\""
+        assert_includes @response.body, "All #{target}"
+      end
+
+      if expect_all_nodes
+        assert_includes @response.body, "href=\"/nodes\""
+        assert_includes @response.body, "All nodes"
+      else
+        assert_not_includes @response.body, "href=\"/nodes\""
+        assert_not_includes @response.body, "All nodes"
+      end
     end
   end
 
diff --git a/apps/workbench/test/integration/all_processes_test.rb b/apps/workbench/test/integration/all_processes_test.rb
new file mode 100644
index 0000000..4f4e772
--- /dev/null
+++ b/apps/workbench/test/integration/all_processes_test.rb
@@ -0,0 +1,74 @@
+require 'integration_helper'
+
+class AllProcessesTest < ActionDispatch::IntegrationTest
+  setup do
+    need_javascript
+  end
+
+  [
+    [nil, 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-cr4requestercn2']],
+    ['foo', 10, 25,
+      ['/pipeline_instances/zzzzz-d1hrv-1xfj6xkicf2muk2',
+       '/pipeline_instances/zzzzz-d1hrv-jobspeccomponts'],
+      ['/pipeline_instances/zzzzz-d1hrv-1yfj61234abcdk3',
+       '/container_requests/zzzzz-xvhdp-cr4completedcr2']],
+    ['pipeline_with_tagged_collection_input', 1, 1,
+      ['/pipeline_instances/zzzzz-d1hrv-1yfj61234abcdk3'],
+      ['/pipeline_instances/zzzzz-d1hrv-jobspeccomponts',
+       '/container_requests/zzzzz-xvhdp-cr4completedcr2']],
+    ['no_such_match', 0, 0,
+      [],
+      ['/pipeline_instances/zzzzz-d1hrv-jobspeccomponts',
+       '/container_requests/zzzzz-xvhdp-cr4completedcr2']],
+  ].each do |search_filter, expected_min, expected_max, expected, not_expected|
+    test "scroll all_processes page for search filter '#{search_filter}'" do
+      visit page_with_token('active', "/all_processes")
+
+      if search_filter
+        find('.recent-all-processes-filterable-control').set(search_filter)
+        sleep 1
+        wait_for_ajax
+      end
+
+      page_scrolls = expected_max/20 + 2
+      within('.arv-recent-all-processes') do
+        (0..page_scrolls).each do |i|
+          page.driver.scroll_to 0, 999000
+          begin
+            wait_for_ajax
+          rescue
+          end
+        end
+      end
+
+      # Verify that expected number of processes are found
+      found_items = page.all('tr[data-object-uuid]')
+      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}")
+        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}")
+        assert_equal(true, found_count<=expected_max,
+          "Found too many items. Expected at most #{expected_max} and found #{found_count}")
+      end
+
+      # verify that all expected uuid links are found
+      expected.each do |link|
+        assert_selector "a[href=\"#{link}\"]"
+      end
+
+      # verify that none of the not_expected uuid links are found
+      not_expected.each do |link|
+        assert_no_selector "a[href=\"#{link}\"]"
+      end
+    end
+  end
+end
diff --git a/apps/workbench/test/integration/application_layout_test.rb b/apps/workbench/test/integration/application_layout_test.rb
index 61905f3..40ec31d 100644
--- a/apps/workbench/test/integration/application_layout_test.rb
+++ b/apps/workbench/test/integration/application_layout_test.rb
@@ -252,7 +252,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
       assert_text 'Recent pipelines and processes' # seeing dashboard now
       within('.recent-processes-actions') do
         assert page.has_link?('Run a pipeline')
-        assert page.has_link?('All pipelines')
+        assert page.has_link?('All processes')
       end
 
       within('.recent-processes') do
@@ -278,7 +278,6 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
         else
           assert page.has_no_link?('All nodes')
         end
-        assert page.has_link? 'All jobs'
       end
 
       within('.compute-node-summary-pane') do

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list