Settings
This commit is contained in:
parent
499abe195e
commit
e7d7d18f77
16
Plugin.php
16
Plugin.php
@ -15,6 +15,18 @@ class Plugin extends PluginBase
|
|||||||
|
|
||||||
public function registerSettings()
|
public function registerSettings()
|
||||||
{
|
{
|
||||||
|
return [
|
||||||
|
'settings' => [
|
||||||
|
'label' => 'germanairlinesva.graphql::lang.settings.label',
|
||||||
|
'description' => 'germanairlinesva.graphql::lang.settings.description',
|
||||||
|
'category' => 'system::lang.system.categories.cms',
|
||||||
|
'icon' => 'icon-compress',
|
||||||
|
'class' => 'GermanAirlinesVa\Graphql\Models\Settings',
|
||||||
|
'order' => 1000,
|
||||||
|
'keywords' => 'graphql',
|
||||||
|
'permissions' => ['germanairlinesva.graphql.schemas']
|
||||||
|
]
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function boot()
|
public function boot()
|
||||||
@ -49,7 +61,7 @@ class Plugin extends PluginBase
|
|||||||
{
|
{
|
||||||
foreach ($options['providers'] as $provider)
|
foreach ($options['providers'] as $provider)
|
||||||
{
|
{
|
||||||
App::register($provider);
|
App::register($provider);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +70,7 @@ class Plugin extends PluginBase
|
|||||||
{
|
{
|
||||||
foreach ($options['aliases'] as $alias => $path)
|
foreach ($options['aliases'] as $alias => $path)
|
||||||
{
|
{
|
||||||
$aliasLoader->alias($alias, $path);
|
$aliasLoader->alias($alias, $path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,11 +72,11 @@ class SchemaSourceProvider implements LighthouseSchemaSourceProvider
|
|||||||
// root types
|
// root types
|
||||||
$schema = '
|
$schema = '
|
||||||
type Query {
|
type Query {
|
||||||
graphql: Boolean
|
dummy: Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
type Mutation {
|
type Mutation {
|
||||||
graphql: Boolean
|
dummy: Boolean
|
||||||
}
|
}
|
||||||
';
|
';
|
||||||
// schema
|
// schema
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Cms\Classes\Theme;
|
use Cms\Classes\Theme;
|
||||||
|
use GermanAirlinesVa\Graphql\Models\Settings;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'packages' => [
|
'packages' => [
|
||||||
@ -71,7 +72,7 @@ return [
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
'cache' => [
|
'cache' => [
|
||||||
'enable' => false,
|
'enable' => Settings::get('enable_cache', false),
|
||||||
'key' => env('GRAPHQL_CACHE_KEY', 'graphql-schema'),
|
'key' => env('GRAPHQL_CACHE_KEY', 'graphql-schema'),
|
||||||
'ttl' => env('GRAPHQL_CACHE_TTL', null),
|
'ttl' => env('GRAPHQL_CACHE_TTL', null),
|
||||||
],
|
],
|
||||||
@ -189,7 +190,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'batched_queries' => true,
|
'batched_queries' => Settings::get('batched_queries', true),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|||||||
@ -6,4 +6,26 @@
|
|||||||
'menu' => [
|
'menu' => [
|
||||||
'main' => 'GraphQL',
|
'main' => 'GraphQL',
|
||||||
],
|
],
|
||||||
];
|
'permission' => [
|
||||||
|
'tab' => [
|
||||||
|
'schemas' => 'Schemas',
|
||||||
|
],
|
||||||
|
'label' => [
|
||||||
|
'schemas' => 'Manage schemas',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'settings' => [
|
||||||
|
'label' => 'German Airlines VA - GraphQL',
|
||||||
|
'description' => 'Configure GrapQL',
|
||||||
|
'general' => 'General',
|
||||||
|
'engine' => 'Engine',
|
||||||
|
'enable_cache' => [
|
||||||
|
'label' => 'Enable Schema Cache',
|
||||||
|
'comment' => 'A large part of the Schema generation is parsing the various graph definition into an AST. These operations are pretty expensive so it is recommended to enable caching in production mode.'
|
||||||
|
],
|
||||||
|
'batched_queries' => [
|
||||||
|
'label' => 'Batched Queries',
|
||||||
|
'comment' => 'GraphQL query batching means sending multiple queries to the server in one request. You may set this flag to process/deny batched queries.'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|||||||
15
models/Settings.php
Normal file
15
models/Settings.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php namespace GermanAirlinesVa\Graphql\Models;
|
||||||
|
|
||||||
|
use Cms\Classes\Theme;
|
||||||
|
use Model;
|
||||||
|
|
||||||
|
|
||||||
|
class Settings extends Model
|
||||||
|
{
|
||||||
|
public $implement = ['System.Behaviors.SettingsModel'];
|
||||||
|
|
||||||
|
public $settingsCode = 'germanairlinesva_graphql_settings';
|
||||||
|
|
||||||
|
public $settingsFields = 'fields.yaml';
|
||||||
|
|
||||||
|
}
|
||||||
16
models/settings/fields.yaml
Normal file
16
models/settings/fields.yaml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
tabs:
|
||||||
|
fields:
|
||||||
|
enable_cache:
|
||||||
|
label: 'germanairlinesva.graphql::lang.settings.enable_cache.label'
|
||||||
|
span: left
|
||||||
|
default: false
|
||||||
|
type: checkbox
|
||||||
|
comment: 'germanairlinesva.graphql::lang.settings.enable_cache.comment'
|
||||||
|
tab: 'germanairlinesva.graphql::lang.settings.engine'
|
||||||
|
batched_queries:
|
||||||
|
label: 'germanairlinesva.graphql::lang.settings.batched_queries.label'
|
||||||
|
span: right
|
||||||
|
default: true
|
||||||
|
type: checkbox
|
||||||
|
comment: 'germanairlinesva.graphql::lang.settings.batched_queries.comment'
|
||||||
|
tab: 'germanairlinesva.graphql::lang.settings.engine'
|
||||||
@ -4,3 +4,7 @@ plugin:
|
|||||||
author: 'German Airlines VA'
|
author: 'German Airlines VA'
|
||||||
icon: oc-icon-database
|
icon: oc-icon-database
|
||||||
homepage: ''
|
homepage: ''
|
||||||
|
permissions:
|
||||||
|
schemas:
|
||||||
|
tab: 'germanairlinesva.graphql::lang.permission.tab.schemas'
|
||||||
|
label: 'germanairlinesva.graphql::lang.permission.label.schemas'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user