debian-mirror-gitlab/lib/gitlab/ci/badge/pipeline/template.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

44 lines
970 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
2021-03-11 19:13:27 +05:30
module Gitlab::Ci
2016-09-13 17:45:13 +05:30
module Badge
2017-09-10 17:25:29 +05:30
module Pipeline
2016-09-13 17:45:13 +05:30
##
2017-09-10 17:25:29 +05:30
# Class that represents a pipeline badge template.
2016-09-13 17:45:13 +05:30
#
# Template object will be passed to badge.svg.erb template.
#
class Template < Badge::Template
2017-09-10 17:25:29 +05:30
STATUS_RENAME = { 'success' => 'passed' }.freeze
2016-09-13 17:45:13 +05:30
STATUS_COLOR = {
success: '#4c1',
failed: '#e05d44',
running: '#dfb317',
pending: '#dfb317',
2019-12-21 20:55:43 +05:30
preparing: '#a7a7a7',
2016-09-13 17:45:13 +05:30
canceled: '#9f9f9f',
skipped: '#9f9f9f',
unknown: '#9f9f9f'
2017-08-17 22:00:37 +05:30
}.freeze
2016-09-13 17:45:13 +05:30
def initialize(badge)
@status = badge.status
2022-07-16 23:28:13 +05:30
super
2016-09-13 17:45:13 +05:30
end
def value_text
2017-09-10 17:25:29 +05:30
STATUS_RENAME[@status.to_s] || @status.to_s
2016-09-13 17:45:13 +05:30
end
def value_width
54
end
def value_color
STATUS_COLOR[@status.to_sym] || STATUS_COLOR[:unknown]
end
end
end
end
end