Skip to content

Commit 24174cb

Browse files
Merge pull request #42 from directus/hannes-feedback
Implement Hannes' feedback
2 parents efcbfe7 + 9541bd7 commit 24174cb

File tree

11 files changed

+253
-35
lines changed

11 files changed

+253
-35
lines changed

content/1.getting-started/1.create-a-project.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ Create a `docker-compose.yml` file in the `directus` directory:
5555
<!-- TODO: Load latest version always -->
5656

5757
```yaml [docker-compose.yml]
58-
version: "3"
5958
services:
6059
directus:
6160
image: directus/directus:10.10.1
@@ -66,7 +65,6 @@ services:
6665
- ./uploads:/directus/uploads
6766
- ./extensions:/directus/extensions
6867
environment:
69-
KEY: "replace-with-random-value"
7068
SECRET: "replace-with-random-value"
7169
ADMIN_EMAIL: "[email protected]"
7270
ADMIN_PASSWORD: "d1r3ctu5"
@@ -82,7 +80,7 @@ services:
8280
- The `volumes` section maps internal `directus/database` and `directus/uploads` to our local file system alongside the `docker-compose.yml`
8381
- meaning data is backed up outside of Docker containers.
8482
- The `environment` section contains any [configuration environment variables](/configuration/overview) we wish to set.
85-
- `KEY` and `SECRET` are required and should be long random values. `KEY` is used for telemetry and health tracking, and `SECRET` is used to sign access tokens.
83+
- `SECRET` is required and should be a long random value. `SECRET` is used to sign access tokens.
8684
- `ADMIN_EMAIL` and `ADMIN_PASSWORD` is the initial admin user credentials on first launch.
8785
- `DB_CLIENT` and `DB_FILENAME` are defining the connection to your database.
8886
- `WEBSOCKETS_ENABLED` is not required, but enables [Directus Realtime](/realtime/quickstart).

content/10.extensions/3.app-extensions/1.interfaces.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ The `index.js` or `index.ts` file exports an object that is read by Directus. It
1818

1919
### Entrypoint Example
2020

21-
```vue
21+
```js
22+
import { defineInterface } from '@directus/extensions-sdk'
2223
import InterfaceComponent from './interface.vue';
2324

24-
export default {
25+
export default defineInterface({
2526
id: 'custom',
2627
name: 'Custom',
2728
icon: 'box',
@@ -39,7 +40,7 @@ export default {
3940
}
4041
},
4142
],
42-
};
43+
});
4344
```
4445

4546
### Properties
@@ -111,4 +112,4 @@ The interface component can emit the following events that will be recognized by
111112
| `input` | Update the value of the field. |
112113
| `setFieldValue` | Used to set the value of other fields. |
113114

114-
:partial{content="extensions-app-internals"}
115+
:partial{content="extensions-app-internals"}

content/10.extensions/3.app-extensions/2.displays.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,18 @@ The `index.js` or `index.ts` file exports an object that is read by Directus. It
1919
### Entrypoint Example
2020

2121
```js
22+
import { defineInterface } from '@directus/extensions-sdk'
2223
import DisplayComponent from './display.vue';
2324

24-
export default {
25+
export default defineInterface({
2526
id: 'custom',
2627
name: 'Custom',
2728
icon: 'box',
2829
description: 'This is my custom display!',
2930
component: DisplayComponent,
3031
options: null,
3132
types: ['string'],
32-
};
33+
});
3334
```
3435

3536
### Properties
@@ -91,7 +92,9 @@ The current value of the field is provided to the component via the `value` prop
9192
Instead of defining the component inside a separate Vue file, you can use a functional component. This allows you to make small displays that don't need a full component.
9293

9394
```js
94-
export default {
95+
import { defineInterface } from '@directus/extensions-sdk'
96+
97+
export default defineInterface({
9598
id: 'custom',
9699
name: 'Custom',
97100
icon: 'box',
@@ -101,7 +104,7 @@ export default {
101104
},
102105
options: null,
103106
types: ['string'],
104-
};
107+
});
105108
```
106109

107-
:partial{content="extensions-app-internals"}
110+
:partial{content="extensions-app-internals"}

content/10.extensions/3.app-extensions/3.layouts.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ The `index.js` or `index.ts` file exports an object that is read by Directus. It
2020

2121
```js
2222
import { ref } from 'vue';
23+
import { defineInterface } from '@directus/extensions-sdk'
2324
import LayoutComponent from './layout.vue';
2425

25-
export default {
26+
export default defineInterface({
2627
id: 'custom',
2728
name: 'Custom',
2829
icon: 'box',
@@ -36,7 +37,7 @@ export default {
3637
const name = ref('Custom Layout');
3738
return { name };
3839
},
39-
};
40+
});
4041
```
4142

4243
### Properties
@@ -116,4 +117,4 @@ The layout component can emit the following events that will be recognized by Di
116117
| `update:layoutOptions` | Update the user's currently saved layout options. |
117118
| `update:layoutQuery` | Update the user's layout query parameters. |
118119

