Class: RoundhouseUi::ScheduledController

Inherits:
ApplicationController show all
Includes:
JobSetBrowsing
Defined in:
app/controllers/roundhouse_ui/scheduled_controller.rb

Constant Summary

Constants included from JobSetBrowsing

JobSetBrowsing::PER_PAGE

Constants inherited from ApplicationController

ApplicationController::AUDIT_VERBS

Instance Method Summary collapse

Methods included from JobSetBrowsing

#browse, #entry_matches?

Methods inherited from ApplicationController

#redirect_to

Instance Method Details

#destroyObject



21
22
23
24
25
# File 'app/controllers/roundhouse_ui/scheduled_controller.rb', line 21

def destroy
  entry = Sidekiq::ScheduledSet.new.find_job(params[:jid])
  entry&.delete
  redirect_to scheduled_path, notice: entry ? "Deleted #{params[:jid]}." : "Job is no longer scheduled."
end

#enqueueObject

Enqueue now — pulls the job out of the schedule and onto its queue.



15
16
17
18
19
# File 'app/controllers/roundhouse_ui/scheduled_controller.rb', line 15

def enqueue
  entry = Sidekiq::ScheduledSet.new.find_job(params[:jid])
  entry&.add_to_queue
  redirect_to scheduled_path, notice: entry ? "Enqueued #{params[:jid]} now." : "Job is no longer scheduled."
end

#indexObject



7
8
9
10
11
12
# File 'app/controllers/roundhouse_ui/scheduled_controller.rb', line 7

def index
  @query = params[:q].to_s.strip
  @page  = [ params[:page].to_i, 1 ].max
  @total = Sidekiq::ScheduledSet.new.size
  @jobs, @has_next = browse(Sidekiq::ScheduledSet.new, @query, @page)
end