lib/sidetiq/web.rb in sidetiq-0.5.0 vs lib/sidetiq/web.rb in sidetiq-0.6.0
- old
+ new
@@ -4,19 +4,19 @@
module Web
VIEWS = File.expand_path('views', File.dirname(__FILE__))
def self.registered(app)
app.get "/sidetiq" do
- @workers = Sidetiq.workers
+ @workers = Sidetiq.workers.sort_by { |worker| worker.name }
@time = Sidetiq.clock.gettime
- erb File.read(File.join(VIEWS, 'sidetiq.erb'))
+ erb File.read(File.join(VIEWS, 'sidetiq.erb')), locals: {view_path: VIEWS}
end
app.get "/sidetiq/locks" do
@locks = Sidetiq::Lock::Redis.all.map(&:meta_data)
- erb File.read(File.join(VIEWS, 'locks.erb'))
+ erb File.read(File.join(VIEWS, 'locks.erb')), locals: {view_path: VIEWS}
end
app.get "/sidetiq/:name/schedule" do
halt 404 unless (name = params[:name])
@@ -26,11 +26,11 @@
worker.name == name
end
@schedule = @worker.schedule
- erb File.read(File.join(VIEWS, 'schedule.erb'))
+ erb File.read(File.join(VIEWS, 'schedule.erb')), locals: {view_path: VIEWS}
end
app.get "/sidetiq/:name/history" do
halt 404 unless (name = params[:name])
@@ -42,10 +42,10 @@
@history = Sidekiq.redis do |redis|
redis.lrange("sidetiq:#{name}:history", 0, -1)
end
- erb File.read(File.join(VIEWS, 'history.erb'))
+ erb File.read(File.join(VIEWS, 'history.erb')), locals: {view_path: VIEWS}
end
app.post "/sidetiq/:name/trigger" do
halt 404 unless (name = params[:name])