diff options
Diffstat (limited to 'app/helpers/ci_status_helper.rb')
-rw-r--r-- | app/helpers/ci_status_helper.rb | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb index b7f48630bd4..ac117486f0c 100644 --- a/app/helpers/ci_status_helper.rb +++ b/app/helpers/ci_status_helper.rb @@ -4,9 +4,15 @@ module CiStatusHelper builds_namespace_project_commit_path(project.namespace, project, pipeline.sha) end - def ci_status_with_icon(status, target = nil) - content = ci_icon_for_status(status) + ' '.html_safe + ci_label_for_status(status) - klass = "ci-status ci-#{status}" + def ci_status_with_icon(status, target = nil, allowFailure) + content = ci_icon_for_status(status, allowFailure) + ' '.html_safe + ci_label_for_status(status, allowFailure) + + if allowFailure + klass = 'ci-status ci-warning' + else + klass = 'ci-status ci-#{status}' + end + if target link_to content, target, class: klass else @@ -14,12 +20,18 @@ module CiStatusHelper end end - def ci_label_for_status(status) + def ci_label_for_status(status, allowFailure = false) case status when 'success' 'passed' when 'success_with_warnings' 'passed with warnings' + when 'failed' + if allowFailure + 'warning' + else + status + end else status end @@ -30,7 +42,7 @@ module CiStatusHelper status.humanize end - def ci_icon_for_status(status) + def ci_icon_for_status(status, allowFailure = false) icon_name = case status when 'success' @@ -38,7 +50,7 @@ module CiStatusHelper when 'success_with_warnings' 'icon_status_warning' when 'failed' - 'icon_status_failed' + allowFailure ? 'icon_status_warning' : 'icon_status_failed' when 'pending' 'icon_status_pending' when 'running' |