From f01509cab123091e4c0b34821d63fc3565e2199f Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 4 Aug 2021 00:56:18 +0200 Subject: [PATCH] Format --- Authentication.php | 7 ++- Plugin.php | 7 ++- classes/Authentication.php | 7 ++- classes/Dummy.php | 2 +- controllers/GraphqlKey.php | 14 +++--- controllers/graphqlkey/_list_toolbar.htm | 27 +++++------ controllers/graphqlkey/config_list.yaml | 6 +-- graphs/cms.htm | 15 ++---- graphs/fleet.htm | 40 ++++------------ lang/en/lang.php | 58 ++++++++++++------------ models/graphqlkey/columns.yaml | 24 +++++----- plugin.yaml | 44 +++++++++--------- 12 files changed, 112 insertions(+), 139 deletions(-) diff --git a/Authentication.php b/Authentication.php index 1c766bf..0a636fe 100644 --- a/Authentication.php +++ b/Authentication.php @@ -14,10 +14,9 @@ class Authentication public function handle($request, Closure $next) { if ($request->input('gql_session') === 'SUPER_SECRET_TOKEN') { - return "false"; - } - else { - return "true"; + return 'false'; + } else { + return 'true'; } return $next($request); diff --git a/Plugin.php b/Plugin.php index 50e54a9..745582c 100644 --- a/Plugin.php +++ b/Plugin.php @@ -43,8 +43,11 @@ class Plugin extends PluginBase $this->app->singleton(DatabaseManager::class, function ($app) { return $app->make('db'); }); - \Illuminate\Support\Facades\Broadcast::routes(['prefix' => '', 'middleware' => 'GermanAirlinesVA\\Graphql\\Classes\\Authentication']); - require("channels/channels.php"); + \Illuminate\Support\Facades\Broadcast::routes([ + 'prefix' => '', + 'middleware' => 'GermanAirlinesVA\\Graphql\\Classes\\Authentication', + ]); + require 'channels/channels.php'; Config::set('database.connections.germanairlinesva_graphql', Config::get('germanairlinesva.graphql::connection')); } diff --git a/classes/Authentication.php b/classes/Authentication.php index f5a2624..74284c8 100644 --- a/classes/Authentication.php +++ b/classes/Authentication.php @@ -15,10 +15,9 @@ class Authentication public function handle($request, Closure $next) { if ($request->header('Gql-Session') === 'SUPER_SECRET_KEY_HEADER') { - return ""; - } - else { - throw new AccessDeniedHttpException; + return ''; + } else { + throw new AccessDeniedHttpException(); } return $next($request); diff --git a/classes/Dummy.php b/classes/Dummy.php index b485336..a687471 100644 --- a/classes/Dummy.php +++ b/classes/Dummy.php @@ -69,6 +69,6 @@ class Dummy extends GraphQLSubscription */ public function resolve($root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo): array { - return array($root); + return [$root]; } } diff --git a/controllers/GraphqlKey.php b/controllers/GraphqlKey.php index 3dad937..a8d7b0a 100644 --- a/controllers/GraphqlKey.php +++ b/controllers/GraphqlKey.php @@ -5,12 +5,12 @@ use BackendMenu; class GraphqlKey extends Controller { - public $implement = [ 'Backend\Behaviors\ListController' ]; - - public $listConfig = 'config_list.yaml'; + public $implement = ['Backend\Behaviors\ListController']; - public function __construct() - { - parent::__construct(); - } + public $listConfig = 'config_list.yaml'; + + public function __construct() + { + parent::__construct(); + } } diff --git a/controllers/graphqlkey/_list_toolbar.htm b/controllers/graphqlkey/_list_toolbar.htm index c651229..ee2b577 100644 --- a/controllers/graphqlkey/_list_toolbar.htm +++ b/controllers/graphqlkey/_list_toolbar.htm @@ -1,17 +1,18 @@
- + data-request="onDelete" + data-request-confirm="" + data-trigger-action="enable" + data-trigger=".control-list input[type=checkbox]" + data-trigger-condition="checked" + data-request-success="$(this).prop('disabled', true)" + data-stripe-load-indicator + > + +
diff --git a/controllers/graphqlkey/config_list.yaml b/controllers/graphqlkey/config_list.yaml index 5d34fbf..be994f1 100644 --- a/controllers/graphqlkey/config_list.yaml +++ b/controllers/graphqlkey/config_list.yaml @@ -6,6 +6,6 @@ showSetup: true showCheckboxes: true recordsPerPage: 20 toolbar: - buttons: list_toolbar - search: - prompt: 'backend::lang.list.search_prompt' + buttons: list_toolbar + search: + prompt: 'backend::lang.list.search_prompt' diff --git a/graphs/cms.htm b/graphs/cms.htm index 24753ea..93d9adc 100644 --- a/graphs/cms.htm +++ b/graphs/cms.htm @@ -1,5 +1,4 @@ -title = "CMS" -== +title = "CMS" == -== -# Content -extend type Query { cmsContent(name: String!): CmsContent! } -type CmsContent { fileName: String! content: String markup: String parsedMarkup: String } -# CMS-wide types -# Backend\Models\User -type BackendUser { id: ID! } -#System\Models\File -type SystemFile { id: ID path: String title: String description: String } +== # Content extend type Query { cmsContent(name: String!): CmsContent! } type CmsContent { fileName: String! content: +String markup: String parsedMarkup: String } # CMS-wide types # Backend\Models\User type BackendUser { id: ID! } +#System\Models\File type SystemFile { id: ID path: String title: String description: String } diff --git a/graphs/fleet.htm b/graphs/fleet.htm index ef01929..54c9370 100644 --- a/graphs/fleet.htm +++ b/graphs/fleet.htm @@ -1,32 +1,8 @@ -title = "Fleet" -== -== -# Content -extend type Query { - aircraft: [Aircraft] @all(model: "GermanAirlinesVa\\Fleet\\Models\\Aircraft") - aircraftType: [AircraftType] @all(model: "GermanAirlinesVa\\Fleet\\Models\\AircraftType") -} - -extend type Subscription { - aircraftAdded: Aircraft @subscription(class: "GermanAirlinesVa\\Fleet\\Classes\\AircraftAdded") -} - -extend type Mutation { - addAircraft( - aircraft_type_id: ID!, - home_airport_id: ID!, - name: String!, - registration: String! - ): Aircraft - @create(model: "GermanAirlinesVa\\Fleet\\Models\\Aircraft") - @broadcast(subscription: "aircraftAdded") -} - -type Aircraft { - id: ID! - aircraft_type_id: ID! - home_airport_id: ID! - name: String! - registration: String! -} -type AircraftType { type: String! aircrafts: [Aircraft] @hasMany } +title = "Fleet" == == # Content extend type Query { aircraft: [Aircraft] @all(model: +"GermanAirlinesVa\\Fleet\\Models\\Aircraft") aircraftType: [AircraftType] @all(model: +"GermanAirlinesVa\\Fleet\\Models\\AircraftType") } extend type Subscription { aircraftAdded: Aircraft +@subscription(class: "GermanAirlinesVa\\Fleet\\Classes\\AircraftAdded") } extend type Mutation { addAircraft( +aircraft_type_id: ID!, home_airport_id: ID!, name: String!, registration: String! ): Aircraft @create(model: +"GermanAirlinesVa\\Fleet\\Models\\Aircraft") @broadcast(subscription: "aircraftAdded") } type Aircraft { id: ID! +aircraft_type_id: ID! home_airport_id: ID! name: String! registration: String! } type AircraftType { type: String! +aircrafts: [Aircraft] @hasMany } diff --git a/lang/en/lang.php b/lang/en/lang.php index 2414f80..5aa0ad1 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -1,33 +1,35 @@ [ - 'name' => 'GA GraphQL', - 'description' => '', + 'plugin' => [ + 'name' => 'GA GraphQL', + 'description' => '', + ], + 'menu' => [ + 'main' => 'GA GraphQL', + 'keys' => 'GraphQL Keys', + 'playground' => 'GraphiQL', + ], + 'permission' => [ + 'tab' => [ + 'schemas' => 'German Airlines VA - GraphQL', ], - 'menu' => [ - 'main' => 'GA GraphQL', - 'keys' => 'GraphQL Keys', - 'playground' => 'GraphiQL', + 'label' => [ + 'schemas' => 'Access GraphiQL', ], - 'permission' => [ - 'tab' => [ - 'schemas' => 'German Airlines VA - GraphQL', - ], - 'label' => [ - 'schemas' => 'Access GraphiQL', - ], + ], + '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.', ], - '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.', - ], + '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.', ], -]; \ No newline at end of file + ], +]; diff --git a/models/graphqlkey/columns.yaml b/models/graphqlkey/columns.yaml index 0e45288..3b52c63 100644 --- a/models/graphqlkey/columns.yaml +++ b/models/graphqlkey/columns.yaml @@ -1,13 +1,13 @@ columns: - id: - label: id - type: number - member_id: - label: member_id - type: number - valid_from: - label: valid_from - type: datetime - key: - label: key - type: text + id: + label: id + type: number + member_id: + label: member_id + type: number + valid_from: + label: valid_from + type: datetime + key: + label: key + type: text diff --git a/plugin.yaml b/plugin.yaml index 0a19b9f..57e11cb 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -1,26 +1,26 @@ plugin: - name: 'germanairlinesva.graphql::lang.plugin.name' - description: 'germanairlinesva.graphql::lang.plugin.description' - author: 'German Airlines VA' - icon: oc-icon-database - homepage: '' + name: 'germanairlinesva.graphql::lang.plugin.name' + description: 'germanairlinesva.graphql::lang.plugin.description' + author: 'German Airlines VA' + icon: oc-icon-database + homepage: '' permissions: - schemas: - tab: 'germanairlinesva.graphql::lang.permission.tab.schemas' - label: 'germanairlinesva.graphql::lang.permission.label.schemas' + schemas: + tab: 'germanairlinesva.graphql::lang.permission.tab.schemas' + label: 'germanairlinesva.graphql::lang.permission.label.schemas' navigation: - menu: - label: 'germanairlinesva.graphql::lang.menu.main' - url: / + menu: + label: 'germanairlinesva.graphql::lang.menu.main' + url: / + icon: icon-database + permissions: + - schemas + sideMenu: + side-menu-item: + label: 'germanairlinesva.graphql::lang.menu.playground' + url: germanairlinesva/graphql/playground icon: icon-database - permissions: - - schemas - sideMenu: - side-menu-item: - label: 'germanairlinesva.graphql::lang.menu.playground' - url: germanairlinesva/graphql/playground - icon: icon-database - side-menu-item2: - label: 'germanairlinesva.graphql::lang.menu.keys' - url: germanairlinesva/graphql/graphqlkey - icon: icon-key + side-menu-item2: + label: 'germanairlinesva.graphql::lang.menu.keys' + url: germanairlinesva/graphql/graphqlkey + icon: icon-key