/
_building_table.html.erb
72 lines (71 loc) · 2.62 KB
/
_building_table.html.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
<div id="building_list">
<% if @workerstatus.has_key? "building" %>
<table class="building" id="building_table">
<thead>
<tr>
<th>Project</th>
<th>Package</th>
<th>Repository - Build Arch</th>
<th>Job time</th>
<th>Build Host</th>
<th>Host Arch</th>
</tr>
</thead>
<tbody>
<% @workerstatus.elements("building").sort {|a,b| b["starttime"] <=> a["starttime"] }.each do |b| %>
<tr>
<td class="project">
<% if b["project"].include? "---" %>
-------
<% else %>
<% project = b["project"] %>
<%= link_to project, :controller => 'project', :action => 'show', :project => project %>
<% end %>
</td>
<td class="package">
<% if b["package"].include? "---" %>
-------
<% else %>
<%= link_to b["package"], :controller => 'package', :action => 'show', :project => project, :package => b["package"] %>
<% end %>
</td>
<td class="repository arch">
<% if b["repository"].include? "---" %>
-------
<% else %>
<%= link_to b["repository"] + ' - ' + b["arch"], :controller => 'package', :action => 'live_build_log',
:project => b["project"], :package => b["package"], :repository => b["repository"], :arch => b["arch"] %>
<% end %>
</td>
<%
start_time = Time.at(b["starttime"].to_i)
if start_time < @dead_line
n = ((start_time - @dead_line).abs/60/@interval_steps).round
n = (@max_color < n) ? 0 : @max_color - n
warning_style = "style=\"background-color: rgb(255,#{n},0);\""
else
warning_style = nil
end
%>
<td class="starttime" <%= raw warning_style if warning_style %> title="start time: <%= start_time.iso8601 %>">
<span style="display: none" class="sorttime"><%= b["starttime"].to_i %></span>
<%= distance_of_time_in_words(@time_now, start_time, true) %>
</td>
<td class="uri"><%= b["workerid"] %></td>
<td class="hostarch"><%= b["hostarch"] %></td>
</tr>
<% end %>
</tbody>
</table>
<%= content_for :ready_function do %>
$('#building_table').dataTable({
'aaSorting': [[3, 'desc']],
'bInfo': false,
'bPaginate': false,
'oSearch': {'sSearch': '<%= @project_filter %>', 'bRegex': false, 'bSmart': false},
});
<% end %>
<% else %>
<p><i>No build jobs</i></p>
<% end %>
</div>