From 28ce08434a847d5f955bcbfd634c6d60d675e393 Mon Sep 17 00:00:00 2001 From: Mark Huot Date: Fri, 22 Dec 2017 10:01:09 -0500 Subject: [PATCH 1/2] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b6c356df..3ea929e0 100644 --- a/README.md +++ b/README.md @@ -311,6 +311,7 @@ No software is ever done. There's a lot still to do in order to make _CraftQL_ f - [x] Mutations need a lot more testing - [x] `relatedTo:` improvements to take source/target - [ ] [Persisted queries](https://github.com/markhuot/craftql/issues/10) +- [ ] [Subclassed enum fields](https://github.com/markhuot/craftql/issues/40) that are able to return the raw field value ## Requirements From 67a8a1ff84650c9e3898f98497904a84e55e84c2 Mon Sep 17 00:00:00 2001 From: Tim Kelty Date: Wed, 3 Jan 2018 16:28:57 -0500 Subject: [PATCH 2/2] Fix hardcoded admin links. --- src/Controllers/CpController.php | 6 +++--- src/templates/scopes.html | 8 ++++---- src/templates/settings.html | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Controllers/CpController.php b/src/Controllers/CpController.php index d0a03487..4d9b7f6c 100644 --- a/src/Controllers/CpController.php +++ b/src/Controllers/CpController.php @@ -17,7 +17,7 @@ function actionTokengenerate() $token->token = Yii::$app->security->generateRandomString(64); $token->save(); - $this->redirect('/admin/settings/plugins/craftql'); + $this->redirect('settings/plugins/craftql'); } function actionTokendelete($tokenId) @@ -25,7 +25,7 @@ function actionTokendelete($tokenId) $token = Token::find()->where(['id' => $tokenId])->one(); $token->delete(); - $this->redirect('/admin/settings/plugins/craftql'); + $this->redirect('settings/plugins/craftql'); } function actionTokenscopes($tokenId) @@ -44,7 +44,7 @@ function actionSavetokenscopes($tokenId) Craft::$app->getSession()->setNotice(Craft::t('app', 'Scopes saved.')); - $this->redirect('/admin/craftql/token/'.$tokenId.'/scopes'); + $this->redirect('craftql/token/'.$tokenId.'/scopes'); } function actionIndex() diff --git a/src/templates/scopes.html b/src/templates/scopes.html index 5275f404..c1998ea4 100644 --- a/src/templates/scopes.html +++ b/src/templates/scopes.html @@ -4,9 +4,9 @@ {% set fullPageForm = true %} {% set title = "Token Scopes"|t %} {% set crumbs = [ - {'label': 'Settings', 'url': '/admin/settings'}, - {'label': 'Plugins', 'url': '/admin/settings/plugins'}, - {'label': 'CraftQL', 'url': '/admin/settings/plugins/craftql'}, + {'label': 'Settings', 'url': url('settings')}, + {'label': 'Plugins', 'url': url('settings/plugins')}, + {'label': 'CraftQL', 'url': url('settings/plugins/craftql')}, ] %} {% set content %} @@ -23,7 +23,7 @@

Try it out

-

You can explore your API with the permissions of this token by navigating to /admin/craftql/browse/{token}. +

You can explore your API with the permissions of this token in GraphiQL.


diff --git a/src/templates/settings.html b/src/templates/settings.html index 56c7ec4d..a12f5909 100644 --- a/src/templates/settings.html +++ b/src/templates/settings.html @@ -48,13 +48,13 @@ You can access your GraphQL endpoint in two ways, -1. **[GraphiQL](/admin/craftql/browse)**

will show you a graphical interface to GraphQL. Use it to explore your schema and test requests. Click _Docs_ in the upper right hand corner to see all the fields you can query against.

+1. **[GraphiQL]({{ url('craftql/browse') }})**

will show you a graphical interface to GraphQL. Use it to explore your schema and test requests. Click _Docs_ in the upper right hand corner to see all the fields you can query against.

2. **Curl** {% if settings.tokens|length %}

You can query your schema directly by passing a GraphQL statement throuh a `query` variable. The following Curl statement should get you started,

$ curl -H "Authorization: bearer {{ settings.tokens[0].token|default('{TOKEN}') }}" -H "Content-type: application/json" -d '{"query":"{ helloWorld }"}' {{ siteUrl }}{{ settings.uri }}

{% else %} -

Before you can use Curl you need to [add a token](/admin/craftql/token-gen) for authenticated access in to Craft.

+

Before you can use Curl you need to [add a token]({{ url('craftql/token-gen') }}) for authenticated access in to Craft.

{% endif %} {% endset %} @@ -77,7 +77,7 @@

URI

Tokens

Tokens control access in to your API. Instead of authenticating with a username and password, API access is granted via a token. Treat this token like a password because it provides privileged access in to your Craft website.

-

Generate a new token (for my user)

+

Generate a new token (for my user)

{% if settings.tokens|length > 0 %} @@ -93,8 +93,8 @@

Tokens

- - + + {% endfor %}
{{ token.token }}Scopes…Scopes…