Permalink
Browse files

Add two more buttons to dashboard; users, collections.

- Resolves #203
- Resolves #204
- Add total number of unique warcs (files) helper
- Add total number of unique collections helper
- Add buttons to Dashboard
- Add tests
  • Loading branch information...
ruebot committed Nov 5, 2018
1 parent a0be875 commit a873cf879f850da5f7001f4281e9d224ba200792
Showing with 38 additions and 14 deletions.
  1. +8 −0 app/helpers/dashboards_helper.rb
  2. +22 −14 app/views/dashboards/index.html.erb
  3. +8 −0 test/helpers/dashboards_helper_test.rb
@@ -73,6 +73,14 @@ def get_largest_collection_title
Collection.find(largest_collection[0][1]).title
end
def get_total_number_of_warcs
WasapiFile.distinct.count(:filename)
end
def get_total_number_of_collections
Collection.distinct.count(:collection_id)
end
def get_space_used
download_path = ENV['DOWNLOAD_PATH']
number_to_human_size(`du -sb "#{download_path}"`.split("\t").first.to_i)
@@ -3,46 +3,54 @@
<div class="container-fluid">
<div class="row-fluid">
<div class="panel panel-default">
<div class="panel-body">
<button type="button" class="btn-primary btn dashboard-btn btn-lg active">
<h3>Total Users</h3>
<div class="btn-group-justified">
<button type="button" class="btn-primary btn dashboard-btn btn-md active">
<h3>Users</h3>
<h1><%= get_number_of_users %></h1>
</button>
<button type="button" class="btn-primary btn dashboard-btn btn-lg active">
<button type="button" class="btn-primary btn dashboard-btn btn-md active">
<h3>Collections</h3>
<h1><%= get_total_number_of_collections %></h1>
</button>
<button type="button" class="btn-primary btn dashboard-btn btn-md active">
<h3>Files</h3>
<h1><%= get_total_number_of_warcs %></h1>
</button>
<button type="button" class="btn-primary btn dashboard-btn btn-md active">
<h3>Active Jobs</h3>
<h1><%= get_number_of_queued_jobs %></h1>
</button>
<button type="button" class="btn-primary btn dashboard-btn btn-lg active">
<button type="button" class="btn-primary btn dashboard-btn btn-md active">
<h3>Jobs Completed</h3>
<h1><%= get_total_number_of_jobs_run %></h1>
</button>
<button type="button" class="btn-primary btn dashboard-btn btn-lg active">
<button type="button" class="btn-primary btn dashboard-btn btn-md active">
<h3>Job Time</h3>
<h1><%= get_total_job_time %></h1>
</button>
<button type="button" class="btn-primary btn dashboard-btn btn-lg active">
<button type="button" class="btn-primary btn dashboard-btn btn-md active">
<h3>Longest Job</h3>
<h1><%= get_longest_job_time %></h1>
<h1><%= get_longest_job_time %></h1>
</button>
<button type="button" class="btn-primary btn dashboard-btn btn-lg active" data-toggle="tooltip" data-html="true" title="<%= get_most_jobs_user_institution %>">
<button type="button" class="btn-primary btn dashboard-btn btn-md active" data-toggle="tooltip" data-html="true" title="<%= get_most_jobs_user_institution %>">
<h3>Most Jobs</h3>
<h1><%= get_most_jobs_user %></h3>
</button>
<button type="button" class="btn-primary btn dashboard-btn btn-lg active" data-toggle="tooltip" data-html="true" title="<%= get_largest_collection_title %>">
<button type="button" class="btn-primary btn dashboard-btn btn-md active" data-toggle="tooltip" data-html="true" title="<%= get_largest_collection_title %>">
<h3>Largest Collection</h3>
<h1><%= get_largest_collection %></h1>
</button>
<button type="button" class="btn-primary btn dashboard-btn btn-lg active">
<button type="button" class="btn-primary btn dashboard-btn btn-md active">
<h3>Space Used</h3>
<h1><%= get_space_used %></h1>
</button>
<button type="button" class="btn-primary btn dashboard-btn btn-lg active">
<button type="button" class="btn-primary btn dashboard-btn btn-md active">
<h3>Space Available</h3>
<h1><%= get_space_available %></h1>
</button>
<button type="button" class="btn-primary btn dashboard-btn btn-lg active">
<button type="button" class="btn-primary btn dashboard-btn btn-md active">
<h3>Data Analyzed</h3>
<h1><%= data_analyzed %></h1>
<h1><%= data_analyzed %></h1>
</button>
</div>
</div>
@@ -82,4 +82,12 @@ def setup
test 'get total data analyzed' do
assert_equal '81.9 TB', data_analyzed
end
test 'get total number of warcs' do
assert_equal 2, get_total_number_of_warcs
end
test 'get total number of collections' do
assert_equal 2, get_total_number_of_collections
end
end

0 comments on commit a873cf8

Please sign in to comment.