debian-mirror-gitlab/app/graphql/resolvers/clusters/agents_resolver.rb

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

39 lines
869 B
Ruby
Raw Normal View History

2021-11-18 22:05:49 +05:30
# frozen_string_literal: true
module Resolvers
module Clusters
class AgentsResolver < BaseResolver
include LooksAhead
type Types::Clusters::AgentType.connection_type, null: true
extras [:lookahead]
when_single do
argument :name, GraphQL::Types::String,
required: true,
description: 'Name of the cluster agent.'
end
def resolve_with_lookahead(**args)
apply_lookahead(
::Clusters::AgentsFinder
2022-08-13 15:12:31 +05:30
.new(object, current_user, params: args)
2021-11-18 22:05:49 +05:30
.execute
)
end
private
def preloads
2022-01-26 12:08:38 +05:30
{
activity_events: { activity_events: [:user, agent_token: :agent] },
2022-07-23 23:45:48 +05:30
tokens: :agent_tokens
2022-01-26 12:08:38 +05:30
}
2021-11-18 22:05:49 +05:30
end
end
end
end
2022-08-13 15:12:31 +05:30
Resolvers::Clusters::AgentsResolver.prepend_mod_with('Resolvers::Clusters::AgentsResolver')