119-
:partial{content="extensions-app-internals"}
120+
:partial{content="extensions-app-internals"}

content/10.extensions/3.app-extensions/4.panels.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ The `index.js` or `index.ts` file exports an object that is read by Directus. It
1919
### Entrypoint Example
2020

2121
```js
22+
import { defineInterface } from '@directus/extensions-sdk'
2223
import PanelComponent from './panel.vue';
2324

24-
export default {
25+
export default defineInterface({
2526
id: 'custom',
2627
name: 'Custom',
2728
icon: 'box',
@@ -40,7 +41,7 @@ export default {
4041
},
4142
},
4243
],
43-
};
44+
});
4445
```
4546

4647
### Properties

content/10.extensions/3.app-extensions/5.modules.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ The `index.js` or `index.ts` file exports an object that is read by Directus. It
2525
## Entrypoint Example
2626

2727
```js
28+
import { defineInterface } from '@directus/extensions-sdk'
2829
import ModuleComponent from './module.vue';
2930

30-
export default {
31+
export default defineInterface({
3132
id: 'custom',
3233
name: 'Custom',
3334
icon: 'box',
@@ -37,7 +38,7 @@ export default {
3738
component: ModuleComponent,
3839
},
3940
],
40-
};
41+
});
4142
```
4243

4344
### Properties
@@ -96,4 +97,4 @@ sidebar, header, and the main content area. Named slots can be used to add addit
9697
| `splitView` | Renders content in the split view area (only if the private layout has the split-view prop set to true). |
9798
| `sidebar` | Populates the sidebar area in the Directus interface. |
9899

99-
:partial{content="extensions-app-internals"}
100+
:partial{content="extensions-app-internals"}

content/10.extensions/3.app-extensions/6.themes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,4 @@ fontFamily: 'Comic Sans MS, sans-serif'
9090
fontFamily: '"Yesteryear", sans-serif'
9191
```
9292

93-
When using a Google Font, ensure the configured weight is available for the selected font.
93+
When using a Google Font, ensure the configured weight is available for the selected font.

content/10.extensions/3.app-extensions/7.ui-library.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ Refer to the full list of component based CSS variables [in our source code](htt
5151
The Directus UI components are designed with flexibility and customization in mind. However, you may need to create your
5252
own components using shared styling. Directus exposes several CSS variables for both light and dark themes.
5353

54-
Examples of CSS variables include `--border-normal`, `--foreground-normal` `-purple`, `--module-background`, and
55-
`--overlay-color`.
54+
Examples of CSS variables include `--theme--border-normal`, `--theme--foreground-normal` `--theme--purple`, `--theme--module-background`, and
55+
`--theme--overlay-color`.
5656

5757
::callout{type="info" title="Explore Light and Dark Theme CSS Variables"}
5858

5959
Refer to our [source code](https://github.com/directus/directus/tree/main/app/src/styles/themes) for a full list of CSS
6060
variables.
6161

62-
::
62+
::

content/4.auth/1.quickstart.md

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Log out of the Data Studio. From the Sign In screen, you will see a new option t
3535

3636
Open your terminal and run the following command to register a new user.
3737

38+
::snippets
39+
#rest
3840
```bash [Terminal]
3941
curl \
4042
--request POST \
@@ -43,12 +45,29 @@ curl \
4345
--url 'https://directus.example.com/register'
4446
```
4547

48+
#graphql
49+
```graphql
50+
mutation {
51+
users_register(email: "[email protected]", password: "d1r3ctu5")
52+
}
53+
```
54+
55+
#sdk
56+
```js
57+
import { createDirectus, rest, registerUser } from '@directus/sdk';
58+
59+
const client = createDirectus('https://directus.example.com').with(rest());
60+
61+
const result = await client.request(registerUser('[email protected]', 'd1r3ctu5'));
62+
```
63+
::
64+
4665
Go to the user directory by clicking :icon{name="user-directory"} in the module bar and you should see a new user has been created.
4766

4867
## Logging In
4968

50-
To log in and get an access token, run the following command.
51-
69+
::snippets
70+
#rest
5271
```bash [Terminal]
5372
curl \
5473
--request POST \
@@ -57,6 +76,29 @@ curl \
5776
--url 'https://directus.example.com/auth/login'
5877
```
5978

79+
#graphql
80+
```graphql
81+
mutation {
82+
auth_login(email: "[email protected]", password: "d1r3ctu5") {
83+
access_token
84+
refresh_token
85+
}
86+
}
87+
```
88+
89+
#sdk
90+
```js
91+
import { createDirectus, authentication } from '@directus/sdk';
92+
93+
const email = "[email protected]";
94+
const password = "d1r3ctu5";
95+
96+
const client = createDirectus('http://directus.example.com').with(authentication());
97+
98+
const token = await client.login(email, password);
99+
```
100+
::
101+
60102
## Authenticating Requests
61103

62104
You can use the access token while making requests. If your token has expired, you must refresh it.

0 commit comments

Comments
 (0)