Commit 7c365fd0 authored by Jonathan Schafer's avatar Jonathan Schafer

Move descriptions closer to enum

parent 4a434609
......@@ -3,23 +3,9 @@
module Types
module Ci
class PipelineStatusEnum < BaseEnum
descriptions = {
created: 'Pipeline has been created',
waiting_for_resource: 'A resource (for example, a runner) that the pipeline requires to run is unavailable',
preparing: 'Pipeline is preparing to run',
pending: 'Pipeline has not started running yet',
running: 'Pipeline is running',
failed: 'At least one stage of the pipeline failed',
success: 'Pipeline completed successfully',
canceled: 'Pipeline was canceled before completion',
skipped: 'Pipeline was skipped',
manual: 'Pipeline needs to be manually started',
scheduled: 'Pipeline is scheduled to run'
}
::Ci::Pipeline.all_state_names.each do |state_symbol|
value state_symbol.to_s.upcase,
description: descriptions[state_symbol],
description: ::Ci::Pipeline::STATUSES_DESCRIPTION[state_symbol],
value: state_symbol.to_s
end
end
......
......@@ -16,6 +16,19 @@ module Ci
STATUSES_ENUM = { created: 0, pending: 1, running: 2, success: 3,
failed: 4, canceled: 5, skipped: 6, manual: 7,
scheduled: 8, preparing: 9, waiting_for_resource: 10 }.freeze
STATUSES_DESCRIPTION = {
created: 'Pipeline has been created',
waiting_for_resource: 'A resource (for example, a runner) that the pipeline requires to run is unavailable',
preparing: 'Pipeline is preparing to run',
pending: 'Pipeline has not started running yet',
running: 'Pipeline is running',
failed: 'At least one stage of the pipeline failed',
success: 'Pipeline completed successfully',
canceled: 'Pipeline was canceled before completion',
skipped: 'Pipeline was skipped',
manual: 'Pipeline needs to be manually started',
scheduled: 'Pipeline is scheduled to run'
}.freeze
UnknownStatusError = Class.new(StandardError)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment