summaryrefslogtreecommitdiff
path: root/app/presenters
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2019-08-28 14:51:26 +0700
committerShinya Maeda <shinya@gitlab.com>2019-09-03 13:30:53 +0700
commit8c21610c79d2737c9cd728964f499d793e6a1279 (patch)
tree82af1d1bed4f1a522658b3dfb7c0bc8a766e88cd /app/presenters
parent991143eb1f1bb5cda1f709ad44fdc021aa12b75d (diff)
downloadgitlab-ce-8c21610c79d2737c9cd728964f499d793e6a1279.tar.gz
Add pipeline.type key to PipelineEntityadd-pipeline-type-key-in-pipeline-entity
This commit adds pipeline.type key to PipelineEntity. This key will be used in MR widget in the next iteration.
Diffstat (limited to 'app/presenters')
-rw-r--r--app/presenters/ci/pipeline_presenter.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/presenters/ci/pipeline_presenter.rb b/app/presenters/ci/pipeline_presenter.rb
index 358473d0a74..a96f97988b2 100644
--- a/app/presenters/ci/pipeline_presenter.rb
+++ b/app/presenters/ci/pipeline_presenter.rb
@@ -34,6 +34,18 @@ module Ci
end
end
+ NAMES = {
+ merge_train: s_('Pipeline|Merge train pipeline'),
+ merged_result: s_('Pipeline|Merged result pipeline'),
+ detached: s_('Pipeline|Detached merge request pipeline')
+ }.freeze
+
+ def name
+ # Currently, `merge_request_event_type` is the only source to name pipelines
+ # but this could be extended with the other types in the future.
+ NAMES.fetch(pipeline.merge_request_event_type, s_('Pipeline|Pipeline'))
+ end
+
def ref_text
if pipeline.detached_merge_request_pipeline?
_("for %{link_to_merge_request} with %{link_to_merge_request_source_branch}").html_safe % { link_to_merge_request: link_to_merge_request, link_to_merge_request_source_branch: link_to_merge_request_source_branch }