Module: ActiveAdmin::GraphQL::Integration

Defined in:
lib/active_admin/graphql/integration.rb

Overview

Hooks graphql configuration and routing into ActiveAdmin when this gem is loaded.

Defined Under Namespace

Modules: ApplicationUnloadClearsGraphQLSchema, PageDSLMethods, PageMethods, ResourceDSLMethods, ResourceMethods, RouterMethods

Class Method Summary collapse

Class Method Details

.install!Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/active_admin/graphql/integration.rb', line 11

def install!
  return if @installed

  @installed = true
  ActiveAdmin::Application.prepend(ApplicationUnloadClearsGraphQLSchema)
  register_namespace_settings!
  ActiveAdmin::Resource.prepend(ResourceMethods)
  ActiveAdmin::ResourceDSL.prepend(ResourceDSLMethods)
  ActiveAdmin::Page.prepend(PageMethods)
  ActiveAdmin::PageDSL.prepend(PageDSLMethods)
  ActiveAdmin::Router.prepend(RouterMethods)
  register_railtie!
end

.register_namespace_settings!Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/active_admin/graphql/integration.rb', line 25

def register_namespace_settings!
  ns = ActiveAdmin::NamespaceSettings
  ns.register :graphql, false
  ns.register :graphql_path, "graphql"
  ns.register :graphql_multiplex_max, 20
  ns.register :graphql_dataloader, nil
  ns.register :graphql_visibility, nil
  ns.register :graphql_visibility_profile, nil
  ns.register :graphql_schema_visible, nil
  ns.register :graphql_max_complexity, 300
  ns.register :graphql_max_depth, 18
  ns.register :graphql_batch_action_max_ids, 5000
  ns.register :graphql_default_page_size, 25
  ns.register :graphql_default_max_page_size, 100
  ns.register :graphql_configure_schema, nil
  ns.register :graphql_policy_actions, nil
  ns.register :graphql_policy_action_mapper, nil
  ns.register :graphql_policy_extra, nil
  ns.register :graphql_policy_transform, nil
  ns.register :graphql_custom_field_authorization_default, true
  ns.register :graphql_custom_mutation_authorization_default, true
end

.register_railtie!Object



48
49
50
51
52
# File 'lib/active_admin/graphql/integration.rb', line 48

def register_railtie!
  return unless defined?(Rails::Railtie)

  require_relative "railtie"
end