lib/resque/server/views/working.erb
<% if params[:id] && (current_worker = Resque::Worker.find(params[:id])) && (data = current_worker.job) %>
<h1><%= current_worker %>'s job</h1>
<table>
<tr>
<th> </th>
<th>Where</th>
<th>Queue</th>
<th>Started</th>
<th>Class</th>
<th>Args</th>
</tr>
<tr>
<td><img src="<%=u 'working.png' %>" alt="working" title="working"></td>
<% host, pid, _ = current_worker.to_s.split(':') %>
<td><a href="<%=u "/workers/#{current_worker}" %>"><%= host %>:<%= pid %></a></td>
<% queue = data['queue'] %>
<td><a class="queue" href="<%=u "/queues/#{queue}" %>"><%= queue %></a></td>
<td><span class="time"><%= data['run_at'] %></span></td>
<% payload = data.key?('payload') ? data['payload'] : {} %>
<td>
<code><%= payload.key?('class') ? payload['class'] : "—" %></code>
</td>
<td><pre><%=h payload.key?('args') ? show_args(payload['args']) : "—" %></pre></td>
</tr>
</table>
<% else %>
<%
workers = resque.working
jobs = workers.collect {|w| w.job }
worker_jobs = workers.zip(jobs)
worker_jobs = worker_jobs.reject { |w, j| w.idle? }
%>
<h1 class='wi'><%= worker_jobs.size %> of <%= resque.workers.size %> Workers Working</h1>
<p class='intro'>The list below contains all workers which are currently running a job.</p>
<table class='workers'>
<tr>
<th> </th>
<th>Where</th>
<th>Queue</th>
<th>Processing</th>
</tr>
<% if worker_jobs.empty? %>
<tr>
<td colspan="4" class='no-data'>Nothing is happening right now...</td>
</tr>
<% end %>
<% worker_jobs.sort_by { |_w, j| j['run_at'] ? j['run_at'].to_s() : '' }.each do |worker, job| %>
<tr>
<td class='icon'><img src="<%=u state = worker.state %>.png" alt="<%= state %>" title="<%= state %>"></td>
<% host, pid, _queues = worker.to_s.split(':') %>
<td class='where'><a href="<%=u "/workers/#{worker}" %>"><%= host %>:<%= pid %></a></td>
<td class='queues queue'>
<a class="queue-tag" href="<%=u "/queues/#{job['queue']}" %>"><%= job['queue'] %></a>
</td>
<td class='process'>
<% if job['queue'] %>
<%= partial :processing, :worker => worker, :job => job %>
<% else %>
<span class='waiting'>Waiting for a job...</span>
<% end %>
</td>
</tr>
<% end %>
</table>
<% end %>