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
Léo-Paul Géneau
gitlab-ce
Commits
df36f1f4
Commit
df36f1f4
authored
May 02, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add breadcrumb, build header and pipelines submenu to artifacts browser
parent
185fd98f
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
73 additions
and
42 deletions
+73
-42
app/controllers/projects/artifacts_controller.rb
app/controllers/projects/artifacts_controller.rb
+6
-2
app/helpers/tree_helper.rb
app/helpers/tree_helper.rb
+2
-2
app/views/layouts/nav/_project.html.haml
app/views/layouts/nav/_project.html.haml
+1
-1
app/views/projects/artifacts/_tree_directory.html.haml
app/views/projects/artifacts/_tree_directory.html.haml
+2
-2
app/views/projects/artifacts/browse.html.haml
app/views/projects/artifacts/browse.html.haml
+17
-7
app/views/projects/blob/_blob.html.haml
app/views/projects/blob/_blob.html.haml
+6
-10
app/views/projects/builds/_header.html.haml
app/views/projects/builds/_header.html.haml
+17
-11
app/views/projects/pipelines/_head.html.haml
app/views/projects/pipelines/_head.html.haml
+2
-2
app/views/projects/tree/_tree_header.html.haml
app/views/projects/tree/_tree_header.html.haml
+2
-5
changelogs/unreleased/dm-artifact-browser-header.yml
changelogs/unreleased/dm-artifact-browser-header.yml
+4
-0
features/project/builds/artifacts.feature
features/project/builds/artifacts.feature
+2
-0
features/steps/project/builds/artifacts.rb
features/steps/project/builds/artifacts.rb
+12
-0
No files found.
app/controllers/projects/artifacts_controller.rb
View file @
df36f1f4
...
@@ -16,7 +16,8 @@ class Projects::ArtifactsController < Projects::ApplicationController
...
@@ -16,7 +16,8 @@ class Projects::ArtifactsController < Projects::ApplicationController
end
end
def
browse
def
browse
directory
=
params
[
:path
]
?
"
#{
params
[
:path
]
}
/"
:
''
@path
=
params
[
:path
]
directory
=
@path
?
"
#{
@path
}
/"
:
''
@entry
=
build
.
artifacts_metadata_entry
(
directory
)
@entry
=
build
.
artifacts_metadata_entry
(
directory
)
render_404
unless
@entry
.
exists?
render_404
unless
@entry
.
exists?
...
@@ -60,7 +61,10 @@ class Projects::ArtifactsController < Projects::ApplicationController
...
@@ -60,7 +61,10 @@ class Projects::ArtifactsController < Projects::ApplicationController
end
end
def
build
def
build
@build
||=
build_from_id
||
build_from_ref
@build
||=
begin
build
=
build_from_id
||
build_from_ref
build
&
.
present
(
current_user:
current_user
)
end
end
end
def
build_from_id
def
build_from_id
...
...
app/helpers/tree_helper.rb
View file @
df36f1f4
...
@@ -76,7 +76,7 @@ module TreeHelper
...
@@ -76,7 +76,7 @@ module TreeHelper
"A new branch will be created in your fork and a new merge request will be started."
"A new branch will be created in your fork and a new merge request will be started."
end
end
def
tree_breadcrumbs
(
tree
,
max_links
=
2
)
def
path_breadcrumbs
(
max_links
=
6
)
if
@path
.
present?
if
@path
.
present?
part_path
=
""
part_path
=
""
parts
=
@path
.
split
(
'/'
)
parts
=
@path
.
split
(
'/'
)
...
@@ -88,7 +88,7 @@ module TreeHelper
...
@@ -88,7 +88,7 @@ module TreeHelper
part_path
=
part
if
part_path
.
empty?
part_path
=
part
if
part_path
.
empty?
next
if
parts
.
count
>
max_links
&&
!
parts
.
last
(
2
).
include?
(
part
)
next
if
parts
.
count
>
max_links
&&
!
parts
.
last
(
2
).
include?
(
part
)
yield
(
part
,
tree_join
(
@ref
,
part_path
)
)
yield
(
part
,
part_path
)
end
end
end
end
end
end
...
...
app/views/layouts/nav/_project.html.haml
View file @
df36f1f4
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
%span
.badge.count.merge_counter
=
number_with_delimiter
(
MergeRequestsFinder
.
new
(
current_user
,
project_id:
@project
.
id
).
execute
.
opened
.
count
)
%span
.badge.count.merge_counter
=
number_with_delimiter
(
MergeRequestsFinder
.
new
(
current_user
,
project_id:
@project
.
id
).
execute
.
opened
.
count
)
-
if
project_nav_tab?
:pipelines
-
if
project_nav_tab?
:pipelines
=
nav_link
(
controller:
[
:pipelines
,
:builds
,
:environments
])
do
=
nav_link
(
controller:
[
:pipelines
,
:builds
,
:environments
,
:artifacts
])
do
=
link_to
project_pipelines_path
(
@project
),
title:
'Pipelines'
,
class:
'shortcuts-pipelines'
do
=
link_to
project_pipelines_path
(
@project
),
title:
'Pipelines'
,
class:
'shortcuts-pipelines'
do
%span
%span
Pipelines
Pipelines
...
...
app/views/projects/artifacts/_tree_directory.html.haml
View file @
df36f1f4
...
@@ -3,6 +3,6 @@
...
@@ -3,6 +3,6 @@
%tr
.tree-item
{
'data-link'
=>
path_to_directory
}
%tr
.tree-item
{
'data-link'
=>
path_to_directory
}
%td
.tree-item-file-name
%td
.tree-item-file-name
=
tree_icon
(
'folder'
,
'755'
,
directory
.
name
)
=
tree_icon
(
'folder'
,
'755'
,
directory
.
name
)
%span
.str-truncated
=
link_to
path_to_directory
do
=
link_to
directory
.
name
,
path_to_directory
%span
.str-truncated
=
directory
.
name
%td
%td
app/views/projects/artifacts/browse.html.haml
View file @
df36f1f4
-
page_title
'Artifacts'
,
"
#{
@build
.
name
}
(#
#{
@build
.
id
}
)"
,
'Jobs'
-
page_title
@path
.
presence
,
'Artifacts'
,
"
#{
@build
.
name
}
(#
#{
@build
.
id
}
)"
,
'Jobs'
=
render
"projects/pipelines/head"
.top-block.row-content-block.clearfix
=
render
"projects/builds/header"
,
show_controls:
false
.pull-right
=
link_to
download_namespace_project_build_artifacts_path
(
@project
.
namespace
,
@project
,
@build
),
rel:
'nofollow'
,
download:
''
,
class:
'btn btn-default download'
do
=
icon
(
'download'
)
Download artifacts archive
.tree-holder
.tree-holder
.nav-block
.tree-controls
=
link_to
download_namespace_project_build_artifacts_path
(
@project
.
namespace
,
@project
,
@build
),
rel:
'nofollow'
,
download:
''
,
class:
'btn btn-default download'
do
=
icon
(
'download'
)
Download artifacts archive
%ul
.breadcrumb.repo-breadcrumb
%li
=
link_to
'Artifacts'
,
browse_namespace_project_build_artifacts_path
(
@project
.
namespace
,
@project
,
@build
)
-
path_breadcrumbs
do
|
title
,
path
|
%li
=
link_to
truncate
(
title
,
length:
40
),
browse_namespace_project_build_artifacts_path
(
@project
.
namespace
,
@project
,
@build
,
path
)
.tree-content-holder
.tree-content-holder
%table
.table.tree-table
%table
.table.tree-table
%thead
%thead
...
...
app/views/projects/blob/_blob.html.haml
View file @
df36f1f4
...
@@ -6,17 +6,14 @@
...
@@ -6,17 +6,14 @@
%li
%li
=
link_to
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
@ref
)
do
=
link_to
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
@ref
)
do
=
@project
.
path
=
@project
.
path
-
tree_breadcrumbs
(
@tree
,
6
)
do
|
title
,
path
|
-
path_breadcrumbs
do
|
title
,
path
|
-
title
=
truncate
(
title
,
length:
40
)
%li
%li
-
if
path
-
if
path
==
@path
-
if
path
.
end_with?
(
@path
)
=
link_to
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
tree_join
(
@ref
,
path
))
do
=
link_to
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
path
)
do
%strong
=
title
%strong
=
truncate
(
title
,
length:
40
)
-
else
=
link_to
truncate
(
title
,
length:
40
),
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
path
)
-
else
-
else
=
link_to
title
,
'#'
=
link_to
title
,
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
tree_join
(
@ref
,
path
))
%ul
.blob-commit-info.hidden-xs
%ul
.blob-commit-info.hidden-xs
-
blob_commit
=
@repository
.
last_commit_for_path
(
@commit
.
id
,
blob
.
path
)
-
blob_commit
=
@repository
.
last_commit_for_path
(
@commit
.
id
,
blob
.
path
)
...
@@ -25,5 +22,4 @@
...
@@ -25,5 +22,4 @@
#blob-content-holder
.blob-content-holder
#blob-content-holder
.blob-content-holder
%article
.file-holder
%article
.file-holder
=
render
"projects/blob/header"
,
blob:
blob
=
render
"projects/blob/header"
,
blob:
blob
=
render
'projects/blob/content'
,
blob:
blob
=
render
'projects/blob/content'
,
blob:
blob
app/views/projects/builds/_header.html.haml
View file @
df36f1f4
-
show_controls
=
local_assigns
.
fetch
(
:show_controls
,
true
)
-
pipeline
=
@build
.
pipeline
-
pipeline
=
@build
.
pipeline
.content-block.build-header.top-area
.content-block.build-header.top-area
.header-content
.header-content
=
render
'ci/status/badge'
,
status:
@build
.
detailed_status
(
current_user
),
link:
false
,
title:
@build
.
status_title
=
render
'ci/status/badge'
,
status:
@build
.
detailed_status
(
current_user
),
link:
false
,
title:
@build
.
status_title
Job
%strong
%strong
.js-build-id
##{@build.id}
Job
=
link_to
namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
),
class:
'js-build-id'
do
\##{@build.id}
in pipeline
in pipeline
=
link_to
pipeline_path
(
pipeline
)
do
=
link_to
pipeline_path
(
pipeline
)
do
%strong
##{pipeline.id}
%strong
##{pipeline.id}
...
@@ -15,13 +18,16 @@
...
@@ -15,13 +18,16 @@
=
link_to
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@build
.
ref
)
do
=
link_to
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@build
.
ref
)
do
%code
%code
=
@build
.
ref
=
@build
.
ref
-
if
@build
.
user
=
render
"user"
=
render
"projects/builds/user"
if
@build
.
user
=
time_ago_with_tooltip
(
@build
.
created_at
)
=
time_ago_with_tooltip
(
@build
.
created_at
)
.nav-controls
-
if
can?
(
current_user
,
:create_issue
,
@project
)
&&
@build
.
failed?
-
if
show_controls
=
link_to
"New issue"
,
new_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issue:
build_failed_issue_options
),
class:
'btn btn-new btn-inverted'
.nav-controls
-
if
can?
(
current_user
,
:update_build
,
@build
)
&&
@build
.
retryable?
-
if
can?
(
current_user
,
:create_issue
,
@project
)
&&
@build
.
failed?
=
link_to
"Retry job"
,
retry_namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
),
class:
'btn btn-inverted-secondary'
,
method: :post
=
link_to
"New issue"
,
new_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issue:
build_failed_issue_options
),
class:
'btn btn-new btn-inverted'
%button
.btn.btn-default.pull-right.visible-xs-block.visible-sm-block.build-gutter-toggle.js-sidebar-build-toggle
{
role:
"button"
,
type:
"button"
}
-
if
can?
(
current_user
,
:update_build
,
@build
)
&&
@build
.
retryable?
=
icon
(
'angle-double-left'
)
=
link_to
"Retry job"
,
retry_namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
),
class:
'btn btn-inverted-secondary'
,
method: :post
%button
.btn.btn-default.pull-right.visible-xs-block.visible-sm-block.build-gutter-toggle.js-sidebar-build-toggle
{
role:
"button"
,
type:
"button"
}
=
icon
(
'angle-double-left'
)
app/views/projects/pipelines/_head.html.haml
View file @
df36f1f4
...
@@ -4,13 +4,13 @@
...
@@ -4,13 +4,13 @@
.nav-links.sub-nav.scrolling-tabs
.nav-links.sub-nav.scrolling-tabs
%ul
{
class:
(
container_class
)
}
%ul
{
class:
(
container_class
)
}
-
if
project_nav_tab?
:pipelines
-
if
project_nav_tab?
:pipelines
=
nav_link
(
path:
'pipelines#index'
,
controller: :pipelines
)
do
=
nav_link
(
path:
[
'pipelines#index'
,
'pipelines#show'
]
)
do
=
link_to
project_pipelines_path
(
@project
),
title:
'Pipelines'
,
class:
'shortcuts-pipelines'
do
=
link_to
project_pipelines_path
(
@project
),
title:
'Pipelines'
,
class:
'shortcuts-pipelines'
do
%span
%span
Pipelines
Pipelines
-
if
project_nav_tab?
:builds
-
if
project_nav_tab?
:builds
=
nav_link
(
controller:
:builds
)
do
=
nav_link
(
controller:
[
:builds
,
:artifacts
]
)
do
=
link_to
project_builds_path
(
@project
),
title:
'Jobs'
,
class:
'shortcuts-builds'
do
=
link_to
project_builds_path
(
@project
),
title:
'Jobs'
,
class:
'shortcuts-builds'
do
%span
%span
Jobs
Jobs
...
...
app/views/projects/tree/_tree_header.html.haml
View file @
df36f1f4
...
@@ -9,12 +9,9 @@
...
@@ -9,12 +9,9 @@
%li
%li
=
link_to
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
@ref
)
do
=
link_to
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
@ref
)
do
=
@project
.
path
=
@project
.
path
-
tree_breadcrumbs
(
tree
,
6
)
do
|
title
,
path
|
-
path_breadcrumbs
do
|
title
,
path
|
%li
%li
-
if
path
=
link_to
truncate
(
title
,
length:
40
),
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
tree_join
(
@ref
,
path
))
=
link_to
truncate
(
title
,
length:
40
),
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
path
)
-
else
=
link_to
title
,
'#'
-
if
current_user
-
if
current_user
%li
%li
...
...
changelogs/unreleased/dm-artifact-browser-header.yml
0 → 100644
View file @
df36f1f4
---
title
:
Add breadcrumb, build header and pipelines submenu to artifacts browser
merge_request
:
author
:
features/project/builds/artifacts.feature
View file @
df36f1f4
...
@@ -17,6 +17,7 @@ Feature: Project Builds Artifacts
...
@@ -17,6 +17,7 @@ Feature: Project Builds Artifacts
When
I visit recent build details page
When
I visit recent build details page
And
I click artifacts browse button
And
I click artifacts browse button
Then
I should see content of artifacts archive
Then
I should see content of artifacts archive
And
I should see the build header
Scenario
:
I
browse subdirectory of build artifacts
Scenario
:
I
browse subdirectory of build artifacts
Given
recent build has artifacts available
Given
recent build has artifacts available
...
@@ -25,6 +26,7 @@ Feature: Project Builds Artifacts
...
@@ -25,6 +26,7 @@ Feature: Project Builds Artifacts
And
I click artifacts browse button
And
I click artifacts browse button
And
I click link to subdirectory within build artifacts
And
I click link to subdirectory within build artifacts
Then
I should see content of subdirectory within artifacts archive
Then
I should see content of subdirectory within artifacts archive
And
I should see the directory name in the breadcrumb
Scenario
:
I
browse directory with UTF-8 characters in name
Scenario
:
I
browse directory with UTF-8 characters in name
Given
recent build has artifacts available
Given
recent build has artifacts available
...
...
features/steps/project/builds/artifacts.rb
View file @
df36f1f4
...
@@ -22,6 +22,12 @@ class Spinach::Features::ProjectBuildsArtifacts < Spinach::FeatureSteps
...
@@ -22,6 +22,12 @@ class Spinach::Features::ProjectBuildsArtifacts < Spinach::FeatureSteps
end
end
end
end
step
'I should see the build header'
do
page
.
within
(
'.build-header'
)
do
expect
(
page
).
to
have_content
"Job #
#{
@build
.
id
}
in pipeline #
#{
@pipeline
.
id
}
for commit
#{
@pipeline
.
short_sha
}
"
end
end
step
'I click link to subdirectory within build artifacts'
do
step
'I click link to subdirectory within build artifacts'
do
page
.
within
(
'.tree-table'
)
{
click_link
'other_artifacts_0.1.2'
}
page
.
within
(
'.tree-table'
)
{
click_link
'other_artifacts_0.1.2'
}
end
end
...
@@ -34,6 +40,12 @@ class Spinach::Features::ProjectBuildsArtifacts < Spinach::FeatureSteps
...
@@ -34,6 +40,12 @@ class Spinach::Features::ProjectBuildsArtifacts < Spinach::FeatureSteps
end
end
end
end
step
'I should see the directory name in the breadcrumb'
do
page
.
within
(
'.repo-breadcrumb'
)
do
expect
(
page
).
to
have_content
'other_artifacts_0.1.2'
end
end
step
'recent build artifacts contain directory with UTF-8 characters'
do
step
'recent build artifacts contain directory with UTF-8 characters'
do
# metadata fixture contains relevant directory
# metadata fixture contains relevant directory
end
end
...
...
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