diff options
Diffstat (limited to 'app/helpers/ci_status_helper.rb')
-rw-r--r-- | app/helpers/ci_status_helper.rb | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb index dbd1e26fa79..d8bee21c82e 100644 --- a/app/helpers/ci_status_helper.rb +++ b/app/helpers/ci_status_helper.rb @@ -1,29 +1,28 @@ module CiStatusHelper def ci_status_path(ci_commit) - project = ci_commit.gl_project - ci_namespace_project_commit_path(project.namespace, project, ci_commit.sha) + project = ci_commit.project + builds_namespace_project_commit_path(project.namespace, project, ci_commit.sha) end def ci_status_icon(ci_commit) ci_icon_for_status(ci_commit.status) end - def ci_status_color(ci_commit) - case ci_commit.status - when 'success' - 'green' - when 'failed' - 'red' - when 'running', 'pending' - 'yellow' - else - 'gray' - end + def ci_status_label(ci_commit) + ci_label_for_status(ci_commit.status) end def ci_status_with_icon(status) content_tag :span, class: "ci-status ci-#{status}" do - ci_icon_for_status(status) + ' '.html_safe + status + ci_icon_for_status(status) + ' '.html_safe + ci_label_for_status(status) + end + end + + def ci_label_for_status(status) + if status == 'success' + 'passed' + else + status end end @@ -40,6 +39,19 @@ module CiStatusHelper 'circle' end - icon(icon_name) + icon(icon_name + ' fw') + end + + def render_ci_status(ci_commit) + link_to ci_status_icon(ci_commit), + ci_status_path(ci_commit), + class: "ci-status-link ci-status-icon-#{ci_commit.status.dasherize}", + title: "Build #{ci_status_label(ci_commit)}", + data: { toggle: 'tooltip', placement: 'left' } + end + + def no_runners_for_project?(project) + project.runners.blank? && + Ci::Runner.shared.blank? end end |