Permalink
Browse files

Trim arguments and add "details" view for jobs,

so that jobs with long arguments don't screw up the #index view
  • Loading branch information...
1 parent b0b7582 commit ff28169350d6ceedadf42e39da3b1d9bce6217f6 Joshua Krall committed Apr 25, 2012
@@ -23,6 +23,10 @@ def self.included(base)
erb File.read(ResqueHistory::Server.erb_path('history.erb'))
end
+ get '/history/:id' do
+ erb File.read(ResqueHistory::Server.erb_path('history_details.erb')), :locals => id
+ end
+
post "/history/clear" do
Resque.reset_history
redirect u('history')
@@ -20,11 +20,11 @@
<th>Arguments</th>
<th>Time</th>
</tr>
- <% history.each do |history| %>
+ <% history.each_with_index do |history, i| %>
<% j = JSON.parse(history) %>
<tr>
<td class='queue'><%= j["class"] %></td>
- <td class='args'><%= j["args"] %></td>
+ <td class='args'><%= j["args"].to_s[0,20] %> &mdash; <a href='<%= u "history/#{start+i}" %>'>details</a></td>
<td class='args'><%= j["time"] %></td>
</tr>
<% end %>
@@ -0,0 +1,32 @@
+<% id = params[:id].to_i %>
+<% history = Resque.redis.lindex(Resque::Plugins::History::HISTORY_SET_NAME, id)%>
+<% j = JSON.parse(history) %>
+
+<h1 class='wi'>Job history</h1>
+
+<p class='intro'>Showing Item #<%=id%> &mdash; <a href="<%=u 'history' %>">Back to Job History list</a></p>
+
+<table class='queues1'>
+ <tr>
+ <th>Job</th>
+ </tr>
+ <tr>
+ <td class='queue'><%= j["class"] %></td>
+ </tr>
+ <tr>
+ <th>Arguments</th>
+ <th>Time</th>
+ </tr>
+ <tr>
+ <td class='args'><%= j["args"] %></td>
+ </tr>
+</table>
+ <tr>
+ <th>Time</th>
+ </tr>
+ <tr>
+ <td class='args'><%= j["time"] %></td>
+ </tr>
+</table>
+</table>
+

1 comment on commit ff28169

that's a really cool idea, would love to merge it in if you think this in a decent state :)

Please sign in to comment.