X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/21112a4f6cd07b1b157463b257333302fdf57db2..b3b64d046641ccc39e4f4d6fab85a8b831732d51:/apps/workbench/app/controllers/application_controller.rb diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb index 4c3d3f852e..dfa5ebc95c 100644 --- a/apps/workbench/app/controllers/application_controller.rb +++ b/apps/workbench/app/controllers/application_controller.rb @@ -828,9 +828,21 @@ class ApplicationController < ActionController::Base pi end - helper_method :finished_pipelines - def finished_pipelines lim - PipelineInstance.limit(lim).order(["finished_at desc"]).filter([["state", "in", ["Complete", "Failed", "Paused"]], ["finished_at", "!=", nil]]) + helper_method :recent_processes + def recent_processes lim + lim = 12 if lim.nil? + + pipelines = PipelineInstance.limit(lim).order(["created_at desc"]) + + crs = ContainerRequest.limit(lim).order(["created_at desc"]).filter([["requesting_container_uuid", "=", nil]]) + cr_uuids = crs.results.collect { |c| c.container_uuid } + containers = Container.order(["created_at desc"]).results if cr_uuids.any? + + procs = {} + pipelines.results.each { |pi| procs[pi] = pi.created_at } + containers.each { |c| procs[c] = c.created_at } if !containers.nil? + + Hash[procs.sort_by {|key, value| value}].keys.reverse.first(lim) end helper_method :recent_collections