[ARVADOS] updated: 4aef6531076e8c9d00252050d0757b32a22519c1

git at public.curoverse.com git at public.curoverse.com
Wed Apr 23 17:28:35 EDT 2014


Summary of changes:
 apps/workbench/app/controllers/users_controller.rb |    6 ++++++
 apps/workbench/app/views/users/storage.html.erb    |   10 +++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

       via  4aef6531076e8c9d00252050d0757b32a22519c1 (commit)
      from  2ed4ec45553b9931f78ca88b694f590102ed2bbd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 4aef6531076e8c9d00252050d0757b32a22519c1
Author: Misha Zatsman <misha-arvados at zatsman.com>
Date:   Wed Apr 23 21:20:57 2014 +0000

    Added row to display totals.

diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index 53f3d39..8a3d35a 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -67,6 +67,7 @@ class UsersController < ApplicationController
     @breadcrumb_page_name = nil
     @users = User.limit(params[:limit] || 1000).all
     @user_storage = {}
+    total_storage = {}
     @log_date = {}
     @users.each do |u|
       @user_storage[u.uuid] ||= {}
@@ -76,12 +77,17 @@ class UsersController < ApplicationController
         order(:created_at => :desc).
         limit(1)
       storage_log.each do |log_entry|
+        # We expect this block to only execute once since we specified limit(1)
         @user_storage[u.uuid] = log_entry['properties']
         @log_date[u.uuid] = log_entry['event_at']
       end
+      total_storage.merge!(@user_storage[u.uuid]) { |k,v1,v2| v1 + v2 }
     end
     @users = @users.sort_by { |u|
       [- at user_storage[u.uuid].values.push(0).inject(:+), u.full_name]}
+    # Prepend a "Total" pseudo-user to the sorted list
+    @users = [OpenStruct.new(uuid: nil)] + @users
+    @user_storage[nil] = total_storage
   end
 
   def show_pane_list
diff --git a/apps/workbench/app/views/users/storage.html.erb b/apps/workbench/app/views/users/storage.html.erb
index b82fd85..e736e78 100644
--- a/apps/workbench/app/views/users/storage.html.erb
+++ b/apps/workbench/app/views/users/storage.html.erb
@@ -36,13 +36,13 @@ table#users-storage-table .byte-value {
   <% @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 class="byte-value">

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list