Commit fab1c4a8 authored by Kamil Trzcinski's avatar Kamil Trzcinski Committed by Phil Hughes

Show the artifacts expiration prompt in Build Artifacts widget

parent 950d78f6
...@@ -319,7 +319,7 @@ module Ci ...@@ -319,7 +319,7 @@ module Ci
end end
def artifacts? def artifacts?
artifacts_file.exists? !artifacts_expired? && artifacts_file.exists?
end end
def artifacts_metadata? def artifacts_metadata?
...@@ -352,7 +352,7 @@ module Ci ...@@ -352,7 +352,7 @@ module Ci
end end
def artifacts_expired? def artifacts_expired?
!artifacts? && artifacts_expire_at && artifacts_expire_at < Time.now artifacts_expire_at && artifacts_expire_at < Time.now
end end
def artifacts_expire_in def artifacts_expire_in
......
...@@ -11,17 +11,28 @@ ...@@ -11,17 +11,28 @@
%p.build-detail-row %p.build-detail-row
#{@build.coverage}% #{@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) } .block{ class: ("block-first" if !@build.coverage) }
.title .title
Build artifacts Build artifacts
.btn-group.btn-group-justified{ role: :group } - if @build.artifacts_expired?
= link_to download_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do .artifacts-expired.alert.alert-warning
Download 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
= link_to download_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do
Download
- if @build.artifacts_metadata? - if @build.artifacts_metadata?
= link_to browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do = link_to browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do
Browse Browse
.block{ class: ("block-first" if !@build.coverage && !(can?(current_user, :read_build, @project) && @build.artifacts?)) } .block{ class: ("block-first" if !@build.coverage && !(can?(current_user, :read_build, @project) && @build.artifacts?)) }
.title .title
...@@ -44,16 +55,6 @@ ...@@ -44,16 +55,6 @@
%p.build-detail-row %p.build-detail-row
%span.build-light-text Erased: %span.build-light-text Erased:
#{time_ago_with_tooltip(@build.erased_at)} #{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 %p.build-detail-row
%span.build-light-text Runner: %span.build-light-text Runner:
- if @build.runner && current_user && current_user.admin - if @build.runner && current_user && current_user.admin
......
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