Commit 9604ce52 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'dm-artifact-browser-header' into 'master'

Add breadcrumb, build header and pipelines submenu to artifacts browser

See merge request !11050
parents 21e4f053 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
......
......@@ -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
......
......@@ -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
......
......@@ -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
- 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
= 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
.tree-holder
%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
......
......@@ -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)
- if path == @path
= link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@ref, path)) do
%strong= title
- else
= link_to truncate(title, length: 40), namespace_project_tree_path(@project.namespace, @project, path)
- 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
- 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
%strong
Job
%strong.js-build-id ##{@build.id}
= 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,9 +18,12 @@
= 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)
- 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'
......
......@@ -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
......
......@@ -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
......
---
title: Add breadcrumb, build header and pipelines submenu to artifacts browser
merge_request:
author:
......@@ -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
......
......@@ -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
......
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