solid_queue icon indicating copy to clipboard operation
solid_queue copied to clipboard

SolidQueue::Job inside active_admin

Open koenhandekyn opened this issue 2 years ago • 0 comments

For those still stuck with active admin :) The below is a quick means to get the jobs appear inside your backend admin.

# typed: false
# frozen_string_literal: true

# monkey patch to make ActiveAdmin work with SolidQueue::Job
class SolidQueue::Job

  def self.ransackable_attributes(auth_object = nil)
    ["active_job_id",
     "arguments",
     "class_name",
     "concurrency_key",
     "created_at",
     "finished_at",
     "id",
     "id_value",
     "priority",
     "queue_name",
     "scheduled_at",
     "updated_at"]
  end

end

ActiveAdmin.register SolidQueue::Job do
  menu parent: "Data", label: I18n.t("admin.solid_queue.jobs")

  filter :queue_name
  filter :class_name
  filter :created_at
  filter :scheduled_at
  filter :finished_at

  index do
    selectable_column
    column :queue_name
    column :class_name
    column :created_at
    column :scheduled_at
    column :finished_at
    actions defaults: true
  end
end

koenhandekyn avatar Dec 22 '23 16:12 koenhandekyn