Class: Resolvers::Ci::AllJobsResolver

Inherits:
BaseResolver
  • Object
show all
Includes:
LooksAhead
Defined in:
app/graphql/resolvers/ci/all_jobs_resolver.rb

Constant Summary collapse

COMPATIBLE_RUNNER_ERROR_MESSAGE =
'compatibleRunnerId can only be used when the `statuses` argument is set to "PENDING"'

Constants included from Gitlab::Graphql::Authorize::AuthorizeResource

Gitlab::Graphql::Authorize::AuthorizeResource::ConfigurationError, Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR

Instance Method Summary collapse

Methods included from LooksAhead

#apply_lookahead, #resolve

Methods inherited from BaseResolver

as_single, authorization, authorized?, before_connection_authorization, before_connection_authorization_block, calculate_ext_conn_complexity, calls_gitaly!, calls_gitaly?, complexity, complexity_multiplier, #current_user, last, #object, #offset_pagination, requires_argument!, requires_argument?, resolver_complexity, #select_result, single, #single?, single_definition_blocks, singular_type, when_single

Methods included from Gitlab::Utils::Override

#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!

Methods included from Gitlab::Graphql::Authorize::AuthorizeResource

#authorize!, #authorized_find!, #authorized_resource?, #find_object, #raise_resource_not_available_error!

Instance Method Details

#ready?(**args) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
32
33
34
35
# File 'app/graphql/resolvers/ci/all_jobs_resolver.rb', line 29

def ready?(**args)
  if args.key?(:compatible_runner_id) && args[:statuses] != %w[pending]
    raise Gitlab::Graphql::Errors::ArgumentError, COMPATIBLE_RUNNER_ERROR_MESSAGE
  end

  super
end

#resolve_with_lookahead(**args) ⇒ Object



37
38
39
40
41
# File 'app/graphql/resolvers/ci/all_jobs_resolver.rb', line 37

def resolve_with_lookahead(**args)
  jobs = ::Ci::JobsFinder.new(current_user: current_user, **runner_args(args), params: params_data(args)).execute

  apply_lookahead(jobs)
end