Sha256: d70210f4765921017c93a25712d2bfbe70b250eaa36b51ed5adf78f09a7e7c18

Contents?: true

Size: 903 Bytes

Versions: 2

Compression:

Stored size: 903 Bytes

Contents

class MissionControl::Jobs::JobsController < MissionControl::Jobs::ApplicationController
  include MissionControl::Jobs::JobScoped, MissionControl::Jobs::JobFilters

  skip_before_action :set_job, only: :index

  def index
    @job_class_names = jobs_with_status.job_class_names
    @queue_names = ActiveJob.queues.map(&:name)

    @jobs_page = MissionControl::Jobs::Page.new(filtered_jobs_with_status, page: params[:page].to_i)
    @jobs_count = @jobs_page.total_count
  end

  def show
  end

  private

    def jobs_relation
      filtered_jobs
    end

    def filtered_jobs_with_status
      filtered_jobs.with_status(jobs_status)
    end

    def jobs_with_status
      ActiveJob.jobs.with_status(jobs_status)
    end

    def filtered_jobs
      ActiveJob.jobs.where(**@job_filters)
    end

    helper_method :jobs_status

    def jobs_status
      params[:status].presence&.inquiry
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mission_control-jobs-0.5.0 app/controllers/mission_control/jobs/jobs_controller.rb
mission_control-jobs-0.4.0 app/controllers/mission_control/jobs/jobs_controller.rb