[ARVADOS] created: 8a0051a6fdd00f83e566cc87b88d2ac23ad5487d
git at public.curoverse.com
git at public.curoverse.com
Tue Apr 22 21:16:29 EDT 2014
at 8a0051a6fdd00f83e566cc87b88d2ac23ad5487d (commit)
commit 8a0051a6fdd00f83e566cc87b88d2ac23ad5487d
Author: Misha Zatsman <misha-arvados at zatsman.com>
Date: Wed Apr 23 01:14:31 2014 +0000
Working users/storage page!
diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index cf61c4b..72d44f5 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -66,6 +66,23 @@ class UsersController < ApplicationController
def storage
@breadcrumb_page_name = nil
@users = User.limit(params[:limit] || 1000).all
+ @user_storage = {}
+ @users.each do |u|
+ @user_storage[u.uuid] ||= {}
+ storage_log = Log.
+ # filter([[:object_uuid, '=', u.uuid],
+ # [:event_type, '=', 'user-storage-report']])
+ filter([[:object_uuid, '=', u.uuid],
+ [:event_type, '=', 'user-storage-report']]).
+ order(:created_at => :desc).
+ limit(1)
+ storage_log.each do |log_entry|
+ @user_storage[u.uuid] = log_entry['properties']
+ end
+ end
+ @users = @users.sort_by do |u|
+ [- at user_storage[u.uuid].values.push(0).inject(:+), u.full_name]
+ end
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 ffa6700..51d0c2e 100644
--- a/apps/workbench/app/views/users/storage.html.erb
+++ b/apps/workbench/app/views/users/storage.html.erb
@@ -43,6 +43,11 @@ table#users-storage-table .cell-for-span-Last-month {
<% end %>
</small>
</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>
+ <% end %>
</tr>
<% end %>
</table>
commit 0e7a1577b51111a9d503f21d40582da62c2dd7b9
Author: Misha Zatsman <misha-arvados at zatsman.com>
Date: Tue Apr 22 23:00:00 2014 +0000
Have a new view showing users at /users/storage. No storage info yet, but it's a start.
diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index 3077c2f..cf61c4b 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -1,5 +1,5 @@
class UsersController < ApplicationController
- skip_before_filter :find_object_by_uuid, :only => [:welcome, :activity]
+ skip_before_filter :find_object_by_uuid, :only => [:welcome, :activity, :storage]
skip_around_filter :thread_with_mandatory_api_token, :only => :welcome
before_filter :ensure_current_user_is_admin, only: [:sudo, :unsetup, :setup]
@@ -63,6 +63,11 @@ class UsersController < ApplicationController
@users = [OpenStruct.new(uuid: nil)] + @users
end
+ def storage
+ @breadcrumb_page_name = nil
+ @users = User.limit(params[:limit] || 1000).all
+ end
+
def show_pane_list
if current_user.andand.is_admin
super | %w(Admin)
diff --git a/apps/workbench/app/views/users/storage.html.erb b/apps/workbench/app/views/users/storage.html.erb
new file mode 100644
index 0000000..ffa6700
--- /dev/null
+++ b/apps/workbench/app/views/users/storage.html.erb
@@ -0,0 +1,55 @@
+<% content_for :css do %>
+table#users-storage-table th {
+ overflow-x: hidden;
+}
+table#users-storage-table .cell-for-span-This-month,
+table#users-storage-table .cell-for-span-Last-month {
+ background: #eee;
+}
+<% end %>
+<table class="table table-condensed arv-index" id="users-storage-table">
+ <colgroup>
+ <col width="28%" />
+ </colgroup>
+
+ <tr>
+ <th rowspan="2">User</th>
+ <th colspan="2">
+ Collections Read Size
+ </th>
+ <th colspan="2">
+ Collections Persisted Storage
+ </th>
+ </tr>
+ <tr>
+ <% 2.times do %>
+ <th>
+ Total (unweighted)
+ </th>
+ <th>
+ Shared (weighted)
+ </th>
+ <% end %>
+ </tr>
+
+ <% @users.each do |user| %>
+ <tr>
+ <td>
+ <small>
+ <% if user.uuid %>
+ <%= link_to_if_arvados_object user, friendly_name: true %>
+ <% else %>
+ <b>Total</b>
+ <% end %>
+ </small>
+ </td>
+ </tr>
+ <% end %>
+</table>
+
+<% content_for :footer_js do %>
+$('#users-storage-table td small').each(function(){
+ if ($(this).html().trim() == '0')
+ $(this).css('opacity', '0.3');
+});
+<% end %>
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index 8c89238..9890ce4 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -24,6 +24,7 @@ ArvadosWorkbench::Application.routes.draw do
get 'home', :on => :member
get 'welcome', :on => :collection
get 'activity', :on => :collection
+ get 'storage', :on => :collection
post 'sudo', :on => :member
post 'unsetup', :on => :member
get 'setup_popup', :on => :member
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list