diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-05 16:20:45 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-05 16:20:45 +0000 |
commit | d298fad0c0564454271cba11e6f20c19681534ac (patch) | |
tree | 0a19d07d8b3bdd2574617305c300e404f2ace581 /lib/gitlab/badge/pipeline/template.rb | |
parent | c9f9eec79cab801a50db698f682aacffbedf07f7 (diff) | |
download | gitlab-ce-d298fad0c0564454271cba11e6f20c19681534ac.tar.gz |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc41
Diffstat (limited to 'lib/gitlab/badge/pipeline/template.rb')
-rw-r--r-- | lib/gitlab/badge/pipeline/template.rb | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/lib/gitlab/badge/pipeline/template.rb b/lib/gitlab/badge/pipeline/template.rb deleted file mode 100644 index af8e318395b..00000000000 --- a/lib/gitlab/badge/pipeline/template.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module Badge - module Pipeline - ## - # Class that represents a pipeline badge template. - # - # Template object will be passed to badge.svg.erb template. - # - class Template < Badge::Template - STATUS_RENAME = { 'success' => 'passed' }.freeze - STATUS_COLOR = { - success: '#4c1', - failed: '#e05d44', - running: '#dfb317', - pending: '#dfb317', - preparing: '#a7a7a7', - canceled: '#9f9f9f', - skipped: '#9f9f9f', - unknown: '#9f9f9f' - }.freeze - - def initialize(badge) - @entity = badge.entity - @status = badge.status - @key_text = badge.customization.dig(:key_text) - @key_width = badge.customization.dig(:key_width) - end - - def key_text - if @key_text && @key_text.size <= MAX_KEY_TEXT_SIZE - @key_text - else - @entity.to_s - end - end - - def value_text - STATUS_RENAME[@status.to_s] || @status.to_s - end - - def key_width - if @key_width && @key_width.between?(1, MAX_KEY_WIDTH) - @key_width - else - 62 - end - end - - def value_width - 54 - end - - def value_color - STATUS_COLOR[@status.to_sym] || STATUS_COLOR[:unknown] - end - end - end - end -end |