Sha256: dd4bd4a95eb630b59863f3ffd5c8f00515cbc7d0e934f38cc5df297278e09902

Contents?: true

Size: 757 Bytes

Versions: 3

Compression:

Stored size: 757 Bytes

Contents

require 'sidekiq/web'

module Sidekiq
  module Grouping
    module Web
      VIEWS = File.expand_path('views', File.dirname(__FILE__))

      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

    end
  end
end

Sidekiq::Web.register(Sidekiq::Grouping::Web)
Sidekiq::Web.tabs["Grouping"] = "grouping"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sidekiq-grouping-1.1.0 lib/sidekiq/grouping/web.rb
sidekiq-grouping-1.0.10 lib/sidekiq/grouping/web.rb
sidekiq-grouping-1.0.9 lib/sidekiq/grouping/web.rb