Class: Types::Ci::StageType
- Inherits:
-
BaseObject
- Object
- GraphQL::Schema::Object
- BaseObject
- Types::Ci::StageType
- Defined in:
- app/graphql/types/ci/stage_type.rb
Instance Method Summary collapse
- #detailed_status ⇒ Object
-
#groups(lookahead:) ⇒ Object
Issues one query per pipeline.
- #jobs ⇒ Object
Methods inherited from BaseObject
accepts, assignable?, authorization, authorization_scopes, authorize, authorized?, #current_user, #id
Methods included from Gitlab::Graphql::Present
Instance Method Details
#detailed_status ⇒ Object
24 25 26 |
# File 'app/graphql/types/ci/stage_type.rb', line 24 def detailed_status object.detailed_status(current_user) end |
#groups(lookahead:) ⇒ Object
Issues one query per pipeline
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/graphql/types/ci/stage_type.rb', line 29 def groups(lookahead:) key = ::Gitlab::Graphql::BatchKey.new(object, lookahead, object_name: :stage) BatchLoader::GraphQL.for(key).batch(default_value: []) do |keys, loader| by_pipeline = keys.group_by(&:pipeline) include_needs = keys.any? do |k| k.requires?(%i[nodes jobs nodes needs]) || k.requires?(%i[nodes jobs nodes previousStageJobsOrNeeds]) end by_pipeline.each do |pl, key_group| project = pl.project indexed = key_group.index_by(&:id) jobs_for_pipeline(pl, indexed.keys, include_needs).each do |stage_id, statuses| key = indexed[stage_id] groups = ::Ci::Group.fabricate(project, key.stage, statuses) loader.call(key, groups) end end end end |
#jobs ⇒ Object
53 54 55 56 57 58 |
# File 'app/graphql/types/ci/stage_type.rb', line 53 def jobs GraphQL::Pagination::ActiveRecordRelationConnection.new( object.ordered_latest_statuses, max_page_size: Gitlab::CurrentSettings.current_application_settings.jobs_per_stage_page_size ) end |