[ARVADOS] updated: 6bfa13079feb0cd6632dcf83dd6e1dc1d99d8cdf

git at public.curoverse.com git at public.curoverse.com
Sun Oct 26 08:25:09 EDT 2014


Summary of changes:
 .../app/assets/javascripts/infinite_scroll.js      |  3 +
 .../app/controllers/application_controller.rb      |  6 +-
 .../app/controllers/projects_controller.rb         |  4 +-
 .../views/projects/_show_data_collections.html.erb |  2 +-
 .../projects/_show_jobs_and_pipelines.html.erb     |  2 +-
 .../views/projects/_show_other_objects.html.erb    |  3 +-
 .../projects/_show_pipeline_templates.html.erb     |  3 +-
 .../app/views/projects/_show_subprojects.html.erb  |  3 +-
 apps/workbench/test/integration/projects_test.rb   | 66 ++++++++++++++++++++++
 .../arvados/v1/groups_controller_test.rb           | 32 +++++++++++
 10 files changed, 117 insertions(+), 7 deletions(-)

       via  6bfa13079feb0cd6632dcf83dd6e1dc1d99d8cdf (commit)
       via  37b765276dbde3d50f403d269288929d3b211564 (commit)
       via  6ad6190f242a657e6df08014ad3abf4254bfda9b (commit)
       via  fd1613bf6ad5af029255959ecf86f313b08d03ee (commit)
       via  f7a0b41371ca4448d6c0e912cc5fede1869ba265 (commit)
      from  c5f31bd6f1484dc1d09ec404e201f69294f84a5b (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 6bfa13079feb0cd6632dcf83dd6e1dc1d99d8cdf
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date:   Sun Oct 26 13:25:02 2014 +0100

    3618: best guesses about which database columns could be used for sorting (not certain about the descriptions, though, in many cases)

diff --git a/apps/workbench/app/views/projects/_show_data_collections.html.erb b/apps/workbench/app/views/projects/_show_data_collections.html.erb
index 1bf8b45..991e9b1 100644
--- a/apps/workbench/app/views/projects/_show_data_collections.html.erb
+++ b/apps/workbench/app/views/projects/_show_data_collections.html.erb
@@ -1,4 +1,4 @@
 <%= render_pane 'tab_contents', to_string: true, locals: {
     filters: [['uuid', 'is_a', "arvados#collection"]],
-    sortable_columns: { 'name' => 'collections.name' }
+    sortable_columns: { 'name' => 'collections.name', 'description' => 'collections.description' }
     }.merge(local_assigns) %>
diff --git a/apps/workbench/app/views/projects/_show_jobs_and_pipelines.html.erb b/apps/workbench/app/views/projects/_show_jobs_and_pipelines.html.erb
index 9f6e523..230e111 100644
--- a/apps/workbench/app/views/projects/_show_jobs_and_pipelines.html.erb
+++ b/apps/workbench/app/views/projects/_show_jobs_and_pipelines.html.erb
@@ -1,4 +1,4 @@
 <%= render_pane 'tab_contents', to_string: true, locals: {
 	    filters: [['uuid', 'is_a', ["arvados#job", "arvados#pipelineInstance"]]],
-	    sortable_columns: { 'name' => 'jobs.script, pipeline_instances.name' }
+	    sortable_columns: { 'name' => 'jobs.script, pipeline_instances.name', 'description' => 'jobs.description, pipeline_instances.description' }
     }.merge(local_assigns) %>
diff --git a/apps/workbench/app/views/projects/_show_other_objects.html.erb b/apps/workbench/app/views/projects/_show_other_objects.html.erb
index af6fbd1..114ee5b 100644
--- a/apps/workbench/app/views/projects/_show_other_objects.html.erb
+++ b/apps/workbench/app/views/projects/_show_other_objects.html.erb
@@ -1,3 +1,4 @@
 <%= render_pane 'tab_contents', to_string: true, locals: {
-    filters: [['uuid', 'is_a', ["arvados#human", "arvados#specimen", "arvados#trait"]]]
+    filters: [['uuid', 'is_a', ["arvados#human", "arvados#specimen", "arvados#trait"]]],
+	sortable_columns: { 'name' => 'humans.uuid, specimens.uuid, traits.name' }
     }.merge(local_assigns) %>
diff --git a/apps/workbench/app/views/projects/_show_pipeline_templates.html.erb b/apps/workbench/app/views/projects/_show_pipeline_templates.html.erb
index b875b08..402ce26 100644
--- a/apps/workbench/app/views/projects/_show_pipeline_templates.html.erb
+++ b/apps/workbench/app/views/projects/_show_pipeline_templates.html.erb
@@ -1,3 +1,4 @@
 <%= render_pane 'tab_contents', to_string: true, locals: {
-    filters: [['uuid', 'is_a', ["arvados#pipelineTemplate"]]]
+    filters: [['uuid', 'is_a', ["arvados#pipelineTemplate"]]],
+	sortable_columns: { 'name' => 'pipeline_templates.name', 'description' => 'pipeline_templates.description' }
     }.merge(local_assigns) %>
diff --git a/apps/workbench/app/views/projects/_show_subprojects.html.erb b/apps/workbench/app/views/projects/_show_subprojects.html.erb
index 2c0ba60..7d65639 100644
--- a/apps/workbench/app/views/projects/_show_subprojects.html.erb
+++ b/apps/workbench/app/views/projects/_show_subprojects.html.erb
@@ -1,3 +1,4 @@
 <%= render_pane 'tab_contents', to_string: true, locals: {
-    filters: [['uuid', 'is_a', ["arvados#group"]]]
+    filters: [['uuid', 'is_a', ["arvados#group"]]],
+	sortable_columns: { 'name' => 'groups.name', 'description' => 'groups.description' }
     }.merge(local_assigns) %>

commit 37b765276dbde3d50f403d269288929d3b211564
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date:   Sun Oct 26 13:24:19 2014 +0100

    3618: When changing to sorting on a different column, make sure the directional indicator of the previous is removed.

diff --git a/apps/workbench/app/assets/javascripts/infinite_scroll.js b/apps/workbench/app/assets/javascripts/infinite_scroll.js
index fd37308..67a7b52 100644
--- a/apps/workbench/app/assets/javascripts/infinite_scroll.js
+++ b/apps/workbench/app/assets/javascripts/infinite_scroll.js
@@ -197,6 +197,9 @@ $(document).
         } else {
             direction = 'desc';
         }
