Add users/activity page.
[arvados.git] / apps / workbench / app / views / users / activity.html.erb
1 <% content_for :css do %>
2 table#users-activity-table th {
3     overflow-x: hidden;
4 }
5 <% end %>
6 <table class="table table-bordered table-condensed table-fixedlayout" id="users-activity-table">
7   <colgroup>
8     <col width="28%" />
9   </colgroup>
10   <% @spans.each do |_| %>
11   <colgroup>
12     <% 3.times do %>
13     <col width="<%= (72 / @spans.count / 3).floor %>%" />
14     <% end %>
15   </colgroup>
16   <% end %>
17
18   <tr>
19     <th rowspan="2">User</th>
20     <% @spans.each do |span, start_at, end_at| %>
21     <th colspan="3" title="<%= start_at.to_s.sub(/ .*/, '') %> to <%= (end_at-1.second).to_s.sub(/ .*/, '') %>"><%= span %></th>
22     <% end %>
23   </tr>
24   <tr>
25     <% @spans.each do |span, _| %>
26     <th>Logins</th>
27     <th>Jobs</th>
28     <th>Pipelines</th>
29     <% end %>
30   </tr>
31
32   <% @users.each do |user| %>
33   <tr>
34     <td>
35       <small>
36         <%= link_to_if_arvados_object user, friendly_name: true %>
37       </small>
38     </td>
39
40     <% @spans.each do |span, _| %>
41     <% ['logins', 'jobs', 'pipeline_instances'].each do |type| %>
42     <td>
43       <small>
44         <%= @user_activity[user.uuid][span + " " + type].to_s %>
45       </small>
46     </td>
47     <% end %>
48     <% end %>
49   </tr>
50   <% end %>
51 </table>
52
53 <% content_for :footer_js do %>
54 $('#users-activity-table td small').each(function(){
55     if ($(this).html().trim() == '0')
56         $(this).css('opacity', '0.3');
57 });
58 <% end %>