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

Rework retries and scheduled index page to use API

This commit is contained in:
Mike Perham 2013-11-10 10:40:21 -08:00
parent 4248e406ed
commit f243b96fd2
3 changed files with 16 additions and 16 deletions

View file

@ -73,7 +73,7 @@ module Sidekiq
get '/retries' do
@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] }
@retries = @retries.map {|msg, score| Sidekiq::SortedEntry.new(nil, score, msg) }
erb :retries
end
@ -125,7 +125,7 @@ module Sidekiq
get '/scheduled' do
@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] }
@scheduled = @scheduled.map {|msg, score| Sidekiq::SortedEntry.new(nil, score, msg) }
erb :scheduled
end

View file

@ -25,24 +25,24 @@
<th><%= t('Error') %></th>
</tr>
</thead>
<% @retries.each do |msg, score| %>
<% @retries.each do |entry| %>
<tr>
<td>
<input type='checkbox' name='key[]' value='<%= job_params(msg, score) %>' />
<input type='checkbox' name='key[]' value='<%= job_params(entry.item, entry.score) %>' />
</td>
<td>
<a href="<%= root_path %>retries/<%= job_params(msg, score) %>"><%= relative_time(Time.at(score)) %></a>
<a href="<%= root_path %>retries/<%= job_params(entry.item, entry.score) %>"><%= relative_time(entry.at) %></a>
</td>
<td><%= msg['retry_count'] %></td>
<td><%= entry['retry_count'] %></td>
<td>
<a href="<%= root_path %>queues/<%= msg['queue'] %>"><%= msg['queue'] %></a>
<a href="<%= root_path %>queues/<%= entry.queue %>"><%= entry.queue %></a>
</td>
<td><%= msg['class'] %></td>
<td><%= entry.klass %></td>
<td>
<div class="args"><%= display_args(msg['args']) %></div>
<div class="args"><%= display_args(entry.args) %></div>
</td>
<td>
<div><%= h truncate("#{msg['error_class']}: #{msg['error_message']}", 200) %></div>
<div><%= h truncate("#{entry['error_class']}: #{entry['error_message']}", 200) %></div>
</td>
</tr>
<% end %>

View file

@ -24,20 +24,20 @@
<th><%= t('Arguments') %></th>
</tr>
</thead>
<% @scheduled.each do |msg, score| %>
<% @scheduled.each do |entry| %>
<tr>
<td>
<input type='checkbox' name='key[]' value='<%= job_params(msg, score) %>' />
<input type='checkbox' name='key[]' value='<%= job_params(entry.item, entry.score) %>' />
</td>
<td>
<a href="<%= root_path %>scheduled/<%= job_params(msg, score) %>"><%= relative_time(Time.at(score)) %></a>
<a href="<%= root_path %>scheduled/<%= job_params(entry.item, entry.score) %>"><%= relative_time(entry.at) %></a>
</td>
<td>
<a href="<%= root_path %>queues/<%= msg['queue'] %>"><%= msg['queue'] %></a>
<a href="<%= root_path %>queues/<%= entry.queue %>"><%= entry.queue %></a>
</td>
<td><%= msg['class'] %></td>
<td><%= entry.klass %></td>
<td>
<div class="args"><%= display_args(msg['args']) %></div>
<div class="args"><%= display_args(entry.args) %></div>
</td>
</tr>
<% end %>