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

39 lines
825 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
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] },
tokens: :last_used_agent_tokens
}
2021-11-18 22:05:49 +05:30
end
end
end
end