From 829c8e26a900ddc981e9a13dd15b7ac028270115 Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi Date: Thu, 2 Sep 2021 14:55:24 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=88=E3=82=8A=E5=AE=89=E5=85=A8=E3=81=AB?= =?UTF-8?q?=E5=88=A9=E7=94=A8=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E3=81=99=E3=82=8B=E3=81=9F=E3=82=81=20GraphiQL=20?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ApiNav.php | 6 - Controller/Admin/GraphiQLController.php | 94 ---------- Resource/locale/messages.en.yaml | 2 - Resource/locale/messages.ja.yaml | 3 +- Resource/template/admin/OAuth/graphiql.twig | 188 -------------------- 5 files changed, 1 insertion(+), 292 deletions(-) delete mode 100644 Controller/Admin/GraphiQLController.php delete mode 100644 Resource/template/admin/OAuth/graphiql.twig diff --git a/ApiNav.php b/ApiNav.php index 7302a01..aa7e4ad 100644 --- a/ApiNav.php +++ b/ApiNav.php @@ -41,12 +41,6 @@ public static function getNav() ], ], ]; - if ('dev' === env('APP_ENV')) { - $menu['setting']['children']['api']['children']['graphiql'] = [ - 'name' => 'api.admin.graphiql.name', - 'url' => 'admin_api_graphiql', - ]; - } return $menu; } diff --git a/Controller/Admin/GraphiQLController.php b/Controller/Admin/GraphiQLController.php deleted file mode 100644 index 8b93bbb..0000000 --- a/Controller/Admin/GraphiQLController.php +++ /dev/null @@ -1,94 +0,0 @@ -kernel = $kernel; - $this->schema = $schema; - } - - /** - * @Route("/%eccube_admin_route%/graphiql", name="admin_api_graphiql", methods={"GET"}) - * @Template("@Api/admin/OAuth/graphiql.twig") - * - * @return array - */ - public function graphiql() - { - if ('dev' !== env('APP_ENV')) { - throw new AccessDeniedHttpException(); - } - return []; - } - - /** - * @Route("/%eccube_admin_route%/graphiql/api", name="admin_api_graphiql_api", methods={"POST"}) - */ - public function index(Request $request) - { - if ('dev' !== env('APP_ENV')) { - throw new AccessDeniedHttpException(); - } - $this->isTokenValid(); - - switch ($request->getMethod()) { - case 'GET': - $query = $request->get('query'); - $variableValues = json_decode($request->get('variables'), true); - break; - case 'POST': - $body = json_decode($request->getContent(), true); - $query = $body['query']; - $variableValues = isset($body['variables']) ? $body['variables'] : null; - break; - default: - throw new RuntimeException(); - } - - $result = GraphQL::executeQuery($this->schema, $query, null, null, $variableValues); - - if ($this->kernel->isDebug()) { - $debug = DebugFlag::INCLUDE_DEBUG_MESSAGE | DebugFlag::INCLUDE_TRACE; - $result = $result->toArray($debug); - } - - return $this->json($result); - } -} diff --git a/Resource/locale/messages.en.yaml b/Resource/locale/messages.en.yaml index ecf4b99..754f55a 100644 --- a/Resource/locale/messages.en.yaml +++ b/Resource/locale/messages.en.yaml @@ -44,8 +44,6 @@ api: search_no_result_message: No WebHooks. delete__confirm_title: Delete a WebHook delete__confirm_message: Are you sure to delete this WebHook? - graphiql: - name: GraphiQL #------------------------------------------------------------------------------------ # API diff --git a/Resource/locale/messages.ja.yaml b/Resource/locale/messages.ja.yaml index fe95c32..dcf5452 100644 --- a/Resource/locale/messages.ja.yaml +++ b/Resource/locale/messages.ja.yaml @@ -44,8 +44,7 @@ api: search_no_result_message: WebHookが登録されていません delete__confirm_title: WebHookを削除します delete__confirm_message: WebHookを削除してもよろしいですか? - graphiql: - name: GraphiQL + #------------------------------------------------------------------------------------ # API #------------------------------------------------------------------------------------ diff --git a/Resource/template/admin/OAuth/graphiql.twig b/Resource/template/admin/OAuth/graphiql.twig deleted file mode 100644 index 0987e0a..0000000 --- a/Resource/template/admin/OAuth/graphiql.twig +++ /dev/null @@ -1,188 +0,0 @@ -{% extends '@admin/default_frame.twig' %} - -{% set menus = ['setting', 'api', 'graphiql'] %} - -{% block title %}{% endblock %} -{% block sub_title %}{% endblock %} - -{% block stylesheet %} - - -{% endblock %} - -{% block javascript %} - - - - - -{% endblock javascript %} - -{% block main %} -
-{% endblock %}