diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ci/build.rb | 2 | ||||
-rw-r--r-- | app/models/ci/build/erasable.rb (renamed from app/models/ci/build/eraseable.rb) | 12 | ||||
-rw-r--r-- | app/views/projects/builds/show.html.haml | 17 |
3 files changed, 13 insertions, 18 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 4e22ee3962b..9172a46b35f 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -38,7 +38,7 @@ module Ci class Build < CommitStatus include Gitlab::Application.routes.url_helpers - include Build::Eraseable + include Build::Erasable LAZY_ATTRIBUTES = ['trace'] diff --git a/app/models/ci/build/eraseable.rb b/app/models/ci/build/erasable.rb index 9d3d0627b45..95e1bef58e4 100644 --- a/app/models/ci/build/eraseable.rb +++ b/app/models/ci/build/erasable.rb @@ -1,6 +1,6 @@ module Ci class Build - module Eraseable + module Erasable extend ActiveSupport::Concern included do @@ -8,7 +8,7 @@ module Ci end def erase!(opts = {}) - raise StandardError, 'Build not eraseable!' unless eraseable? + raise StandardError, 'Build not erasable!' unless erasable? remove_artifacts_file! remove_artifacts_metadata! @@ -16,16 +16,10 @@ module Ci update_erased!(opts[:erased_by]) end - def eraseable? + def erasable? complete? && (artifacts? || has_trace?) end - def erase_url - if eraseable? - erase_namespace_project_build_path(project.namespace, project, self) - end - end - def erased? !self.erased_at.nil? end diff --git a/app/views/projects/builds/show.html.haml b/app/views/projects/builds/show.html.haml index 5809fa2d11b..0c1dc4bdeee 100644 --- a/app/views/projects/builds/show.html.haml +++ b/app/views/projects/builds/show.html.haml @@ -76,15 +76,15 @@ = link_to '#down-build-trace', class: 'btn' do %i.fa.fa-angle-down - - unless @build.erased? + - if @build.erased? + .erased.alert.alert-warning + - erased_by = "by #{@build.erased_by.username}" if @build.erased_by + Build has been erased #{erased_by} #{time_ago_with_tooltip(@build.erased_at)} + - else %pre.trace#build-trace %code.bash = preserve do = raw @build.trace_html - - else - .erased.alert.alert-warning - - erased_by = "by #{@build.erased_by.username}" if @build.erased_by - Build has been erased #{erased_by} #{time_ago_with_tooltip(@build.erased_at)} %div#down-build-trace @@ -119,9 +119,10 @@ - elsif @build.retry_url = link_to "Retry", @build.retry_url, class: 'btn btn-sm btn-primary', method: :post - - if @build.eraseable? - = link_to @build.erase_url, class: 'btn btn-sm btn-warning', method: :delete, - data: { confirm: 'Are you sure you want to erase this build?' } do + - if @build.erasable? + = link_to erase_namespace_project_build_path(@project.namespace, @project, @build), + class: 'btn btn-sm btn-warning', method: :delete, + data: { confirm: 'Are you sure you want to erase this build?' } do = icon('eraser') Erase |