diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-30 15:08:09 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-30 15:08:09 +0000 |
commit | 538fff823de57d1ba5317961aa43091de9dc007f (patch) | |
tree | c741665b338cc0d51ce5f73f5671e5eee8e69349 /app/helpers/ci_status_helper.rb | |
parent | 3692e9f8a23386c627942ca2a9edd8c00af7e904 (diff) | |
download | gitlab-ce-538fff823de57d1ba5317961aa43091de9dc007f.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers/ci_status_helper.rb')
-rw-r--r-- | app/helpers/ci_status_helper.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb index 144df676304..1f34a483071 100644 --- a/app/helpers/ci_status_helper.rb +++ b/app/helpers/ci_status_helper.rb @@ -64,7 +64,7 @@ module CiStatusHelper def ci_icon_for_status(status, size: 16) if detailed_status?(status) - return sprite_icon(status.icon) + return sprite_icon(status.icon, size: size) end icon_name = @@ -96,23 +96,29 @@ module CiStatusHelper sprite_icon(icon_name, size: size) end + def ci_icon_class_for_status(status) + group = detailed_status?(status) ? status.group : status.dasherize + + "ci-status-icon-#{group}" + end + def pipeline_status_cache_key(pipeline_status) "pipeline-status/#{pipeline_status.sha}-#{pipeline_status.status}" end - def render_commit_status(commit, ref: nil, tooltip_placement: 'left') + def render_commit_status(commit, status, ref: nil, tooltip_placement: 'left') project = commit.project path = pipelines_project_commit_path(project, commit, ref: ref) render_status_with_link( - commit.status(ref), + status, path, tooltip_placement: tooltip_placement, icon_size: 24) end def render_status_with_link(status, path = nil, type: _('pipeline'), tooltip_placement: 'left', cssclass: '', container: 'body', icon_size: 16) - klass = "ci-status-link ci-status-icon-#{status.dasherize} d-inline-flex #{cssclass}" + klass = "ci-status-link #{ci_icon_class_for_status(status)} d-inline-flex #{cssclass}" title = "#{type.titleize}: #{ci_label_for_status(status)}" data = { toggle: 'tooltip', placement: tooltip_placement, container: container } @@ -127,6 +133,7 @@ module CiStatusHelper def detailed_status?(status) status.respond_to?(:text) && + status.respond_to?(:group) && status.respond_to?(:label) && status.respond_to?(:icon) end |