Class: SolidWebUi::Queue::JobsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- SolidWebUi::Queue::JobsController
- Defined in:
- app/controllers/solid_web_ui/queue/jobs_controller.rb
Constant Summary collapse
- STATUS_SCOPES =
{ "ready" => -> { SolidQueue::Job.where(id: SolidQueue::ReadyExecution.select(:job_id)) }, "scheduled" => -> { SolidQueue::Job.where(id: SolidQueue::ScheduledExecution.select(:job_id)) }, "in_progress" => -> { SolidQueue::Job.where(id: SolidQueue::ClaimedExecution.select(:job_id)) }, "blocked" => -> { SolidQueue::Job.where(id: SolidQueue::BlockedExecution.select(:job_id)) }, "failed" => -> { SolidQueue::Job.where(id: SolidQueue::FailedExecution.select(:job_id)) }, "finished" => -> { SolidQueue::Job.where.not(finished_at: nil) } }.freeze
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/solid_web_ui/queue/jobs_controller.rb', line 14 def index @status = params[:status].presence_in(STATUS_SCOPES.keys) || "all" scope = (STATUS_SCOPES[@status]&.call || SolidQueue::Job.all) .includes(:ready_execution, :scheduled_execution, :claimed_execution, :blocked_execution, :failed_execution) .order(id: :desc) @paginator = SolidWebUi::Paginator.new(scope, page: params[:page], per_page: per_page) @jobs = @paginator.records end |