Add artifacts browser

This implementation makes it possible to browse artifacts, it
depends on artifacts metadata.
This commit is contained in:
Grzegorz Bizon 2015-12-21 12:53:31 +01:00
parent 37b2c5dd55
commit 5a1faf61f6
4 changed files with 15 additions and 5 deletions

View file

@ -15,10 +15,8 @@ class Projects::ArtifactsController < Projects::ApplicationController
end
def browse
path = params[:path].to_s
@paths = artifacts_metadata.map do |_artifact_file|
Gitlab::StringPath.new(path, artifacts_metadata)
end
current_path = params[:path] ? "./#{params[:path]}/" : './'
@path = Gitlab::StringPath.new(current_path, artifacts_metadata)
end
private

View file

@ -0,0 +1,5 @@
%tr{ class: 'tree-item' }
%td.tree-item-file-name
= tree_icon('folder', '755', directory.basename)
%span.str-truncated
= link_to directory.basename, browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build, path: directory.path)

View file

@ -0,0 +1,5 @@
%tr{ class: 'tree-item' }
%td.tree-item-file-name
= tree_icon('file', '664', file.basename)
%span.str-truncated
= file.basename

View file

@ -1,4 +1,6 @@
- page_title "#{@build.name} (##{@build.id})", 'Build artifacts'
- header_title project_title(@project, "Build artifacts", namespace_project_build_path(@project.namespace, @project, @build))
= @metadata.inspect
%table.table.table-hover
= render partial: 'tree_directory', collection: @path.directories, as: :directory
= render partial: 'tree_file', collection: @path.files, as: :file