/
_job.erb
80 lines (77 loc) · 2.96 KB
/
_job.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<div class="row" id="job-<%= job.jid %>">
<div class="span12">
<div class="row">
<div class="span10">
<h2>
<a href="/jobs/<%= job.jid %>"><%= job.jid %></a> | <strong><%= job.state %> / <a href="/queues/<%= job.queue %>"><%= job.queue %></a><%= job.worker_name.nil? ? "/ #{job.worker_name}" : "" %></strong>
</h2>
</div>
<div class="span2">
<div style="float:right">
<p>
<div class="btn-group">
<% if (job.state != "complete") %>
<button class="btn btn-danger" onclick="confirmation(this, 'Cancel?', function() { cancel('<%= job.jid %>', fade) })"><i class="icon-remove"></i></button>
<% end %>
<button class="btn<%= job.tracked ? " active" : "" %>" data-toggle="button" onclick="$(this).hasClass('active') ? untrack('<%= job.jid %>', fade) : track('<%= job.jid %>', [], fade)"><i class="icon-flag"></i></button>
<% if (job.state == 'failed') %>
<button class="btn btn-success" onclick="retry('<%= job.jid %>', fade)"><i class="icon-repeat"></i></button>
<% end %>
<button class="btn dropdown-toggle btn-success" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<% queues.each do |queue| %>
<a href="#" onclick="move('<%= job.jid %>', '<%= queue['name'] %>', fade)"><%= queue['name'] %></a>
<% end %>
</ul>
<% if (job.state != 'failed') %>
</button>
<% end %>
</div>
</p>
</div>
</div>
</div>
<div class="row">
<div class="span12" style="margin-bottom: 10px; margin-top: -8px">
<span class="badge"><%= job.priority >= 0 ? "+ #{job.priority}" : job.priority %></span> /
<% job.tags.each do |tag| %>
<span class="badge badge-info"><%= tag %></span>
<% end %>
</div>
</div>
<% if not defined? brief %>
<div class="row">
<div class="span6">
<h2>Data</h2>
<pre style="overflow-y:scroll; height: 200px"><%= JSON.pretty_generate(job.data) %></pre>
</div>
<div class="span6">
<h2>History</h2>
<div style="overflow-y:scroll; height: 200px">
<% job.history.reverse.each do |h| %>
<pre><strong><%= h['q'] %></strong>
Put: <%= strftime(Time.at(h['put'])) %><% if not h['popped'].nil? %>
Pop: <%= strftime(Time.at(h['popped'])) %> by <%= h['worker'] %><% end %><% if not h['completed'].nil? %>
Completed: <%= strftime(Time.at(h['completed'])) %><% end %><% if not h['failed'].nil? %>
Failed: <%= strftime(Time.at(h['failed'])) %><% end %></pre>
<% end %>
</div>
</div>
</div>
<% end %>
<% if job.failure.length > 0 %>
<div class="row">
<div class="span12">
<div class="alert alert-error">
<p>In <strong><%= job.queue %></strong> on <strong><%= job.failure['worker'] %></strong>
about <%= strftime(Time.at(job.failure['when'])) %></p>
<pre><%= job.failure['message'].gsub('>', '>').gsub('<', '<') %></pre>
</div>
</div>
</div>
<% end %>
<hr/>
</div>
</div>