X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/55315b668b8fa04572a44fd7db6598478f54130a..b42d7d9ed4640296ae5d01d26268c4fdba1ca10c:/apps/workbench/app/controllers/trash_items_controller.rb diff --git a/apps/workbench/app/controllers/trash_items_controller.rb b/apps/workbench/app/controllers/trash_items_controller.rb index 31581bb846..5f91a60ca1 100644 --- a/apps/workbench/app/controllers/trash_items_controller.rb +++ b/apps/workbench/app/controllers/trash_items_controller.rb @@ -3,8 +3,8 @@ class TrashItemsController < ApplicationController Collection end - def show_pane_list - %w(Recent) + def index_pane_list + %w(Recent_trash) end def find_objects_for_index @@ -16,7 +16,7 @@ class TrashItemsController < ApplicationController trashed_items if @objects.any? - @objects = @objects.sort_by { |obj| obj.created_at }.reverse + @objects = @objects.sort_by { |obj| obj.trash_at }.reverse @next_page_filters = next_page_filters('<=') @next_page_href = url_for(partial: :trash_rows, filters: @next_page_filters.to_json) @@ -29,6 +29,27 @@ class TrashItemsController < ApplicationController @next_page_href end + def next_page_filters nextpage_operator + next_page_filters = @filters.reject do |attr, op, val| + (attr == 'trash_at' and op == nextpage_operator) or + (attr == 'uuid' and op == 'not in') + end + + if @objects.any? + last_trash_at = @objects.last.trash_at + + last_uuids = [] + @objects.each do |obj| + last_uuids << obj.uuid if obj.trash_at.eql?(last_trash_at) + end + + next_page_filters += [['trash_at', nextpage_operator, last_trash_at]] + next_page_filters += [['uuid', 'not in', last_uuids]] + end + + next_page_filters + end + def trashed_items # API server index doesn't return manifest_text by default, but our # callers want it unless otherwise specified.