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
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
end
def
browse
directory
=
params
[
:path
]
?
"
#{
params
[
:path
]
}
/"
:
''
@path
=
params
[
:path
]
directory
=
@path
?
"
#{
@path
}
/"
:
''
@entry
=
build
.
artifacts_metadata_entry
(
directory
)
render_404
unless
@entry
.
exists?
...
...
@@ -60,7 +61,10 @@ class Projects::ArtifactsController < Projects::ApplicationController
end
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
def
build_from_id
...
...
app/helpers/tree_helper.rb
View file @
df36f1f4
...
...
@@ -76,7 +76,7 @@ module TreeHelper
"A new branch will be created in your fork and a new merge request will be started."
end
def
tree_breadcrumbs
(
tree
,
max_links
=
2
)
def
path_breadcrumbs
(
max_links
=
6
)
if
@path
.
present?
part_path
=
""
parts
=
@path
.
split
(
'/'
)
...
...
@@ -88,7 +88,7 @@ module TreeHelper
part_path
=
part
if
part_path
.
empty?
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
...
...
app/views/layouts/nav/_project.html.haml
View file @
df36f1f4
...
...
@@ -38,7 +38,7 @@
%span
.badge.count.merge_counter
=
number_with_delimiter
(
MergeRequestsFinder
.
new
(
current_user
,
project_id:
@project
.
id
).
execute
.
opened
.
count
)
-
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
%span
Pipelines
...
...
app/views/projects/artifacts/_tree_directory.html.haml
View file @
df36f1f4
...
...
@@ -3,6 +3,6 @@
%tr
.tree-item
{
'data-link'
=>
path_to_directory
}
%td
.tree-item-file-name
=
tree_icon
(
'folder'
,
'755'
,
directory
.
name
)
%span
.str-truncated
=
link_to
directory
.
name
,
path_to_directory
=
link_to
path_to_directory
do
%span
.str-truncated
=
directory
.
name
%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
.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
=
render
"projects/builds/header"
,
show_controls:
false
.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
%table
.table.tree-table
%thead
...
...
app/views/projects/blob/_blob.html.haml
View file @
df36f1f4
...
...
@@ -6,17 +6,14 @@
%li
=
link_to
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
@ref
)
do
=
@project
.
path
-
tree_breadcrumbs
(
@tree
,
6
)
do
|
title
,
path
|
-
path_breadcrumbs
do
|
title
,
path
|
-
title
=
truncate
(
title
,
length:
40
)
%li
-
if
path
-
if
path
.
end_with?
(
@path
)
=
link_to
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
path
)
do
%strong
=
truncate
(
title
,
length:
40
)
-
else
=
link_to
truncate
(
title
,
length:
40
),
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
path
)
-
if
path
==
@path
=
link_to
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
tree_join
(
@ref
,
path
))
do
%strong
=
title
-
else
=
link_to
title
,
'#'
=
link_to
title
,
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
tree_join
(
@ref
,
path
))
%ul
.blob-commit-info.hidden-xs
-
blob_commit
=
@repository
.
last_commit_for_path
(
@commit
.
id
,
blob
.
path
)
...
...
@@ -25,5 +22,4 @@
#blob-content-holder
.blob-content-holder
%article
.file-holder
=
render
"projects/blob/header"
,
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
.content-block.build-header.top-area
.header-content
=
render
'ci/status/badge'
,
status:
@build
.
detailed_status
(
current_user
),
link:
false
,
title:
@build
.
status_title
Job
%strong
.js-build-id
##{@build.id}
%strong
Job
=
link_to
namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
),
class:
'js-build-id'
do
\##{@build.id}
in pipeline
=
link_to
pipeline_path
(
pipeline
)
do
%strong
##{pipeline.id}
...
...
@@ -15,13 +18,16 @@
=
link_to
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@build
.
ref
)
do
%code
=
@build
.
ref
-
if
@build
.
user
=
render
"user"
=
render
"projects/builds/user"
if
@build
.
user
=
time_ago_with_tooltip
(
@build
.
created_at
)
.nav-controls
-
if
can?
(
current_user
,
:create_issue
,
@project
)
&&
@build
.
failed?
=
link_to
"New issue"
,
new_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issue:
build_failed_issue_options
),
class:
'btn btn-new btn-inverted'
-
if
can?
(
current_user
,
:update_build
,
@build
)
&&
@build
.
retryable?
=
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'
)
-
if
show_controls
.nav-controls
-
if
can?
(
current_user
,
:create_issue
,
@project
)
&&
@build
.
failed?
=
link_to
"New issue"
,
new_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issue:
build_failed_issue_options
),
class:
'btn btn-new btn-inverted'
-
if
can?
(
current_user
,
:update_build
,
@build
)
&&
@build
.
retryable?
=
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 @@
.nav-links.sub-nav.scrolling-tabs
%ul
{
class:
(
container_class
)
}
-
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
%span
Pipelines
-
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
%span
Jobs
...
...
app/views/projects/tree/_tree_header.html.haml
View file @
df36f1f4
...
...
@@ -9,12 +9,9 @@
%li
=
link_to
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
@ref
)
do
=
@project
.
path
-
tree_breadcrumbs
(
tree
,
6
)
do
|
title
,
path
|
-
path_breadcrumbs
do
|
title
,
path
|
%li
-
if
path
=
link_to
truncate
(
title
,
length:
40
),
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
path
)
-
else
=
link_to
title
,
'#'
=
link_to
truncate
(
title
,
length:
40
),
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
tree_join
(
@ref
,
path
))
-
if
current_user
%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
When
I visit recent build details page
And
I click artifacts browse button
Then
I should see content of artifacts archive
And
I should see the build header
Scenario
:
I
browse subdirectory of build artifacts
Given
recent build has artifacts available
...
...
@@ -25,6 +26,7 @@ Feature: Project Builds Artifacts
And
I click artifacts browse button
And
I click link to subdirectory within build artifacts
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
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
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
page
.
within
(
'.tree-table'
)
{
click_link
'other_artifacts_0.1.2'
}
end
...
...
@@ -34,6 +40,12 @@ class Spinach::Features::ProjectBuildsArtifacts < Spinach::FeatureSteps
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
# metadata fixture contains relevant directory
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