+        // reset all sort directions
+        $('th[data-sort-order]').removeData('sort-order-direction');
+        // set the current one
         $(this).data('sort-order-direction', direction);
         // change the ordering parameter and refresh the data display with the new order
         var $target = $(this).closest('table').find('[data-infinite-content-params-attr]');

commit 6ad6190f242a657e6df08014ad3abf4254bfda9b
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date:   Sat Oct 25 20:57:02 2014 +0200

    3618: Add Workbench integration test for sorting data collections

diff --git a/apps/workbench/test/integration/projects_test.rb b/apps/workbench/test/integration/projects_test.rb
index 66b62c3..724bb39 100644
--- a/apps/workbench/test/integration/projects_test.rb
+++ b/apps/workbench/test/integration/projects_test.rb
@@ -548,6 +548,72 @@ class ProjectsTest < ActionDispatch::IntegrationTest
   end
 
   [
+    ['project with 10 collections', 10],
+    ['project with 201 collections', 201], # two pages of data
+  ].each do |project_name, amount|
+    test "scroll collections tab for #{project_name} with #{amount} objects, with ascending sort (case insensitive)" do
+      headless = Headless.new
+      headless.start
+      Capybara.current_driver = :selenium
+
+      visit page_with_token 'user1_with_load'
+
+      find("#projects-menu").click
+      find(".dropdown-menu a", text: project_name).click
+
+      my_collections = []
+      for i in 1..amount
+        my_collections << "Collection_#{i}"
+      end
+
+      # verify Data collections scroll
+      assert(page.has_text?("Data collections (#{amount})"), "Number of collections did not match the input amount")
+
+      click_link 'Data collections'
+      begin
+        wait_for_ajax
+      rescue
+      end
+
+      find('th[data-sort-order="collections.name"]').click
+      wait_for_ajax
+
+      verify_collections = my_collections.dup
+      unexpected_items = []
+      collections_count = 0
+      within('.arv-project-Data_collections') do
+        page.execute_script "window.scrollBy(0,999000)"
+        begin
+          wait_for_ajax
+        rescue
+        end
+
+        # Visit all rows. If not all expected collections are found, retry
+        found_collections = page.all('tr[data-kind="arvados#collection"]')
+        collections_count = found_collections.count
+
+        previous = nil
+        (0..collections_count-1).each do |i|
+          # Found row text would be of the format "Show Collection_#{n} "
+          collection_name = found_collections[i].text.split[1]
+          if !my_collections.include? collection_name
+            unexpected_items << collection_name
+          else
+            verify_collections.delete collection_name
+          end
+          # check sort order
+          assert_operator( previous.downcase, :<=, collection_name.downcase) if previous
+          previous = collection_name
+        end
+
+        assert_equal true, unexpected_items.empty?, "Found unexpected items #{unexpected_items.inspect}"
+        assert_equal amount, collections_count, "Found different number of collections"
+        assert_equal true, verify_collections.empty?, "Did not find all the collections"
+      end
+    end
+  end
+
+  [
     ['project with 10 pipelines', 10, 0],
 #    ['project with 200 jobs and 10 pipelines', 2, 200],
     ['project with 25 pipelines', 25, 0],

commit fd1613bf6ad5af029255959ecf86f313b08d03ee
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date:   Sat Oct 25 20:56:23 2014 +0200

    3618: correctly propagate the ordering parameters when scrolling

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 1b87cea..3d82b23 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -119,7 +119,11 @@ class ApplicationController < ActionController::Base
     if params[:order].blank?
       @order = 'created_at desc'
     elsif !params[:order].is_a? Array
-      @order = params[:order].split(',')
+      begin
+        @order = JSON.load(params[:order])
+      rescue
+        @order = params[:order].split(',')
+      end
     end
     @order = [@order] unless @order.is_a? Array
 
diff --git a/apps/workbench/app/controllers/projects_controller.rb b/apps/workbench/app/controllers/projects_controller.rb
index b77a489..83d2cd8 100644
--- a/apps/workbench/app/controllers/projects_controller.rb
+++ b/apps/workbench/app/controllers/projects_controller.rb
@@ -220,7 +220,9 @@ class ProjectsController < ApplicationController
                                   include_linked: true,
                                   filters: @filters,
                                   offset: @offset)
