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
|
|
|
|
|
|
|
|
alias_method :project, :object
|
|
|
|
|
|
|
|
def resolve_with_lookahead(**args)
|
|
|
|
apply_lookahead(
|
|
|
|
::Clusters::AgentsFinder
|
|
|
|
.new(project, current_user, params: args)
|
|
|
|
.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
|