1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Closes #1120 Removed slim.

This commit is contained in:
Kirill Nikitin 2013-08-22 02:38:52 +04:00
parent 45de5a4707
commit 0a7e8ea439
35 changed files with 542 additions and 390 deletions

View file

@ -4,6 +4,7 @@
- Fix more race conditions in Web UI actions
- Don't reset Job enqueued\_at when retrying
- Timestamp tooltips in the Web UI should use UTC
- Removed slim dependency [Locke23rus, #1120]
2.13.1

View file

@ -1,8 +1,6 @@
source 'http://rubygems.org'
gemspec
gem 'slim', '1.1.0' # earliest verson supported
gem 'sqlite3', :platform => :mri
group :test do

View file

@ -1,8 +1,5 @@
require 'yaml'
require 'sinatra/base'
require 'slim'
raise "The Sidekiq Web UI requires slim 1.1.0 or greater. You have slim v#{Slim::VERSION}" if Gem::Version.new(Slim::VERSION) < Gem::Version.new('1.1.0')
require 'sidekiq'
require 'sidekiq/api'
@ -16,7 +13,6 @@ module Sidekiq
set :public_folder, Proc.new { "#{root}/assets" }
set :views, Proc.new { "#{root}/views" }
set :locales, Proc.new { "#{root}/locales" }
set :slim, :pretty => true
helpers do
def strings
@ -164,12 +160,12 @@ module Sidekiq
end
get "/workers" do
slim :index
erb :index
end
get "/queues" do
@queues = Sidekiq::Queue.all
slim :queues
erb :queues
end
get "/queues/:name" do
@ -178,7 +174,7 @@ module Sidekiq
@name = params[:name]
(@current_page, @total_size, @messages) = page("queue:#{@name}", params[:page], @count)
@messages = @messages.map {|msg| Sidekiq.load_json(msg) }
slim :queue
erb :queue
end
post "/reset" do
@ -200,14 +196,14 @@ module Sidekiq
@count = (params[:count] || 25).to_i
(@current_page, @total_size, @retries) = page("retry", params[:page], @count)
@retries = @retries.map {|msg, score| [Sidekiq.load_json(msg), score] }
slim :retries
erb :retries
end
get "/retries/:key" do
halt 404 unless params['key']
@retry = Sidekiq::RetrySet.new.fetch(*parse_params(params['key'])).first
redirect "#{root_path}retries" if @retry.nil?
slim :retry
erb :retry
end
post '/retries' do
@ -252,14 +248,14 @@ module Sidekiq
@count = (params[:count] || 25).to_i
(@current_page, @total_size, @scheduled) = page("schedule", params[:page], @count)
@scheduled = @scheduled.map {|msg, score| [Sidekiq.load_json(msg), score] }
slim :scheduled
erb :scheduled
end
get "/scheduled/:key" do
halt 404 unless params['key']
@job = Sidekiq::ScheduledSet.new.fetch(*parse_params(params['key'])).first
redirect "#{root_path}scheduled" if @job.nil?
slim :scheduled_job_info
erb :scheduled_job_info
end
post '/scheduled' do
@ -296,7 +292,7 @@ module Sidekiq
stats_history = Sidekiq::Stats::History.new((params[:days] || 30).to_i)
@processed_history = stats_history.processed
@failed_history = stats_history.failed
slim :dashboard
erb :dashboard
end
get '/dashboard/stats' do

View file

@ -14,7 +14,6 @@ gem 'sidekiq', :path => '..'
gem 'capistrano'
# sidekiq-web dependencies
gem 'slim', '1.1.0'
gem 'sinatra'
gem 'shotgun'

View file

@ -20,7 +20,6 @@ Gem::Specification.new do |gem|
gem.add_dependency 'celluloid', '>= 0.14.1'
gem.add_dependency 'json'
gem.add_development_dependency 'sinatra'
gem.add_development_dependency 'slim', '>= 1.1.0'
gem.add_development_dependency 'minitest', '~> 5'
gem.add_development_dependency 'rake'
gem.add_development_dependency 'actionmailer'

76
web/views/_job_info.erb Normal file
View file

@ -0,0 +1,76 @@
<header>
<h3><%= t('Job') %></h3>
</header>
<table class="table table-bordered table-striped">
<tbody>
<tr>
<th><%= t('Queue') %></th>
<td>
<a href="<%= root_path %>queues/<%= job['queue'] %>"><%= job['queue'] %></a>
</td>
</tr>
<tr>
<th><%= t('Class') %></th>
<td>
<code><%= job['class'] %></code>
</td>
</tr>
<tr>
<th><%= t('Arguments') %></th>
<td>
<code>
<!-- We don't want to truncate any job arguments when viewing a single job's status page -->
<div class="args-extended"><%= display_args(job['args'], nil) %></div>
</code>
</td>
</tr>
<tr>
<th>JID</th>
<td>
<code><%= job.jid %></code>
</td>
</tr>
<tr>
<th><%= t('Enqueued') %></th>
<td><%= relative_time(job.enqueued_at) %></td>
</tr>
<% unless retry_extra_items(job).empty? %>
<tr>
<th><%= t('Extras') %></th>
<td>
<code>
<%= retry_extra_items(job).inspect %>
</code>
</td>
</tr>
<% end %>
<% if type == :retry %>
<% if job['retry_count'] && job['retry_count'] > 0 %>
<tr>
<th><%= t('RetryCount') %></th>
<td><%= job['retry_count'] %></td>
</tr>
<tr>
<th><%= t('LastRetry') %></th>
<td><%= relative_time(job['retried_at'].is_a?(Numeric) ? Time.at(job['retried_at']) : Time.parse(job['retried_at'])) %></td>
</tr>
<% else %>
<tr>
<th><%= t('OriginallyFailed') %></th>
<td><%= relative_time(job['failed_at'].is_a?(Numeric) ? Time.at(job['failed_at']) : Time.parse(job['failed_at'])) %></td>
</tr>
<% end %>
<tr>
<th><%= t('NextRetry') %></th>
<td><%= relative_time(job.at) %></td>
</tr>
<% end %>
<% if type == :scheduled %>
<tr>
<th><%= t('Scheduled') %></th>
<td><%= relative_time(job.at) %></td>
</tr>
<% end %>
</tbody>
</table>

View file

@ -1,51 +0,0 @@
header
h3 = t('Job')
table class="table table-bordered table-striped"
tbody
tr
th = t('Queue')
td
a href="#{root_path}queues/#{job['queue']}" #{job['queue']}
tr
th = t('Class')
td
code= job['class']
tr
th = t('Arguments')
td
code
// We don't want to truncate any job arguments when viewing a single job's status page
div.args-extended=display_args(job['args'], nil)
tr
th JID
td
code= job.jid
tr
th = t('Enqueued')
td== relative_time(job.enqueued_at)
- unless retry_extra_items(job).empty?
tr
th = t('Extras')
td
code
= retry_extra_items(job).inspect
- if type == :retry
- if job['retry_count'] && job['retry_count'] > 0
tr
th = t('RetryCount')
td= job['retry_count']
tr
th = t('LastRetry')
td== relative_time(job['retried_at'].is_a?(Numeric) ? Time.at(job['retried_at']) : Time.parse(job['retried_at']))
- else
tr
th = t('OriginallyFailed')
td== relative_time(job['failed_at'].is_a?(Numeric) ? Time.at(job['failed_at']) : Time.parse(job['failed_at']))
tr
th = t('NextRetry')
td== relative_time(job.at)
- if type == :scheduled
tr
th = t('Scheduled')
td== relative_time(job.at)

23
web/views/_nav.erb Normal file
View file

@ -0,0 +1,23 @@
<div class="navbar-inner">
<div class="container">
<a class="brand" href="<%= root_path %>"><%= Sidekiq::NAME %></a>
<ul class="nav">
<% tabs.each do |title, url| %>
<% if url == '' %>
<li class="<%= current_path == url ? 'active' : '' %>">
<a href="<%= root_path %><%= url %>"><%= t(title) %></a>
</li>
<% else %>
<li class="<%= current_path.start_with?(url) ? 'active' : '' %>">
<a href="<%= root_path %><%= url %>"><%= t(title) %></a>
</li>
<% end %>
<% end %>
<% custom_tabs.each do |title, url| %>
<li class="<%= current_path.start_with?(url) ? 'active' : '' %>">
<a href="<%= root_path %><%= url %>"><%= t(title) %></a>
</li>
<% end %>
</ul>
</div>
</div>

View file

@ -1,16 +0,0 @@
.navbar-inner
.container
a.brand href='#{{root_path}}'
= Sidekiq::NAME
ul.nav
- tabs.each do |title, url|
- if url == ''
li class="#{current_path == url ? 'active' : ''}"
a href="#{{root_path}}#{{url}}" = t(title)
- else
li class="#{current_path.start_with?(url) ? 'active' : ''}"
a href="#{{root_path}}#{{url}}" = t(title)
- custom_tabs.each do |title, url|
li class="#{current_path.start_with?(url) ? 'active' : ''}"
a href="#{{root_path}}#{{url}}" = t(title)

25
web/views/_paging.erb Normal file
View file

@ -0,0 +1,25 @@
<% if @total_size > @count %>
<div class="pagination pagination-right">
<ul>
<li class="<%= 'disabled' if @current_page == 1 %>">
<a href="<%= url %>?page=1">«</a>
</li>
<% if @current_page > 1 %>
<li>
<a href="<%= url %>?page=<%= @current_page - 1 %>"><%= @current_page - 1 %></a>
</li>
<% end %>
<li class="disabled">
<a href="<%= url %>?page=<%= @current_page %>"><%= @current_page %></a>
</li>
<% if @total_size > @current_page * @count %>
<li>
<a href="<%= url %>?page=<%= @current_page + 1 %>"><%= @current_page + 1 %></a>
</li>
<% end %>
<li class="<%= 'disabled' if @total_size <= @current_page * @count %>">
<a href="<%= url %>?page=<%= (@total_size.to_f / @count).ceil %>">»</a>
</li>
</ul>
</div>
<% end %>

View file

@ -1,15 +0,0 @@
- if @total_size > @count
.pagination.pagination-right
ul
li class="#{'disabled' if @current_page == 1}"
a href="#{url}?page=1" «
- if @current_page > 1
li
a href="#{url}?page=#{@current_page - 1}" #{@current_page - 1}
li.disabled
a href="#{url}?page=#{@current_page}" #{@current_page}
- if @total_size > @current_page * @count
li
a href="#{url}?page=#{@current_page + 1}" #{@current_page + 1}
li class="#{'disabled' if @total_size <= @current_page * @count}"
a href="#{url}?page=#{(@total_size.to_f / @count).ceil}" »

4
web/views/_status.erb Normal file
View file

@ -0,0 +1,4 @@
<span class="status">
<i class="status-sprite status-<%= current_status %>"></i>
<% t(current_status) %>
</span>

View file

@ -1,3 +0,0 @@
span.status
i class="status-sprite status-#{current_status}"
== t(current_status)

26
web/views/_summary.erb Normal file
View file

@ -0,0 +1,26 @@
<ul class="unstyled summary row">
<li class="processed span2">
<span class="count"><%= number_with_delimiter(stats.processed) %></span>
<span class="desc"><%= t('Processed') %></span>
</li>
<li class="failed span2">
<span class="count"><%= number_with_delimiter(stats.failed) %></span>
<span class="desc"><%= t('Failed') %></span>
</li>
<li class="busy span2">
<span class="count"><%= number_with_delimiter(workers_size) %></span>
<span class="desc"><%= t('Busy') %></span>
</li>
<li class="scheduled span2">
<span class="count"><%= number_with_delimiter(stats.scheduled_size) %></span>
<span class="desc"><%= t('Scheduled') %></span>
</li>
<li class="retries span2">
<span class="count"><%= number_with_delimiter(stats.retry_size) %></span>
<span class="desc"><%= t('Retries') %></span>
</li>
<li class="enqueued span2">
<span class="count"><%= number_with_delimiter(stats.enqueued) %></span>
<span class="desc"><%= t('Enqueued') %></span>
</li>
</ul>

View file

@ -1,19 +0,0 @@
ul.unstyled.summary.row
li.processed.span2
span.count #{number_with_delimiter(stats.processed)}
span.desc = t('Processed')
li.failed.span2
span.count #{number_with_delimiter(stats.failed)}
span.desc = t('Failed')
li.busy.span2
span.count #{number_with_delimiter(workers_size)}
span.desc = t('Busy')
li.scheduled.span2
span.count #{number_with_delimiter(stats.scheduled_size)}
span.desc = t('Scheduled')
li.retries.span2
span.count #{number_with_delimiter(stats.retry_size)}
span.desc = t('Retries')
li.enqueued.span2
span.count #{number_with_delimiter(stats.enqueued)}
span.desc = t('Enqueued')

29
web/views/_workers.erb Normal file
View file

@ -0,0 +1,29 @@
<table class="workers table table-hover table-bordered table-striped table-white">
<thead>
<th><%= t('Worker') %></th>
<th><%= t('Queue') %></th>
<th><%= t('Class') %></th>
<th><%= t('Arguments') %></th>
<th><%= t('Started') %></th>
</thead>
<% workers.each_with_index do |(worker, msg), index| %>
<tr>
<td><%= worker %></td>
<td>
<a href="<%= root_path %>queues/<%= msg['queue'] %>">= msg['queue'] %></a>
</td>
<td><%= msg['payload']['class'] %></td>
<td>
<% if msg['payload']['args'].to_s.size > 100 %>
<%= msg['payload']['args'].inspect[0..100] + "... " %>
<button data-toggle="collapse" data-target="#worker_<%= index %>" class="btn btn-mini"><%= t('ShowAll') %></button>
<div class="toggle" id="worker_<%= index %>" style="display: none;max-width: 750px;"><%= msg['payload']['args'] %></div>
<% else %>
<%= msg['payload']['args'] %>
<% end %>
</td>
<td><%= relative_time(msg['run_at'].is_a?(Numeric) ? Time.at(msg['run_at']) : Time.parse(msg['run_at'])) %></td>
</tr>
<% end %>
</table>

View file

@ -1,21 +0,0 @@
table class="workers table table-hover table-bordered table-striped table-white"
thead
th = t('Worker')
th = t('Queue')
th = t('Class')
th = t('Arguments')
th = t('Started')
- workers.each_with_index do |(worker, msg), index|
tr
td= worker
td
a href="#{root_path}queues/#{msg['queue']}" = msg['queue']
td= msg['payload']['class']
td
- if msg['payload']['args'].to_s.size > 100
= msg['payload']['args'].inspect[0..100] + "... "
button data-toggle="collapse" data-target="#worker_#{index}" class="btn btn-mini" = t('ShowAll')
.toggle[id="worker_#{index}" style="display: none;max-width: 750px;"]= msg['payload']['args']
- else
= msg['payload']['args']
td== relative_time(msg['run_at'].is_a?(Numeric) ? Time.at(msg['run_at']) : Time.parse(msg['run_at']))

59
web/views/dashboard.erb Normal file
View file

@ -0,0 +1,59 @@
<script type="text/javascript" src="#<%= root_path %>javascripts/dashboard.js"></script>
<h3>
<%= t('Dashboard') %>
<span class="beacon">
<span class="ring"></span>
<span class="dot"></span>
</span>
</h3>
<h5></h5>
<div id="realtime"></div>
<h5>
<span class="history-heading"><%= t('History') %></span>
<a href="<%= root_path %>?days=7" class="history-graph <%= "active" if params[:days] == "7" %>"><%= t('OneWeek') %></a>
<a href="<%= root_path %>" class="history-graph <%= "active" if params[:days].nil? || params[:days] == "30" %>" ><%= t('OneMonth') %></a>
<a href="<%= root_path %>?days=90" class="history-graph <%= "active" if params[:days] == "90" %>"><%= t('ThreeMonths') %></a>
<a href="<%= root_path %>?days=180" class="history-graph <%= "active" if params[:days] == "180" %>"><%= t('SixMonths') %></a>
</h5>
<div id="history" data-processed="<%= Sidekiq.dump_json(@processed_history) %>" data-failed="<%= Sidekiq.dump_json(@failed_history) %>" data-update-url="<%= root_path %>dashboard/stats"></div>
<br/>
<h5>Redis</h5>
<% if @redis_info.fetch("redis_version", nil) %>
<div class="stat">
<h3 class="redis_version"><%= @redis_info.fetch("redis_version") %></h3>
<p><%= t('Version') %></p>
</div>
<% end %>
<% if @redis_info.fetch("uptime_in_days", nil) %>
<div class="stat">
<h3 class="uptime_in_days"><%= @redis_info.fetch("uptime_in_days") %></h3>
<p><%= t('Uptime') %></p>
</div>
<% end %>
<% if @redis_info.fetch("connected_clients", nil) %>
<div class="stat">
<h3 class="connected_clients"><%= @redis_info.fetch("connected_clients") %></h3>
<p><%= t('Connections') %></p>
</div>
<% end %>
<% if @redis_info.fetch("used_memory_human", nil) %>
<div class="stat">
<h3 class="used_memory_human"><%= @redis_info.fetch("used_memory_human") %></h3>
<p><%= t('MemoryUsage') %></p>
</div>
<% end %>
<% if @redis_info.fetch("used_memory_peak_human", nil) %>
<div class="stat">
<h3 class="used_memory_peak_human"><%= @redis_info.fetch("used_memory_peak_human") %></h3>
<p><%= @redis_info.fetch("used_memory_peak_human") %></p>
</div>
<% end %>

View file

@ -1,46 +0,0 @@
script type="text/javascript" src="#{{root_path}}javascripts/dashboard.js"
h3
= t('Dashboard')
span.beacon
.ring
.dot
h5 = t('Realtime')
#realtime
h5
span.history-heading = t('History')
a href="#{{root_path}}?days=7" class="history-graph #{{"active" if params[:days] == "7"}}" = t('OneWeek')
a href="#{{root_path}}" class="history-graph #{{"active" if params[:days].nil? || params[:days] == "30"}}" = t('OneMonth')
a href="#{{root_path}}?days=90" class="history-graph #{{"active" if params[:days] == "90"}}" = t('ThreeMonths')
a href="#{{root_path}}?days=180" class="history-graph #{{"active" if params[:days] == "180"}}" = t('SixMonths')
#history data-processed="#{Sidekiq.dump_json(@processed_history)}" data-failed="#{Sidekiq.dump_json(@failed_history)}" data-update-url="#{{root_path}}dashboard/stats"
br
h5 Redis
- if @redis_info.fetch("redis_version", nil)
.stat
h3.redis_version= @redis_info.fetch("redis_version")
p = t('Version')
- if @redis_info.fetch("uptime_in_days", nil)
.stat
h3.uptime_in_days= @redis_info.fetch("uptime_in_days")
p = t('Uptime')
- if @redis_info.fetch("connected_clients", nil)
.stat
h3.connected_clients= @redis_info.fetch("connected_clients")
p = t('Connections')
- if @redis_info.fetch("used_memory_human", nil)
.stat
h3.used_memory_human= @redis_info.fetch("used_memory_human")
p = t('MemoryUsage')
- if @redis_info.fetch("used_memory_peak_human", nil)
.stat
h3.used_memory_peak_human= @redis_info.fetch("used_memory_peak_human")
p = t('PeakMemoryUsage')

16
web/views/index.erb Normal file
View file

@ -0,0 +1,16 @@
<div class="row header">
<div class="span7">
<h3><%= t('Workers') %></h3>
</div>
</div>
<%= erb :_workers %>
<% if workers_size > 0 %>
<div class="row">
<div class="span2 pull-right">
<form action="<%= root_path %>reset" method="post">
<button class="btn btn-primary btn-block" type="submit"><%= t('ClearWorkerList') %></button>
</form>
</div>
</div>
<% end %>

View file

@ -1,10 +0,0 @@
.row.header
.span7
h3 = t('Workers')
== slim :_workers
- if workers_size > 0
.row
.span2.pull-right
form action="#{root_path}reset" method="post"
button.btn.btn-primary.btn-block type="submit" = t('ClearWorkerList')

73
web/views/layout.erb Normal file
View file

@ -0,0 +1,73 @@
<!doctype html>
<html>
<head>
<title><%= Sidekiq::NAME %></title>
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link href="<%= root_path %>stylesheets/bootstrap.css" media="screen" rel="stylesheet" type="text/css" />
<link href="<%= root_path %>stylesheets/application.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%= root_path %>javascripts/application.js"></script>
<script type="text/javascript" src="<%= root_path %>javascripts/locales/jquery.timeago.<%= locale %>.js"></script>
<% if params[:poll] %>
<script>
setInterval("window.location.reload(true)", 2000);
</script>
<% end %>
</head>
<body class="admin">
<div class="navbar navbar-fixed-top">
<%= erb :_nav %>
</div>
<div id="page">
<div class="container">
<div class="row">
<div class="span12 summary_bar">
<div class="row">
<h4 class="span10">
<span class="title"><%= t('Status') %></span>
<%= erb :_status %>
</h4>
<% unless current_path == '' %>
<div class="span2 pull-right actions">
<% if params[:poll] %>
<a id="live-poll" class="btn btn-block btn-primary active" href="<%= root_path %><%= current_path %>"><%= t('StopPolling') %></a>
<% else %>
<a id="live-poll" class="btn btn-block btn-primary" href="<%= root_path %><%= current_path %>?poll=true"><%= t('LivePoll') %></a>
<% end %>
</div>
<% end %>
</div>
<%= erb :_summary %>
</div>
<div class="span12">
<%= yield %>
</div>
</div>
</div>
</div>
<div class="navbar navbar-fixed-bottom navbar-inverse">
<div class="navbar-inner">
<div class="container">
<ul class="nav">
<li>
<p class="navbar-text" style="color:white;">Sidekiq v<%= Sidekiq::VERSION %></p>
</li>
<li>
<p class="navbar-text">Redis: <%= location %></p>
</li>
<li>
<p class="navbar-text"><%= t('Time') %>: <%= Time.now.utc.strftime('%H:%M:%S UTC') %></p>
</li>
<% if namespace %>
<li>
<p class="navbar-text"><%= t('Namespace') %>: <%= namespace %></p>
</li>
<% end %>
</ul>
</div>
</div>
</div>
</body>
</html>

View file

@ -1,50 +0,0 @@
doctype html
html
head
title= Sidekiq::NAME
meta name="viewport" content="width=device-width,initial-scale=1.0"
link href='#{{root_path}}stylesheets/bootstrap.css' media='screen' rel='stylesheet' type='text/css'
link href='#{{root_path}}stylesheets/application.css' media='screen' rel='stylesheet' type='text/css'
script type="text/javascript" src="#{{root_path}}javascripts/application.js"
script type="text/javascript" src="#{{root_path}}javascripts/locales/jquery.timeago.#{locale}.js"
- if params[:poll]
javascript:
setInterval("window.location.reload(true)", 2000);
body.admin
.navbar.navbar-fixed-top
==slim :_nav
#page
.container
.row
.span12.summary_bar
.row
h4.span10
span.title = t('Status')
== slim :_status
- unless current_path == ''
.span2.pull-right.actions
- if params[:poll]
a#live-poll.btn.btn-block.btn-primary.active href='#{{root_path}}#{{current_path}}' = t('StopPolling')
- else
a#live-poll.btn.btn-block.btn-primary href='#{{root_path}}#{{current_path}}?poll=true' = t('LivePoll')
== slim :_summary
.span12
== yield
.navbar.navbar-fixed-bottom.navbar-inverse
.navbar-inner
.container
ul.nav
li
p.navbar-text style="color:white;" Sidekiq v#{Sidekiq::VERSION}
li
p.navbar-text Redis: #{location}
li
p.navbar-text #{t('Time')}: #{Time.now.utc.strftime('%H:%M:%S UTC')}
- if namespace
li
p.navbar-text #{t('Namespace')}: #{namespace}

38
web/views/queue.erb Normal file
View file

@ -0,0 +1,38 @@
<header class="row">
<div class="span5">
<h3>
<%= t('CurrentMessagesInQueue', :queue => @name) %>
</h3>
</div>
<div class="span4 pull-right">
<%= erb :_paging, :locals => { :url => "#{root_path}queues/#{@name}" } %>
</div>
</header>
<table class="queue table table-hover table-bordered table-striped">
<thead>
<th><%= t('Class') %></th>
<th><%= t('Arguments') %></th>
<th></th>
</thead>
<% @messages.each_with_index do |msg, index| %>
<tr>
<td><%= msg['class'] %></td>
<td>
<% if msg['args'] and msg['args'].to_s.size > 100 %>
<%= msg['args'].inspect[0..100] + "... " %>
<button data-toggle="collapse" data-target="#worker_<%= index %>" class="btn btn-mini"><%= t('ShowAll') %></button>
<div class="toggle" id="worker_<%= index %>" style="display: none;"><%= msg['args'] %></div>
<% else %>
<%= msg['args'] %>
<% end %>
</td>
<td>
<form action="<%= root_path %>queues/<%= @name %>/delete" method="post">
<input name="key_val" value="<%= Sidekiq.dump_json(msg) %>" type="hidden" />
<input class="btn btn-danger btn-mini" type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSure') %>" />
</form>
</td>
</tr>
<% end %>
</table>
<%= erb :_paging, :locals => { :url => "#{root_path}queues/#{@name}" } %>

View file

@ -1,27 +0,0 @@
header.row
.span5
h3
== t('CurrentMessagesInQueue', :queue => @name)
.span4.pull-right
== slim :_paging, :locals => { :url => "#{root_path}queues/#{@name}" }
table class="queue table table-hover table-bordered table-striped"
thead
th = t('Class')
th = t('Arguments')
th
- @messages.each_with_index do |msg, index|
tr
td= msg['class']
td
- if msg['args'] and msg['args'].to_s.size > 100
= msg['args'].inspect[0..100] + "... "
button data-toggle="collapse" data-target="#worker_#{index}" class="btn btn-mini" = t('ShowAll')
.toggle[id="worker_#{index}" style="display: none;"]= msg['args']
- else
= msg['args']
td
form action="#{root_path}queues/#{@name}/delete" method="post"
input name="key_val" value="#{Sidekiq.dump_json(msg)}" type="hidden"
input.btn.btn-danger.btn-mini type="submit" name="delete" value="#{t('Delete')}" data-confirm="#{t('AreYouSure')}"
== slim :_paging, :locals => { :url => "#{root_path}queues/#{@name}" }

22
web/views/queues.erb Normal file
View file

@ -0,0 +1,22 @@
<h3><%= t('Queues') %></h3>
<table class="queues table table-hover table-bordered table-striped table-white">
<thead>
<th><%= t('Queue') %></th>
<th><%= t('Size') %></th>
<th><%= t('Actions') %></th>
</thead>
<% @queues.each do |queue| %>
<tr>
<td>
<a href="<%= root_path %>queues/<%= queue.name %>"><%= queue.name %></a>
</td>
<td><%= number_with_delimiter(queue.size) %> </td>
<td width="20%">
<form action="<%=root_path %>queues/<%= queue.name %>" method="post">
<input class="btn btn-danger btn-small" type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSureDeleteQueue', :queue => queue.name) %>" />
</form>
</td>
</tr>
<% end %>
</table>

View file

@ -1,15 +0,0 @@
h3 = t('Queues')
table class="queues table table-hover table-bordered table-striped table-white"
thead
th = t('Queue')
th = t('Size')
th = t('Actions')
- @queues.each do |queue|
tr
td
a href="#{root_path}queues/#{queue.name}" #{queue.name}
td= number_with_delimiter(queue.size)
td width="20%"
form action="#{root_path}queues/#{queue.name}" method="post"
input.btn.btn-danger.btn-small type="submit" name="delete" value="#{t('Delete')}" data-confirm="#{t('AreYouSureDeleteQueue', :queue => queue.name)}"

57
web/views/retries.erb Normal file
View file

@ -0,0 +1,57 @@
<header class="row">
<div class="span5">
<h3><%= t('Retries') %></h3>
</div>
<div class="span4">
<% if @retries.size > 0 %>
<%= erb :_paging, :locals => { :url => "#{root_path}retries" } %>
<% end %>
</div>
</header>
<% if @retries.size > 0 %>
<form action="<%= root_path %>retries" method="post">
<table class="table table-striped table-bordered table-white">
<tr>
<th width="20px">
<input type="checkbox" class="check_all" />
</th>
<th width="25%"><%= t('NextRetry') %></th>
<th width="11%"><%= t('RetryCount') %></th>
<th><%= t('Queue') %></th>
<th><%= t('Worker') %></th>
<th><%= t('Arguments') %></th>
</tr>
<% @retries.each do |msg, score| %>
<tr>
<td>
<input type='checkbox' name='key[]' value='<%= job_params(msg, score) %>' />
</td>
<td>
<a href="<%= root_path %>retries/<%= job_params(msg, score) %>"><%= relative_time(Time.at(score)) %></a>
</td>
<td><%= msg['retry_count'] %></td>
<td>
<a href="<%= root_path %>queues/<%= msg['queue'] %>"><%= msg['queue'] %></a>
</td>
<td><%= msg['class'] %></td>
<td>
<div class="args"><%= display_args(msg['args']) %></div>
</td>
</tr>
<% end %>
</table>
<input class="btn btn-primary btn-small pull-left" type="submit" name="retry" value="<%= t('RetryNow') %>" />
<input class="btn btn-danger btn-small pull-left" type="submit" name="delete" value="<%= t('Delete') %>" />
</form>
<form action="<%= root_path %>retries/all/delete" method="post">
<input class="btn btn-danger btn-small pull-right" type="submit" name="delete" value="<%= t('DeleteAll') %>" data-confirm="<%= t('AreYouSure') %>" />
</form>
<form action="<%= root_path %>retries/all/retry" method="post">
<input class="btn btn-danger btn-small pull-right" type="submit" name="retry" value="<%= t('RetryAll') %>" data-confirm="<%= t('AreYouSure') %>" />
</form>
<% else %>
<div class="alert alert-success"><%= t('NoRetriesFound') %></div>
<% end %>

View file

@ -1,41 +0,0 @@
header.row
.span5
h3 = t('Retries')
.span4
- if @retries.size > 0
== slim :_paging, :locals => { :url => "#{root_path}retries" }
- if @retries.size > 0
form action="#{root_path}retries" method="post"
table class="table table-striped table-bordered table-white"
tr
th width="20px"
input type="checkbox" class="check_all"
th width="25%" = t('NextRetry')
th width="11%" = t('RetryCount')
th = t('Queue')
th = t('Worker')
th = t('Arguments')
- @retries.each do |msg, score|
tr
td
input type='checkbox' name='key[]' value='#{job_params(msg, score)}'
td
a href="#{root_path}retries/#{job_params(msg, score)}"== relative_time(Time.at(score))
td= msg['retry_count']
td
a href="#{root_path}queues/#{msg['queue']}" #{msg['queue']}
td= msg['class']
td
div.args=display_args(msg['args'])
input.btn.btn-primary.btn-small.pull-left type="submit" name="retry" value="#{t('RetryNow')}"
input.btn.btn-danger.btn-small.pull-left type="submit" name="delete" value="#{t('Delete')}"
form action="#{root_path}retries/all/delete" method="post"
input.btn.btn-danger.btn-small.pull-right type="submit" name="delete" value="#{t('DeleteAll')}" data-confirm="#{t('AreYouSure')}"
form action="#{root_path}retries/all/retry" method="post"
input.btn.btn-danger.btn-small.pull-right type="submit" name="retry" value="#{t('RetryAll')}" data-confirm="#{t('AreYouSure')}"
- else
.alert.alert-success = t('NoRetriesFound')

30
web/views/retry.erb Normal file
View file

@ -0,0 +1,30 @@
<%= erb :_job_info, :locals => {:job => @retry, :type => :retry} %>
<h3><%= t('Error') %></h3>
<table class="error table table-bordered table-striped">
<tbody>
<tr>
<th><%= t('ErrorClass') %></th>
<td>
<code><%= @retry['error_class'] %></code>
</td>
</tr>
<tr>
<th><%= t('ErrorMessage') %></th>
<td><%= @retry['error_message'] %></td>
</tr>
<% if !@retry['error_backtrace'].nil? %>
<tr>
<th><%= t('ErrorBacktrace') %></th>
<td>
<code><%= @retry['error_backtrace'].join("<br/>") %></code>
</td>
</tr>
<% end %>
</tbody>
</table>
<form class="form-horizontal" action="<%= root_path %>retries/<%= job_params(@retry, @retry.score) %>" method="post">
<a class="btn" href="<%= root_path %>retries"><%= t('GoBack') %></a>
<input class="btn btn-primary" type="submit" name="retry" value="<%= t('RetryNow') %>" />
<input class="btn btn-danger" type="submit" name="delete" value="<%= t('Delete') %>" />
</form>

View file

@ -1,21 +0,0 @@
== slim :_job_info, :locals => {:job => @retry, :type => :retry}
h3 = t('Error')
table class="error table table-bordered table-striped"
tbody
tr
th = t('ErrorClass')
td
code= @retry['error_class']
tr
th = t('ErrorMessage')
td= @retry['error_message']
- if !@retry['error_backtrace'].nil?
tr
th = t('ErrorBacktrace')
td
code== @retry['error_backtrace'].join("<br/>")
form.form-horizontal action="#{root_path}retries/#{job_params(@retry, @retry.score)}" method="post"
a.btn href="#{root_path}retries" = t('GoBack')
input.btn.btn-primary type="submit" name="retry" value="#{t('RetryNow')}"
input.btn.btn-danger type="submit" name="delete" value="#{t('Delete')}"

48
web/views/scheduled.erb Normal file
View file

@ -0,0 +1,48 @@
<header class="row">
<div class="span5">
<h3><%= t('ScheduledJobs') %></h3>
</div>
<div class="span4">
<% if @scheduled.size > 0 %>
<%= erb :_paging, :locals => { :url => "#{root_path}scheduled" } %>
<% end %>
</div>
</header>
<% if @scheduled.size > 0 %>
<form action="<%= root_path %>scheduled" method="post">
<table class="table table-striped table-bordered table-white">
<thead>
<th width="20px">
<input type="checkbox" class="check_all" />
</th>
<th width="25%"><%= t('When') %></th>
<th width="10%"><%= t('Queue') %></th>
<th><%= t('Worker') %></th>
<th><%= t('Arguments') %></th>
</thead>
<% @scheduled.each do |msg, score| %>
<tr>
<td>
<input type='checkbox' name='key[]' value='<%= job_params(msg, score) %>' />
</td>
<td>
<a href="<%= root_path %>scheduled/<%= job_params(msg, score) %>"><%= relative_time(Time.at(score)) %></a>
</td>
<td>
<a href="<%= root_path %>queues/<%= msg['queue'] %>"><%= msg['queue'] %></a>
</td>
<td><%= msg['class'] %></td>
<td>
<div class="args"><%= display_args(msg['args']) %></div>
</td>
</tr>
<% end %>
</table>
<input class="btn btn-danger pull-right" type="submit" name="delete" value="<%= t('Delete') %>" />
<input class="btn btn-danger pull-right" type="submit" name="add_to_queue" value="<%= t('AddToQueue') %>" />
</form>
<% else %>
<div class="alert alert-success"><%= t('NoScheduledFound') %></div>
<% end %>

View file

@ -1,33 +0,0 @@
header.row
.span5
h3 = t('ScheduledJobs')
.span4
- if @scheduled.size > 0
== slim :_paging, :locals => { :url => "#{root_path}scheduled" }
- if @scheduled.size > 0
form action="#{root_path}scheduled" method="post"
table class="table table-striped table-bordered table-white"
thead
th width="20px"
input type="checkbox" class="check_all"
th width="25%" = t('When')
th width="10%" = t('Queue')
th = t('Worker')
th = t('Arguments')
- @scheduled.each do |msg, score|
tr
td
input type='checkbox' name='key[]' value='#{job_params(msg, score)}'
td
a href="#{root_path}scheduled/#{job_params(msg, score)}"== relative_time(Time.at(score))
td
a href="#{root_path}queues/#{msg['queue']}" #{msg['queue']}
td= msg['class']
td
div.args=display_args(msg['args'])
input.btn.btn-danger.pull-right type="submit" name="delete" value="#{t('Delete')}"
input.btn.btn-danger.pull-right type="submit" name="add_to_queue" value="#{t('AddToQueue')}"
- else
.alert.alert-success = t('NoScheduledFound')

View file

@ -0,0 +1,7 @@
<%= erb :_job_info, :locals => {:job => @job, :type => :scheduled} %>
<form class="form-horizontal" action="<%= root_path %>scheduled/<%= job_params(@job, @job.score) %>" method="post">
<a class="btn" href="<%= root_path %>scheduled"><%= t('GoBack') %></a>
<input class="btn btn-primary" type="submit" name="add_to_queue" value="<%= t('AddToQueue') %>" />
<input class="btn btn-danger" type="submit" name="delete" value="<%= t('Delete') %>" />
</form>

View file

@ -1,6 +0,0 @@
== slim :_job_info, :locals => {:job => @job, :type => :scheduled}
form.form-horizontal action="#{root_path}scheduled/#{job_params(@job, @job.score)}" method="post"
a.btn href="#{root_path}scheduled" = t('GoBack')
input.btn.btn-primary type="submit" name="add_to_queue" value="#{t('AddToQueue')}"
input.btn.btn-danger type="submit" name="delete" value="#{t('Delete')}"