debian-mirror-gitlab/app/graphql/resolvers/ci/all_jobs_resolver.rb

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

39 lines
1.1 KiB
Ruby
Raw Normal View History

2022-11-25 23:54:43 +05:30
# frozen_string_literal: true
module Resolvers
module Ci
class AllJobsResolver < BaseResolver
2023-06-20 00:43:36 +05:30
include LooksAhead
2022-11-25 23:54:43 +05:30
type ::Types::Ci::JobType.connection_type, null: true
argument :statuses, [::Types::Ci::JobStatusEnum],
required: false,
description: 'Filter jobs by status.'
2023-06-20 00:43:36 +05:30
def resolve_with_lookahead(statuses: nil)
jobs = ::Ci::JobsFinder.new(current_user: current_user, params: { scope: statuses }).execute
apply_lookahead(jobs)
end
private
def preloads
{
previous_stage_jobs_or_needs: [:needs, :pipeline],
artifacts: [:job_artifacts],
pipeline: [:user],
project: [{ project: [:route, { namespace: [:route] }] }],
commit_path: [:pipeline, { project: { namespace: [:route] } }],
ref_path: [{ project: [:route, { namespace: [:route] }] }],
browse_artifacts_path: [{ project: { namespace: [:route] } }],
play_path: [{ project: { namespace: [:route] } }],
web_path: [{ project: { namespace: [:route] } }],
tags: [:tags]
}
2022-11-25 23:54:43 +05:30
end
end
end
end