Have a new view showing users at /users/storage. No storage info yet, but it's a...
authorMisha Zatsman <misha-arvados@zatsman.com>
Tue, 22 Apr 2014 23:00:00 +0000 (23:00 +0000)
committerMisha Zatsman <misha-arvados@zatsman.com>
Tue, 22 Apr 2014 23:00:00 +0000 (23:00 +0000)
apps/workbench/app/controllers/users_controller.rb
apps/workbench/app/views/users/storage.html.erb [new file with mode: 0644]
apps/workbench/config/routes.rb

index 3077c2f6d36839da7c140847ef767f4e33d706b9..cf61c4bb22b2353486cbb2af0bc85e2c9acf6dcc 100644 (file)
@@ -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 (file)
index 0000000..ffa6700
--- /dev/null
@@ -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 %>
index 8c8923889da322d84e4ea387aa41991d3a1ca79a..9890ce47b29112a8e08620691121246eaa9b55ed 100644 (file)
@@ -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