1
0
Fork 0
mirror of https://github.com/endofunky/sidetiq.git synced 2022-11-09 13:53:30 -05:00
endofunky--sidetiq/lib/sidetiq/web.rb

48 lines
988 B
Ruby
Raw Normal View History

2013-02-01 07:26:17 -05:00
require 'sidekiq/web'
module Sidetiq
module Web
def self.registered(app)
app.helpers do
def find_template(view, *args, &block)
path = File.expand_path(File.join('..', 'views'), __FILE__)
super(path, *args, &block)
super
end
end
app.get "/sidetiq" do
clock = Sidetiq::Clock.instance
@schedules = clock.schedules
@time = clock.gettime
2013-02-01 07:26:17 -05:00
slim :sidetiq
end
app.get "/sidetiq/:name" do
halt 404 unless (name = params[:name])
clock = Sidetiq::Clock.instance
schedules = clock.schedules
@time = clock.gettime
2013-02-01 07:26:17 -05:00
@worker, @schedule = schedules.select do |worker, schedule|
worker.name == name
end.flatten
slim :sidetiq_details
end
end
end
end
Sidekiq::Web.register(Sidetiq::Web)
if Sidekiq::Web.tabs.is_a?(Array)
Sidekiq::Web.tabs << "sidetiq"
else
Sidekiq::Web.tabs["Sidetiq"] = "sidetiq"
end