Commit df36f1f4 authored by Douwe Maan's avatar Douwe Maan

Add breadcrumb, build header and pipelines submenu to artifacts browser

parent 185fd98f
...@@ -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
......
...@@ -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
......
...@@ -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
......
...@@ -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
- 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
......
...@@ -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
- 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')
...@@ -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
......
...@@ -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
......
---
title: Add breadcrumb, build header and pipelines submenu to artifacts browser
merge_request:
author:
...@@ -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
......
...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment