diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2016-12-26 09:48:30 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2016-12-26 09:48:30 +0000 |
commit | 0ebd50ce0015a6a1dcd273cada9d9be8c20a12bb (patch) | |
tree | 4a92afbdd3e1e473f7d881024b49a36b9d5d3ebb /app/helpers | |
parent | 645412b57f558d58418aad278c9a3bf421439e1c (diff) | |
parent | 3ef4f74b1acc9399db320b53dffc592542de0126 (diff) | |
download | gitlab-ce-0ebd50ce0015a6a1dcd273cada9d9be8c20a12bb.tar.gz |
Merge branch 'feature/more-storage-statistics' into 'master'
Add more storage statistics
See merge request !7754
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/projects_helper.rb | 19 | ||||
-rw-r--r-- | app/helpers/sorting_helper.rb | 11 | ||||
-rw-r--r-- | app/helpers/storage_helper.rb | 7 |
3 files changed, 17 insertions, 20 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 7445f3c113c..0f17f6d8b7e 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -246,11 +246,6 @@ module ProjectsHelper end end - def repository_size(project = @project) - size_in_bytes = project.repository_size * 1.megabyte - number_to_human_size(size_in_bytes, delimiter: ',', precision: 2) - end - def default_url_to_repo(project = @project) case default_clone_protocol when 'ssh' @@ -398,20 +393,6 @@ module ProjectsHelper [@project.path_with_namespace, sha, "readme"].join('-') end - def round_commit_count(project) - count = project.commit_count - - if count > 10000 - '10000+' - elsif count > 5000 - '5000+' - elsif count > 1000 - '1000+' - else - count - end - end - def current_ref @ref || @repository.try(:root_ref) end diff --git a/app/helpers/sorting_helper.rb b/app/helpers/sorting_helper.rb index f03c4627050..ff787fb4131 100644 --- a/app/helpers/sorting_helper.rb +++ b/app/helpers/sorting_helper.rb @@ -11,6 +11,7 @@ module SortingHelper sort_value_due_date_soon => sort_title_due_date_soon, sort_value_due_date_later => sort_title_due_date_later, sort_value_largest_repo => sort_title_largest_repo, + sort_value_largest_group => sort_title_largest_group, sort_value_recently_signin => sort_title_recently_signin, sort_value_oldest_signin => sort_title_oldest_signin, sort_value_downvotes => sort_title_downvotes, @@ -92,6 +93,10 @@ module SortingHelper 'Largest repository' end + def sort_title_largest_group + 'Largest group' + end + def sort_title_recently_signin 'Recent sign in' end @@ -193,7 +198,11 @@ module SortingHelper end def sort_value_largest_repo - 'repository_size_desc' + 'storage_size_desc' + end + + def sort_value_largest_group + 'storage_size_desc' end def sort_value_recently_signin diff --git a/app/helpers/storage_helper.rb b/app/helpers/storage_helper.rb new file mode 100644 index 00000000000..e19c67a37ca --- /dev/null +++ b/app/helpers/storage_helper.rb @@ -0,0 +1,7 @@ +module StorageHelper + def storage_counter(size_in_bytes) + precision = size_in_bytes < 1.megabyte ? 0 : 1 + + number_to_human_size(size_in_bytes, delimiter: ',', precision: precision, significant: false) + end +end |