Merge branch '18947-githttpd'
[arvados.git] / apps / workbench / app / views / users / activity.html.erb
1 <%# Copyright (C) The Arvados Authors. All rights reserved.
2
3 SPDX-License-Identifier: AGPL-3.0 %>
4
5 <% content_for :css do %>
6 table#users-activity-table th {
7     overflow-x: hidden;
8 }
9 table#users-activity-table .cell-for-span-This-month,
10 table#users-activity-table .cell-for-span-Last-month {
11     background: #eee;
12 }
13 <% end %>
14 <table class="table table-condensed arv-index" id="users-activity-table">
15   <colgroup>
16     <col width="28%" />
17   </colgroup>
18   <% @spans.each do |_| %>
19   <colgroup>
20     <% 3.times do %>
21     <col width="<%= (72 / @spans.count / 3).floor %>%" />
22     <% end %>
23   </colgroup>
24   <% end %>
25
26   <tr>
27     <th scope="col" rowspan="2">User</th>
28     <% @spans.each do |span, start_at, end_at| %>
29     <th scope="col" colspan="3" class="cell-for-span-<%= span.gsub ' ','-' %>">
30       <%= span %>
31       <br />
32       <%= start_at.strftime('%b %-d') %>
33       -
34       <%= (end_at-1.second).strftime('%b %-d') %>
35     </th>
36     <% end %>
37   </tr>
38   <tr>
39     <% @spans.each do |span, _| %>
40     <th scope="col" class="cell-for-span-<%= span.gsub ' ','-' %>">Logins</th>
41     <th scope="col" class="cell-for-span-<%= span.gsub ' ','-' %>">Jobs</th>
42     <th scope="col" class="cell-for-span-<%= span.gsub ' ','-' %>">Pipelines</th>
43     <% end %>
44   </tr>
45
46   <% @users.each do |user| %>
47   <tr>
48     <td>
49       <small>
50         <% if user.uuid %>
51         <%= link_to_if_arvados_object user, friendly_name: true %>
52         <% else %>
53         <b>Total</b>
54         <% end %>
55       </small>
56     </td>
57
58     <% @spans.each do |span, _| %>
59     <% ['logins', 'jobs', 'pipeline_instances'].each do |type| %>
60     <td class="cell-for-span-<%= span.gsub ' ','-' %>">
61       <small>
62         <%= @user_activity[user.uuid][span + " " + type].to_s %>
63       </small>
64     </td>
65     <% end %>
66     <% end %>
67   </tr>
68   <% end %>
69 </table>
70
71 <% content_for :footer_js do %>
72 $('#users-activity-table td small').each(function(){
73   if ($(this).html().trim() == '0')
74     $(this).css('opacity', '0.3');
75 });
76 <% end %>