summaryrefslogtreecommitdiff
path: root/app/graphql/types/ci/stage_type.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/types/ci/stage_type.rb')
-rw-r--r--app/graphql/types/ci/stage_type.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/app/graphql/types/ci/stage_type.rb b/app/graphql/types/ci/stage_type.rb
index 1be9e3192a9..ce3edb6c54f 100644
--- a/app/graphql/types/ci/stage_type.rb
+++ b/app/graphql/types/ci/stage_type.rb
@@ -6,22 +6,21 @@ module Types
graphql_name 'CiStage'
authorize :read_commit_status
- field :name,
- type: GraphQL::STRING_TYPE,
- null: true,
+ field :id, GraphQL::ID_TYPE, null: false,
+ description: 'ID of the stage.'
+ field :name, type: GraphQL::STRING_TYPE, null: true,
description: 'Name of the stage.'
- field :groups,
- type: Ci::GroupType.connection_type,
- null: true,
+ field :groups, type: Ci::GroupType.connection_type, null: true,
extras: [:lookahead],
description: 'Group of jobs for the stage.'
- field :detailed_status, Types::Ci::DetailedStatusType,
- null: true,
+ field :detailed_status, Types::Ci::DetailedStatusType, null: true,
description: 'Detailed status of the stage.'
- field :jobs, Ci::JobType.connection_type,
- null: true,
+ field :jobs, Ci::JobType.connection_type, null: true,
description: 'Jobs for the stage.',
method: 'latest_statuses'
+ field :status, GraphQL::STRING_TYPE,
+ null: true,
+ description: 'Status of the pipeline stage.'
def detailed_status
object.detailed_status(current_user)
@@ -54,6 +53,7 @@ module Types
# rubocop: disable CodeReuse/ActiveRecord
def jobs_for_pipeline(pipeline, stage_ids, include_needs)
results = pipeline.latest_statuses.where(stage_id: stage_ids)
+ results = results.preload(:project)
results = results.preload(:needs) if include_needs
results.group_by(&:stage_id)