Module: Sidekiq::Grouping::Web

Defined in:
lib/sidekiq/grouping/web.rb

Constant Summary collapse

VIEWS =
File.expand_path('views', File.dirname(__FILE__))

Class Method Summary collapse

Class Method Details

.registered(app) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/sidekiq/grouping/web.rb', line 8

def self.registered(app)
  app.get "/grouping" do
    @batches = Sidekiq::Grouping::Batch.all
    erb File.read(File.join(VIEWS, 'index.erb')), locals: {view_path: VIEWS}
  end

  app.post "/grouping/:name/delete" do
    worker_class, queue = Sidekiq::Grouping::Batch.extract_worker_klass_and_queue(params['name'])
    batch = Sidekiq::Grouping::Batch.new(worker_class, queue)
    batch.delete
    redirect "#{root_path}grouping"
  end
end