Sha256: 08a0bf09c99fb3ca97434fbb8269976f1bfe160e5e2f2c1886c430072b8621c1

Contents?: true

Size: 902 Bytes

Versions: 10

Compression:

Stored size: 902 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

10 entries across 10 versions & 1 rubygems

Version Path
mission_control-jobs-1.0.1 app/controllers/mission_control/jobs/jobs_controller.rb
mission_control-jobs-1.0.0 app/controllers/mission_control/jobs/jobs_controller.rb
mission_control-jobs-0.6.0 app/controllers/mission_control/jobs/jobs_controller.rb
mission_control-jobs-0.3.3 app/controllers/mission_control/jobs/jobs_controller.rb
mission_control-jobs-0.3.2 app/controllers/mission_control/jobs/jobs_controller.rb
mission_control-jobs-0.3.1 app/controllers/mission_control/jobs/jobs_controller.rb
mission_control-jobs-0.3.0 app/controllers/mission_control/jobs/jobs_controller.rb
mission_control-jobs-0.2.2 app/controllers/mission_control/jobs/jobs_controller.rb
mission_control-jobs-0.2.1 app/controllers/mission_control/jobs/jobs_controller.rb
mission_control-jobs-0.2.0 app/controllers/mission_control/jobs/jobs_controller.rb