Sha256: 592fceb80536356efb5bd82ed917629112c5d8dbfc90f4fe213475ae3a0b579e

Contents?: true

Size: 752 Bytes

Versions: 2

Compression:

Stored size: 752 Bytes

Contents

require "sidekiq/web"

module Sidekiq::Merger::Web
  VIEWS = File.expand_path("views", File.dirname(__FILE__))

  def self.registered(app)
    app.get "/merges" do
      @merges = Sidekiq::Merger::Merge.all
      @merges.select! { |m| m.queue == params[:queue] } unless params[:queue].nil?
      erb File.read(File.join(VIEWS, "index.erb")), locals: { view_path: VIEWS }
    end

    app.post "/merges/:full_merge_key/delete" do
      full_merge_key = URI.decode_www_form_component params[:full_merge_key]
      merge = Sidekiq::Merger::Merge.initialize_with_full_merge_key(full_merge_key)
      merge.delete_all
      redirect "#{root_path}/merges"
    end
  end
end

Sidekiq::Web.register(Sidekiq::Merger::Web)
Sidekiq::Web.tabs["Merges"] = "merges"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sidekiq-merger-0.1.0 lib/sidekiq/merger/web.rb
sidekiq-merger-0.0.12 lib/sidekiq/merger/web.rb