summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-06-10 14:40:25 +0200
committerPhil Hughes <me@iamphill.com>2016-06-13 11:05:26 +0100
commitfab1c4a81b7eef247abe6bdd3775cf0ce42badc1 (patch)
tree983588103da2b534e6049d65114dcad5c85105b4
parent950d78f6d9ae43bf5c807d95326cf18afcfceedb (diff)
downloadgitlab-ce-fab1c4a81b7eef247abe6bdd3775cf0ce42badc1.tar.gz
Show the artifacts expiration prompt in Build Artifacts widget
-rw-r--r--app/models/ci/build.rb4
-rw-r--r--app/views/projects/builds/_sidebar.html.haml35
2 files changed, 20 insertions, 19 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 9f66ae63a55..80702b274dd 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -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
diff --git a/app/views/projects/builds/_sidebar.html.haml b/app/views/projects/builds/_sidebar.html.haml
index e1fdd7019ff..0741426b5af 100644
--- a/app/views/projects/builds/_sidebar.html.haml
+++ b/app/views/projects/builds/_sidebar.html.haml
@@ -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
+
+ = 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
+ - 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