Sha256: 9df3183d976c94f3db310ed260492f00af6db78934aaea024475be69fedcd576

Contents?: true

Size: 843 Bytes

Versions: 2

Compression:

Stored size: 843 Bytes

Contents

# frozen_string_literal: true

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

2 entries across 2 versions & 1 rubygems

Version Path
sidekiq-grouping-1.3.0 lib/sidekiq/grouping/web.rb
sidekiq-grouping-1.2.0 lib/sidekiq/grouping/web.rb