Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
bf6b1432
Commit
bf6b1432
authored
Mar 25, 2020
by
Roger Meier
Committed by
Nick Thomas
Mar 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show storage_size on project page
parent
76948de3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
0 deletions
+40
-0
app/presenters/project_presenter.rb
app/presenters/project_presenter.rb
+12
-0
changelogs/unreleased/feat-show-storage.yml
changelogs/unreleased/feat-show-storage.yml
+5
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/presenters/project_presenter_spec.rb
spec/presenters/project_presenter_spec.rb
+20
-0
No files found.
app/presenters/project_presenter.rb
View file @
bf6b1432
...
...
@@ -25,6 +25,7 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
branches_anchor_data
,
tags_anchor_data
,
files_anchor_data
,
storage_anchor_data
,
releases_anchor_data
].
compact
.
select
(
&
:is_link
)
end
...
...
@@ -154,6 +155,17 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
empty_repo?
?
nil
:
project_tree_path
(
project
))
end
def
storage_anchor_data
AnchorData
.
new
(
true
,
statistic_icon
(
'disk'
)
+
_
(
'%{strong_start}%{human_size}%{strong_end} Storage'
).
html_safe
%
{
human_size:
storage_counter
(
statistics
.
storage_size
),
strong_start:
'<strong class="project-stat-value">'
.
html_safe
,
strong_end:
'</strong>'
.
html_safe
},
empty_repo?
?
nil
:
project_tree_path
(
project
))
end
def
releases_anchor_data
return
unless
can?
(
current_user
,
:read_release
,
project
)
...
...
changelogs/unreleased/feat-show-storage.yml
0 → 100644
View file @
bf6b1432
---
title
:
Show storage size on project page
merge_request
:
27724
author
:
Roger Meier
type
:
added
locale/gitlab.pot
View file @
bf6b1432
...
...
@@ -459,6 +459,9 @@ msgstr[1] ""
msgid "%{strong_start}%{human_size}%{strong_end} Files"
msgstr ""
msgid "%{strong_start}%{human_size}%{strong_end} Storage"
msgstr ""
msgid "%{strong_start}%{release_count}%{strong_end} Release"
msgid_plural "%{strong_start}%{release_count}%{strong_end} Releases"
msgstr[0] ""
...
...
spec/presenters/project_presenter_spec.rb
View file @
bf6b1432
...
...
@@ -179,6 +179,16 @@ describe ProjectPresenter do
end
end
describe
'#storage_anchor_data'
do
it
'returns storage data'
do
expect
(
presenter
.
storage_anchor_data
).
to
have_attributes
(
is_link:
true
,
label:
a_string_including
(
'0 Bytes'
),
link:
nil
)
end
end
describe
'#releases_anchor_data'
do
it
'does not return release count'
do
expect
(
presenter
.
releases_anchor_data
).
to
be_nil
...
...
@@ -232,6 +242,16 @@ describe ProjectPresenter do
end
end
describe
'#storage_anchor_data'
do
it
'returns storage data'
do
expect
(
presenter
.
storage_anchor_data
).
to
have_attributes
(
is_link:
true
,
label:
a_string_including
(
'0 Bytes'
),
link:
presenter
.
project_tree_path
(
project
)
)
end
end
describe
'#releases_anchor_data'
do
it
'returns release count if user can read release'
do
project
.
add_maintainer
(
user
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment