Class: Admin::BackgroundJobsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/admin/background_jobs_controller.rb

Defined Under Namespace

Classes: Collection

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#background_jobObject (readonly)

Returns the value of attribute background_job.



7
8
9
# File 'app/controllers/admin/background_jobs_controller.rb', line 7

def background_job
  @background_job
end

#collectionObject (readonly)

Returns the value of attribute collection.



7
8
9
# File 'app/controllers/admin/background_jobs_controller.rb', line 7

def collection
  @collection
end

Instance Method Details

#blockedObject



12
# File 'app/controllers/admin/background_jobs_controller.rb', line 12

def blocked     = render_state(:blocked)

#completedObject



14
# File 'app/controllers/admin/background_jobs_controller.rb', line 14

def completed   = render_state(:completed)

#discardObject



26
27
28
29
30
31
32
# File 'app/controllers/admin/background_jobs_controller.rb', line 26

def discard
  redirect_target = background_job.failed? ? failed_admin_background_jobs_path : admin_background_jobs_path

  background_job.discard

  redirect_to redirect_target, status: :see_other
end

#discard_allObject



40
41
42
43
44
# File 'app/controllers/admin/background_jobs_controller.rb', line 40

def discard_all
  SolidQueue::Job.where(id: params[:id]).find_each(&:discard)

  redirect_back_or_to admin_background_jobs_path, status: :see_other
end

#failedObject



13
# File 'app/controllers/admin/background_jobs_controller.rb', line 13

def failed      = render_state(:failed)

#in_progressObject



11
# File 'app/controllers/admin/background_jobs_controller.rb', line 11

def in_progress = render_state(:in_progress)

#indexObject



9
# File 'app/controllers/admin/background_jobs_controller.rb', line 9

def index       = render_state(:pending)

#retryObject



20
21
22
23
24
# File 'app/controllers/admin/background_jobs_controller.rb', line 20

def retry
  background_job.retry

  redirect_to admin_background_jobs_path, status: :see_other
end

#retry_allObject



34
35
36
37
38
# File 'app/controllers/admin/background_jobs_controller.rb', line 34

def retry_all
  SolidQueue::Job.failed.where(id: params[:id]).find_each(&:retry)

  redirect_back_or_to failed_admin_background_jobs_path, status: :see_other
end

#scheduledObject



10
# File 'app/controllers/admin/background_jobs_controller.rb', line 10

def scheduled   = render_state(:scheduled)

#showObject



16
17
18
# File 'app/controllers/admin/background_jobs_controller.rb', line 16

def show
  render locals: { background_job: }
end