Show the artifacts expiration prompt in Build Artifacts widget

This commit is contained in:
Kamil Trzcinski 2016-06-10 14:40:25 +02:00 committed by Phil Hughes
parent 950d78f6d9
commit fab1c4a81b
2 changed files with 20 additions and 19 deletions

View file

@ -319,7 +319,7 @@ module Ci
end
def artifacts?
artifacts_file.exists?
!artifacts_expired? && artifacts_file.exists?
end
def artifacts_metadata?
@ -352,7 +352,7 @@ module Ci
end
def artifacts_expired?
!artifacts? && artifacts_expire_at && artifacts_expire_at < Time.now
artifacts_expire_at && artifacts_expire_at < Time.now
end
def artifacts_expire_in

View file

@ -11,17 +11,28 @@
%p.build-detail-row
#{@build.coverage}%
- if can?(current_user, :read_build, @project) && @build.artifacts?
- if can?(current_user, :read_build, @project) && (@build.artifacts? || @build.artifacts_expired?)
.block{ class: ("block-first" if !@build.coverage) }
.title
Build artifacts
.btn-group.btn-group-justified{ role: :group }
= link_to download_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do
Download
- if @build.artifacts_expired?
.artifacts-expired.alert.alert-warning
The artifacts were removed #{time_ago_with_tooltip(@build.artifacts_expire_at)}
- elsif @build.artifacts_expire_at
.artifacts-expired.alert.alert-warning
The artifacts will be removed in #{time_interval_in_words(@build.artifacts_expire_in)}
- if @build.artifacts?
.btn-group.btn-group-justified{ role: :group }
- if @build.artifacts_expire_at
= link_to keep_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do
Keep
- if @build.artifacts_metadata?
= link_to browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do
Browse
= link_to download_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do
Download
- if @build.artifacts_metadata?
= link_to browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do
Browse
.block{ class: ("block-first" if !@build.coverage && !(can?(current_user, :read_build, @project) && @build.artifacts?)) }
.title
@ -44,16 +55,6 @@
%p.build-detail-row
%span.build-light-text Erased:
#{time_ago_with_tooltip(@build.erased_at)}
- else
- if @build.artifacts_expired?
.artifacts-expired.alert.alert-warning
The artifacts were removed #{time_ago_with_tooltip(@build.artifacts_expire_at)}
- elsif @build.artifacts_expire_at
.artifacts-expired.alert.alert-warning
The artifacts will be removed in #{duration_in_words(@build.artifacts_expire_at, Time.now)}
.pull-right
= link_to keep_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-xs btn-primary', method: :post do
Keep
%p.build-detail-row
%span.build-light-text Runner:
- if @build.runner && current_user && current_user.admin