[ARVADOS] updated: bc74bad26abfe8af69ef6c86aef44915075054cd

Git user git at public.curoverse.com
Tue Jul 19 11:06:50 EDT 2016


Summary of changes:
 .../app/assets/javascripts/infinite_scroll.js      |  1 +
 .../app/controllers/application_controller.rb      | 23 ++++++++++++++++++++++
 .../app/controllers/projects_controller.rb         | 17 ++--------------
 .../app/controllers/work_units_controller.rb       | 14 +------------
 4 files changed, 27 insertions(+), 28 deletions(-)

       via  bc74bad26abfe8af69ef6c86aef44915075054cd (commit)
      from  90d3c1bd6f2bc40e756d7f49665499c9e96547da (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 bc74bad26abfe8af69ef6c86aef44915075054cd
Author: radhika <radhika at curoverse.com>
Date:   Tue Jul 19 11:04:49 2016 -0400

    9319: refactor next_page_filters code

diff --git a/apps/workbench/app/assets/javascripts/infinite_scroll.js b/apps/workbench/app/assets/javascripts/infinite_scroll.js
index a0c9efc..b89ac81 100644
--- a/apps/workbench/app/assets/javascripts/infinite_scroll.js
+++ b/apps/workbench/app/assets/javascripts/infinite_scroll.js
@@ -130,6 +130,7 @@ function maybe_load_more_content(event) {
                 $container.find(".spinner").detach();
                 $container.append(data.content);
                 $container.attr('data-infinite-content-href', data.next_page_href);
+                ping_all_scrollers();
             });
      }
 }
diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 442687e..b675b4b 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -241,6 +241,29 @@ class ApplicationController < ActionController::Base
     end
   end
 
+  helper_method :next_page_filters
+  def next_page_filters nextpage_operator, rejections
+    next_page_filters = @filters.reject do |attr, op, val|
+      if rejections.has_key?(attr)
+        attr == attr and op == rejections[attr]
+      end
+    end
+
+    if @objects.any?
+      last_created_at = @objects.last.created_at
+
+      last_uuids = []
+      @objects.each do |obj|
+        last_uuids << obj.uuid if obj.created_at.eql?(last_created_at)
+      end
+
+      next_page_filters += [['created_at', nextpage_operator, last_created_at.strftime("%Y-%m-%dT%H:%M:%S.%N%z")]]
+      next_page_filters += [['uuid', 'not in', last_uuids]]
+    end
+
+    next_page_filters
+  end
+
   def show
     if !@object
       return render_not_found("object not found")
diff --git a/apps/workbench/app/controllers/projects_controller.rb b/apps/workbench/app/controllers/projects_controller.rb
index 3674e31..f0ab6ad 100644
--- a/apps/workbench/app/controllers/projects_controller.rb
+++ b/apps/workbench/app/controllers/projects_controller.rb
@@ -230,23 +230,10 @@ class ProjectsController < ApplicationController
       @objects = @objects.to_a.sort_by(&:created_at)
       @objects.reverse! if nextpage_operator == '<='
       @objects = @objects[0.. at limit-1]
-      @next_page_filters = @filters.reject do |attr,op,val|
-        (attr == 'created_at' and op == nextpage_operator) or
-          (attr == 'uuid' and op == 'not in')
-      end
 
       if @objects.any?
-        last_created_at = @objects.last.created_at
-
-        last_uuids = []
-        @objects.each do |obj|
-          last_uuids << obj.uuid if obj.created_at.eql?(last_created_at)
-        end
-
-        @next_page_filters += [['created_at',
-                                nextpage_operator,
-                                last_created_at]]
-        @next_page_filters += [['uuid', 'not in', last_uuids]]
+        @next_page_filters = next_page_filters(nextpage_operator,
+              {'created_at' => nextpage_operator, 'uuid' => 'not in'})
         @next_page_href = url_for(partial: :contents_rows,
                                   limit: @limit,
                                   filters: @next_page_filters.to_json)
diff --git a/apps/workbench/app/controllers/work_units_controller.rb b/apps/workbench/app/controllers/work_units_controller.rb
index 7a45896..af7b9dc 100644
--- a/apps/workbench/app/controllers/work_units_controller.rb
+++ b/apps/workbench/app/controllers/work_units_controller.rb
@@ -21,20 +21,8 @@ class WorkUnitsController < ApplicationController
     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)
 
-    @next_page_filters = @filters.reject do |attr,op,val|
-      (attr == 'created_at') or (attr == 'uuid' and op == 'not in')
-    end
-
     if @objects.any?
-      last_created_at = @objects.last.created_at
-
-      last_uuids = []
-      @objects.each do |obj|
-        last_uuids << obj.uuid if obj.created_at.eql?(last_created_at)
-      end
-
-      @next_page_filters += [['created_at', '<=', last_created_at.strftime("%Y-%m-%dT%H:%M:%S.%N%z")]]
-      @next_page_filters += [['uuid', 'not in', last_uuids]]
+      @next_page_filters = next_page_filters('<=', {'created_at' => '<=', 'uuid' => 'not in'})
       @next_page_href = url_for(partial: :all_processes_rows,
                                 partial_path: 'work_units/',
                                 filters: @next_page_filters.to_json)

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list