[ARVADOS] updated: cbc29982e30fd776c194c47dc584710ff1b340c4

git at public.curoverse.com git at public.curoverse.com
Tue Oct 28 12:21:16 EDT 2014


Summary of changes:
 .../app/controllers/projects_controller.rb         | 22 +++++++++++++++-------
 .../views/projects/_show_data_collections.html.erb |  1 -
 .../views/projects/_show_other_objects.html.erb    |  1 -
 .../projects/_show_pipeline_templates.html.erb     |  1 -
 .../app/views/projects/_show_subprojects.html.erb  |  1 -
 .../app/views/projects/_show_tab_contents.html.erb |  2 +-
 6 files changed, 16 insertions(+), 12 deletions(-)

       via  cbc29982e30fd776c194c47dc584710ff1b340c4 (commit)
      from  97f3db9cb084efce35ef6a24c25d14308785a49a (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 cbc29982e30fd776c194c47dc584710ff1b340c4
Author: radhika <radhika at curoverse.com>
Date:   Tue Oct 28 12:18:17 2014 -0400

    4091: enhance code to handle the case where there are more than one item in the next page matching the previous page's last object's created_at time.
    Also, handle the case where the entire next page has the same created_at time as the previous page's last item; to keep things simple, stop scrolling in this case.

diff --git a/apps/workbench/app/controllers/projects_controller.rb b/apps/workbench/app/controllers/projects_controller.rb
index 3122316..857ab61 100644
--- a/apps/workbench/app/controllers/projects_controller.rb
+++ b/apps/workbench/app/controllers/projects_controller.rb
@@ -208,19 +208,26 @@ class ProjectsController < ApplicationController
 
       # We are using created_at time slightly greater/lower than the last object created_at (see next block comment).
       # This would mean that the server would now return the previous last item(s) with matching created_at again.
-      # Hence, we need to remove the previous last item (last_uuid) from results before displaying the rest of the
-      # results to prevent "infinite" infinite scrolling.
-      if params['last_uuid'] and @objects.any?
-        @objects.each do |obj|
-          @objects.delete obj if obj.uuid.eql?(params['last_uuid'])
+      # Hence, we need to remove the previous last_uuids from results before displaying the rest of the results
+      # to prevent "infinite" infinite scrolling.
+      if params['last_uuids'] and @objects.any?
+        last_uuids = JSON.parse params['last_uuids']
+        @objects.reject! do |obj|
+          last_uuids.include? obj.uuid
         end
       end
 
       if @objects.any?
         last_created_at = @objects.last.created_at
 
+        last_uuids = [] if (last_created_at != params[:last_created_at])
+        @objects.each do |obj|
+          last_uuids << obj.uuid if obj.created_at.eql?(last_created_at)
+        end
+
         # In order to prevent losing item(s) that have the same created_at time as the current page last item,
-        # next page should look for objects with created_at time slightly greater/lower than the current last.
+        # next page should look for objects with created_at time slightly greater/lower than the current last,
+        # and remove them if they are part of previous page's last_uuids (see the previous block)
         if nextpage_operator == '<'
           last_created_at += 1
         else
@@ -231,7 +238,8 @@ class ProjectsController < ApplicationController
                                 nextpage_operator,
                                 last_created_at]]
         @next_page_href = url_for(partial: :contents_rows,
-                                  last_uuid: @objects.last.uuid,
+                                  last_uuids: last_uuids.to_json,
+                                  last_created_at: @objects.last.created_at,
                                   limit: @limit,
                                   filters: @next_page_filters.to_json)
       else
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 f2995c9..e56321d 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,3 @@
 <%= render_pane 'tab_contents', to_string: true, locals: {
-    limit: 200,
     filters: [['uuid', 'is_a', "arvados#collection"]]
     }.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 1553915..af6fbd1 100644
--- a/apps/workbench/app/views/projects/_show_other_objects.html.erb
+++ b/apps/workbench/app/views/projects/_show_other_objects.html.erb
@@ -1,4 +1,3 @@
 <%= render_pane 'tab_contents', to_string: true, locals: {
-    limit: 200,
     filters: [['uuid', 'is_a', ["arvados#human", "arvados#specimen", "arvados#trait"]]]
     }.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 6d8cd75..b875b08 100644
--- a/apps/workbench/app/views/projects/_show_pipeline_templates.html.erb
+++ b/apps/workbench/app/views/projects/_show_pipeline_templates.html.erb
@@ -1,4 +1,3 @@
 <%= render_pane 'tab_contents', to_string: true, locals: {
-    limit: 200,
     filters: [['uuid', 'is_a', ["arvados#pipelineTemplate"]]]
     }.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 556b7bd..2c0ba60 100644
--- a/apps/workbench/app/views/projects/_show_subprojects.html.erb
+++ b/apps/workbench/app/views/projects/_show_subprojects.html.erb
@@ -1,4 +1,3 @@
 <%= render_pane 'tab_contents', to_string: true, locals: {
-    limit: 200,
     filters: [['uuid', 'is_a', ["arvados#group"]]]
     }.merge(local_assigns) %>
diff --git a/apps/workbench/app/views/projects/_show_tab_contents.html.erb b/apps/workbench/app/views/projects/_show_tab_contents.html.erb
index fa0578c..1e16f41 100644
--- a/apps/workbench/app/views/projects/_show_tab_contents.html.erb
+++ b/apps/workbench/app/views/projects/_show_tab_contents.html.erb
@@ -75,7 +75,7 @@
       <col width="60%" style="width: 60%;" />
       <col width="40%" style="width: 40%;" />
     </colgroup>
-    <tbody data-infinite-scroller="#<%= tab_pane %>-scroll" data-infinite-content-href="<%= url_for partial: :contents_rows %>" data-infinite-content-params-projecttab="<%= {limit: limit, filters: filters}.to_json %>">
+    <tbody data-infinite-scroller="#<%= tab_pane %>-scroll" data-infinite-content-href="<%= url_for partial: :contents_rows %>" data-infinite-content-params-projecttab="<%= local_assigns.to_json %>">
     </tbody>
     <thead>
       <tr>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list