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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
1b1793c2
Commit
1b1793c2
authored
Jan 04, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show file size in artifacts browser using metadata
parent
cd3b8bbd
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
12 deletions
+15
-12
app/views/projects/artifacts/_tree_directory.html.haml
app/views/projects/artifacts/_tree_directory.html.haml
+1
-0
app/views/projects/artifacts/_tree_file.html.haml
app/views/projects/artifacts/_tree_file.html.haml
+4
-2
app/views/projects/artifacts/browse.html.haml
app/views/projects/artifacts/browse.html.haml
+1
-0
lib/gitlab/ci/build/artifacts/metadata.rb
lib/gitlab/ci/build/artifacts/metadata.rb
+2
-3
lib/gitlab/string_path.rb
lib/gitlab/string_path.rb
+6
-6
spec/lib/gitlab/string_path_spec.rb
spec/lib/gitlab/string_path_spec.rb
+1
-1
No files found.
app/views/projects/artifacts/_tree_directory.html.haml
View file @
1b1793c2
...
...
@@ -4,3 +4,4 @@
%span
.str-truncated
=
link_to
directory
.
name
,
browse_namespace_project_build_artifacts_path
(
@project
.
namespace
,
@project
,
@build
,
path:
directory
.
path
)
%td
%td
app/views/projects/artifacts/_tree_file.html.haml
View file @
1b1793c2
%tr
{
class:
'tree-item'
}
%td
.tree-item-file-name
=
tree_icon
(
'file'
,
'664'
,
file
.
base
name
)
=
tree_icon
(
'file'
,
'664'
,
file
.
name
)
%span
.str-truncated
=
file
.
basename
=
file
.
name
%td
=
number_to_human_size
(
file
.
metadata
[
:uncompressed_size
],
precision:
2
)
%td
=
link_to
''
,
class:
'btn btn-xs btn-default'
do
=
icon
(
'download'
)
app/views/projects/artifacts/browse.html.haml
View file @
1b1793c2
...
...
@@ -15,6 +15,7 @@
%thead
%tr
%th
Name
%th
Size
%th
Download
=
render
partial:
'tree_directory'
,
collection:
@path
.
directories!
,
as: :directory
=
render
partial:
'tree_file'
,
collection:
@path
.
files
,
as: :file
...
...
lib/gitlab/ci/build/artifacts/metadata.rb
View file @
1b1793c2
...
...
@@ -23,13 +23,12 @@ module Gitlab
each
do
|
line
|
next
unless
line
=~
%r{^
#{
Regexp
.
escape
(
@path
)
}
[^/
\s
]*/?
\s
}
path
,
meta
=
line
.
split
(
' '
)
paths
.
push
(
path
)
metadata
.
push
(
meta
)
end
[
paths
,
metadata
.
map
{
|
meta
|
JSON
.
parse
(
meta
)
}]
[
paths
,
metadata
.
map
{
|
meta
|
JSON
.
parse
(
meta
,
symbolize_names:
true
)
}]
end
def
to_string_path
...
...
lib/gitlab/string_path.rb
View file @
1b1793c2
...
...
@@ -19,10 +19,6 @@ module Gitlab
@path
end
def
exists?
@path
==
'./'
||
@universe
.
include?
(
@path
)
end
def
absolute?
@path
.
start_with?
(
'/'
)
end
...
...
@@ -94,13 +90,17 @@ module Gitlab
def
metadata
index
=
@universe
.
index
(
@path
)
@metadata
[
index
]
@metadata
[
index
]
||
{}
end
def
nodes
@path
.
count
(
'/'
)
+
(
file?
?
1
:
0
)
end
def
exists?
@path
==
'./'
||
@universe
.
include?
(
@path
)
end
def
==
(
other
)
@path
==
other
.
path
&&
@universe
==
other
.
universe
end
...
...
@@ -112,7 +112,7 @@ module Gitlab
private
def
new
(
path
)
self
.
class
.
new
(
path
,
@universe
)
self
.
class
.
new
(
path
,
@universe
,
@metadata
)
end
def
select
...
...
spec/lib/gitlab/string_path_spec.rb
View file @
1b1793c2
...
...
@@ -162,7 +162,7 @@ describe Gitlab::StringPath do
end
let
(
:metadata
)
do
[{
name:
'/path/'
},
{
name:
'/path/file1'
},
{
name:
'/path/file2'
}]
[{
name:
'/path/'
},
{
name:
'/path/file1'
},
{
name:
'/path/file2'
}]
end
subject
do
...
...
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