-      @next_page_href = next_page_href(partial: :contents_rows)
+      @next_page_href = next_page_href(partial: :contents_rows,
+                                       filters: @filters.to_json,
+                                       order: @order.to_json)
     end
 
     preload_links_for_objects(@objects.to_a)

commit f7a0b41371ca4448d6c0e912cc5fede1869ba265
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date:   Sat Oct 25 10:18:57 2014 +0200

    3618: Add some basic API server tests for the sort feature

diff --git a/services/api/test/functional/arvados/v1/groups_controller_test.rb b/services/api/test/functional/arvados/v1/groups_controller_test.rb
index ec0e9f5..654adad 100644
--- a/services/api/test/functional/arvados/v1/groups_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/groups_controller_test.rb
@@ -131,6 +131,38 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
     assert_includes ids, collections(:baz_file_in_asubproject).uuid
   end
 
+  test "user with project read permission can sort project collections ascending, ignoring case" do
+    authorize_with :project_viewer
+    get :contents, {
+      id: groups(:asubproject).uuid,
+      format: :json,
+      filters: [['uuid', 'is_a', "arvados#collection"]],
+      order: 'collections.name asc'
+    }
+    sorted_entries = json_response['items'].collect { |item| item["name"].downcase }
+    previous = nil
+    sorted_entries.each do |entry|
+      assert_operator( previous, :<=, entry) if previous
+      previous = entry
+    end
+  end
+
+  test "user with project read permission can sort project collections descending, ignoring case" do
+    authorize_with :project_viewer
+    get :contents, {
+      id: groups(:asubproject).uuid,
+      format: :json,
+      filters: [['uuid', 'is_a', "arvados#collection"]],
+      order: 'collections.name desc'
+    }
+    sorted_entries = json_response['items'].collect { |item| item["name"].downcase }
+    previous = nil
+    sorted_entries.each do |entry|
+      assert_operator( previous, :>=, entry) if previous
+      previous = entry
+    end
+  end
+
   test 'list objects across multiple projects' do
     authorize_with :project_viewer
     get :contents, {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list