Merge branch '11807-yaml-to-json'
[arvados.git] / apps / workbench / app / views / users / storage.html.erb
index 51d0c2e1e3986cea501c9dc3d68f30c66d16aba2..151ea8bb933515a83a0a53429853704493b7806b 100644 (file)
@@ -1,15 +1,19 @@
+<%# Copyright (C) The Arvados Authors. All rights reserved.
+
+SPDX-License-Identifier: AGPL-3.0 %>
+
 <% content_for :css do %>
 table#users-storage-table th {
     overflow-x: hidden;
+    text-align: center;
 }
-table#users-storage-table .cell-for-span-This-month,
-table#users-storage-table .cell-for-span-Last-month {
-    background: #eee;
+table#users-storage-table .byte-value {
+    text-align: right;
 }
 <% end %>
 <table class="table table-condensed arv-index" id="users-storage-table">
   <colgroup>
-    <col width="28%" />
+    <col />
   </colgroup>
 
   <tr>
@@ -20,13 +24,14 @@ table#users-storage-table .cell-for-span-Last-month {
     <th colspan="2">
       Collections Persisted Storage
     </th>
+    <th rowspan="2">Measured At</th>
   </tr>
   <tr>
     <% 2.times do %>
-    <th>
+    <th class="byte-value">
       Total (unweighted)
     </th>
-    <th>
+    <th class="byte-value">
       Shared (weighted)
     </th>
     <% end %>
@@ -35,17 +40,22 @@ table#users-storage-table .cell-for-span-Last-month {
   <% @users.each do |user| %>
   <tr>
     <td>
+      <% if user.uuid %>
       <small>
-       <% if user.uuid %>
-       <%= link_to_if_arvados_object user, friendly_name: true %>
-       <% else %>
-       <b>Total</b>
-       <% end %>
+        <%= link_to_if_arvados_object user, friendly_name: true %>
       </small>
+      <% else %>
+      <b>Total</b>
+      <% end %>
     </td>
     <% [:read_collections_total_bytes, :read_collections_weighted_bytes, :persisted_collections_total_bytes, :persisted_collections_weighted_bytes].each do |key| %>
-    <td>
-      <%= @user_storage[user.uuid][key].to_s %>
+    <td class="byte-value">
+      <%= human_readable_bytes_html(@user_storage[user.uuid].fetch(key,0).floor) %>
+    </td>
+    <% end %>
+    <% if @log_date.key?(user.uuid) %>
+    <td class="date" title="<%= @log_date[user.uuid] %>">
+      <%= @log_date[user.uuid].strftime('%F') %>
     </td>
     <% end %>
   </tr>
@@ -54,7 +64,7 @@ table#users-storage-table .cell-for-span-Last-month {
 
 <% content_for :footer_js do %>
 $('#users-storage-table td small').each(function(){
-    if ($(this).html().trim() == '0')
-       $(this).css('opacity', '0.3');
+  if ($(this).html().trim() == '0')
+    $(this).css('opacity', '0.3');
 });
 <% end %>