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
iv
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 @@
...
@@ -4,3 +4,4 @@
%span
.str-truncated
%span
.str-truncated
=
link_to
directory
.
name
,
browse_namespace_project_build_artifacts_path
(
@project
.
namespace
,
@project
,
@build
,
path:
directory
.
path
)
=
link_to
directory
.
name
,
browse_namespace_project_build_artifacts_path
(
@project
.
namespace
,
@project
,
@build
,
path:
directory
.
path
)
%td
%td
%td
app/views/projects/artifacts/_tree_file.html.haml
View file @
1b1793c2
%tr
{
class:
'tree-item'
}
%tr
{
class:
'tree-item'
}
%td
.tree-item-file-name
%td
.tree-item-file-name
=
tree_icon
(
'file'
,
'664'
,
file
.
base
name
)
=
tree_icon
(
'file'
,
'664'
,
file
.
name
)
%span
.str-truncated
%span
.str-truncated
=
file
.
basename
=
file
.
name
%td
=
number_to_human_size
(
file
.
metadata
[
:uncompressed_size
],
precision:
2
)
%td
%td
=
link_to
''
,
class:
'btn btn-xs btn-default'
do
=
link_to
''
,
class:
'btn btn-xs btn-default'
do
=
icon
(
'download'
)
=
icon
(
'download'
)
app/views/projects/artifacts/browse.html.haml
View file @
1b1793c2
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
%thead
%thead
%tr
%tr
%th
Name
%th
Name
%th
Size
%th
Download
%th
Download
=
render
partial:
'tree_directory'
,
collection:
@path
.
directories!
,
as: :directory
=
render
partial:
'tree_directory'
,
collection:
@path
.
directories!
,
as: :directory
=
render
partial:
'tree_file'
,
collection:
@path
.
files
,
as: :file
=
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
...
@@ -23,13 +23,12 @@ module Gitlab
each
do
|
line
|
each
do
|
line
|
next
unless
line
=~
%r{^
#{
Regexp
.
escape
(
@path
)
}
[^/
\s
]*/?
\s
}
next
unless
line
=~
%r{^
#{
Regexp
.
escape
(
@path
)
}
[^/
\s
]*/?
\s
}
path
,
meta
=
line
.
split
(
' '
)
path
,
meta
=
line
.
split
(
' '
)
paths
.
push
(
path
)
paths
.
push
(
path
)
metadata
.
push
(
meta
)
metadata
.
push
(
meta
)
end
end
[
paths
,
metadata
.
map
{
|
meta
|
JSON
.
parse
(
meta
)
}]
[
paths
,
metadata
.
map
{
|
meta
|
JSON
.
parse
(
meta
,
symbolize_names:
true
)
}]
end
end
def
to_string_path
def
to_string_path
...
...
lib/gitlab/string_path.rb
View file @
1b1793c2
...
@@ -19,10 +19,6 @@ module Gitlab
...
@@ -19,10 +19,6 @@ module Gitlab
@path
@path
end
end
def
exists?
@path
==
'./'
||
@universe
.
include?
(
@path
)
end
def
absolute?
def
absolute?
@path
.
start_with?
(
'/'
)
@path
.
start_with?
(
'/'
)
end
end
...
@@ -94,13 +90,17 @@ module Gitlab
...
@@ -94,13 +90,17 @@ module Gitlab
def
metadata
def
metadata
index
=
@universe
.
index
(
@path
)
index
=
@universe
.
index
(
@path
)
@metadata
[
index
]
@metadata
[
index
]
||
{}
end
end
def
nodes
def
nodes
@path
.
count
(
'/'
)
+
(
file?
?
1
:
0
)
@path
.
count
(
'/'
)
+
(
file?
?
1
:
0
)
end
end
def
exists?
@path
==
'./'
||
@universe
.
include?
(
@path
)
end
def
==
(
other
)
def
==
(
other
)
@path
==
other
.
path
&&
@universe
==
other
.
universe
@path
==
other
.
path
&&
@universe
==
other
.
universe
end
end
...
@@ -112,7 +112,7 @@ module Gitlab
...
@@ -112,7 +112,7 @@ module Gitlab
private
private
def
new
(
path
)
def
new
(
path
)
self
.
class
.
new
(
path
,
@universe
)
self
.
class
.
new
(
path
,
@universe
,
@metadata
)
end
end
def
select
def
select
...
...
spec/lib/gitlab/string_path_spec.rb
View file @
1b1793c2
...
@@ -162,7 +162,7 @@ describe Gitlab::StringPath do
...
@@ -162,7 +162,7 @@ describe Gitlab::StringPath do
end
end
let
(
:metadata
)
do
let
(
:metadata
)
do
[{
name:
'/path/'
},
{
name:
'/path/file1'
},
{
name:
'/path/file2'
}]
[{
name:
'/path/'
},
{
name:
'/path/file1'
},
{
name:
'/path/file2'
}]
end
end
subject
do
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