lib/resque/server/views/failed.erb in resque-1.23.0 vs lib/resque/server/views/failed.erb in resque-1.23.1
- old
+ new
@@ -1,67 +1,28 @@
-<%start = params[:start].to_i %>
-<%failed = Resque::Failure.all(start, 20)%>
-<% index = 0 %>
-<% date_format = "%Y/%m/%d %T %z" %>
+<% if failed_multiple_queues? && !params[:queue] %>
+<h1>All Failed Queues: <%= Resque::Failure.queues.size %> total</h1>
+<% else %>
+<h1>Failed Jobs <%= "on '#{params[:queue]}'" if params[:queue] %> <%= "with class '#{params[:class]}'" if params[:class] %></h1>
+<% end %>
-<h1>Failed Jobs</h1>
-<%unless failed.empty?%>
-<form method="POST" action="<%=u 'failed/clear'%>">
- <input type='submit' name='' value='Clear Failed Jobs' />
+<% unless failed_size.zero? %>
+<form method="POST" action="<%= u "failed#{'/' + params[:queue] if params[:queue]}/clear" %>">
+ <input type="submit" name="" value="Clear <%= params[:queue] ? "'#{params[:queue]}'" : 'Failed' %> Jobs" />
</form>
-<form method="POST" action="<%=u 'failed/requeue/all'%>">
- <input type='submit' name='' value='Retry Failed Jobs' />
+<form method="POST" action="<%= u "failed#{'/' + params[:queue] if params[:queue]}/requeue/all" %>">
+ <input type="submit" name="" value="Retry <%= params[:queue] ? "'#{params[:queue]}'" : 'Failed' %> Jobs" />
</form>
-<%end%>
+<% end %>
-<p class='sub'>Showing <%=start%> to <%= start + 20 %> of <b><%= size = Resque::Failure.count %></b> jobs</p>
+<% if failed_multiple_queues? && !params[:queue] %>
+<%= partial :failed_queues_overview %>
+<% else %>
+<p class='sub'>Showing <%= failed_start_at %> to <%= failed_end_at %> of <b><%= failed_size %></b> jobs</p>
<ul class='failed'>
- <%for job in failed%>
- <% index += 1 %>
- <li>
- <dl>
- <% if job.nil? %>
- <dt>Error</dt>
- <dd>Job <%= index%> could not be parsed; perhaps it contains invalid JSON?</dd>
- <% else %>
- <dt>Worker</dt>
- <dd>
- <a href="<%= u(:workers, job['worker']) %>"><%= job['worker'].split(':')[0...2].join(':') %></a> on <b class='queue-tag'><%= job['queue'] %></b > at <b><span class="time"><%= Time.parse(job['failed_at']).strftime(date_format) %></span></b>
- <% if job['retried_at'] %>
- <div class='retried'>
- Retried <b><span class="time"><%= Time.parse(job['retried_at']).strftime(date_format) %></span></b>
- <a href="<%= u "failed/remove/#{start + index - 1}" %>" class="remove" rel="remove">Remove</a>
- </div>
- <% else %>
- <div class='controls'>
- <a href="<%= u "failed/requeue/#{start + index - 1}" %>" rel="retry">Retry</a>
- or
- <a href="<%= u "failed/remove/#{start + index - 1}" %>" rel="remove">Remove</a>
- </div>
- <% end %>
- </dd>
- <dt>Class</dt>
- <dd><code><%= job['payload'] ? job['payload']['class'] : 'nil' %></code></dd>
- <dt>Arguments</dt>
- <dd><pre><%=h job['payload'] ? show_args(job['payload']['args']) : 'nil' %></pre></dd>
- <dt>Exception</dt>
- <dd><code><%= job['exception'] %></code></dd>
- <dt>Error</dt>
- <dd class='error'>
- <% if job['backtrace'] %>
- <a href="#" class="backtrace"><%= h(job['error']) %></a>
- <pre style='display:none'><%=h job['backtrace'].join("\n") %></pre>
- <% else %>
- <%=h job['error'] %>
- <% end %>
- </dd>
- <% end %>
- </dl>
- <div class='r'>
- </div>
- </li>
- <%end%>
+ <% Resque::Failure.each(failed_start_at, failed_per_page, params[:queue], params[:class]) do |id, job| %>
+ <%= partial :failed_job, :id => id, :job => job %>
+ <% end %>
</ul>
-<%= partial :next_more, :start => start, :size => size %>
-
+<%= partial :next_more, :start => failed_start_at, :size => failed_size unless params[:class] %>
+<% end %>