You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mercure:true, // or false if you don't use Mercure
60
+
});
57
61
58
62
exportdefault () => (
59
63
<HydraAdmin
@@ -64,4 +68,4 @@ export default () => (
64
68
);
65
69
```
66
70
67
-
For the implementation of the auth provider, you can find a working example in the [API Platform's demo application](https://github.com/api-platform/demo/blob/master/admin/src/authProvider.js).
71
+
For the implementation of the auth provider, you can find a working example in the [API Platform's demo application](https://github.com/api-platform/demo/blob/main/pwa/utils/authProvider.tsx).
Copy file name to clipboardExpand all lines: admin/components.md
+37-25Lines changed: 37 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,11 @@
4
4
5
5
### AdminGuesser
6
6
7
-
`<AdminGuesser>` renders automatically an [<Admin> component](https://marmelab.com/react-admin/Admin.html) for resources exposed by a web API documented with any format supported by `@api-platform/api-doc-parser` (for Hydra documented APIs,
8
-
use the [<HydraAdmin> component](components.md#hydraadmin) instead).
9
-
It also creates a [schema analyzer](components.md#schemaanalyzer) context, where the `schemaAnalyzer` service (for getting information about the provided API documentation) is stored.
7
+
`<AdminGuesser>` renders automatically an [Admin component](https://marmelab.com/react-admin/Admin.html) for resources exposed by a web API documented with any format supported by `@api-platform/api-doc-parser` (for Hydra documented APIs,
8
+
use the [HydraAdmin component](components.md#hydraadmin) instead).
9
+
It also creates a [schema analyzer](components.md#schema-analyzer) context, where the `schemaAnalyzer` service (for getting information about the provided API documentation) is stored.
10
10
11
-
`<AdminGuesser>` renders all exposed resources by default, but you can choose what resource you want to render by passing [<ResourceGuesser> components](components.md#resourceguesser) as children.
11
+
`<AdminGuesser>` renders all exposed resources by default, but you can choose what resource you want to render by passing [ResourceGuesser components](components.md#resourceguesser) as children.
12
12
Deprecated resources are hidden by default, but you can add them back using an explicit `<ResourceGuesser>` component.
13
13
14
14
```javascript
@@ -45,7 +45,8 @@ export default App;
45
45
46
46
### ResourceGuesser
47
47
48
-
Based on React Admin [<Resource> component](https://marmelab.com/react-admin/Resource.html), `ResourceGuesser` provides default props [<CreateGuesser>](components.md#createguesser), [<ListGuesser>](components.md#listguesser), [<EditGuesser>](components.md#editguesser) and [<ShowGuesser>](components.md#showguesser).
48
+
Based on React Admin [Resource component](https://marmelab.com/react-admin/Resource.html), `<ResourceGuesser>` provides default props [CreateGuesser](components.md#createguesser), [ListGuesser](components.md#listguesser), [EditGuesser](components.md#editguesser) and [ShowGuesser](components.md#showguesser).
49
+
49
50
Otherwise, you can pass it your own CRUD components using `create`, `list`, `edit`, `show` props.
| name | string | - | yes | endpoint of the resource |
79
80
80
-
You can also use props accepted by React Admin [<Resource> component](https://marmelab.com/react-admin/Resource.html). For example, the props `list`, `show`, `create` or `edit`.
81
+
You can also use props accepted by React Admin [Resource component](https://marmelab.com/react-admin/Resource.html). For example, the props `list`, `show`, `create` or `edit`.
81
82
82
83
## Page Components
83
84
84
85
### ListGuesser
85
86
86
-
Based on React Admin [<List>](https://marmelab.com/react-admin/List.html), ListGuesser displays a list of resources in a [<Datagrid>](https://marmelab.com/react-admin/List.html#the-datagrid-component), according to children passed to it (usually [<FieldGuesser>](components.md#fieldguesser) or any [field component](https://marmelab.com/react-admin/Fields.html#basic-fields)
87
+
Based on React Admin [List](https://marmelab.com/react-admin/List.html), `<ListGuesser>` displays a list of resources in a [Datagrid](https://marmelab.com/react-admin/List.html#the-datagrid-component), according to children passed to it (usually [FieldGuesser](components.md#fieldguesser) or any [field component](https://marmelab.com/react-admin/Fields.html#basic-fields)
87
88
available in React Admin).
88
89
89
90
Use `hasShow` and `hasEdit` props if you want to display `show` and `edit` buttons (both set to `true` by default).
90
91
91
-
By default, `<ListGuesser>` comes with [<Pagination>](components.md#pagination).
92
+
By default, `<ListGuesser>` comes with [Pagination](components.md#pagination).
| resource | string | - | yes | endpoint of the resource |
115
116
| filters | element | - | no | filters that can be applied to the list |
116
117
117
-
You can also use props accepted by React Admin [<List>](https://marmelab.com/react-admin/List.html).
118
+
You can also use props accepted by React Admin [List](https://marmelab.com/react-admin/List.html).
118
119
119
120
### CreateGuesser
120
121
121
-
Displays a creation page for a single item. Uses React Admin [<Create>](https://marmelab.com/react-admin/CreateEdit.html) and [<SimpleForm>](https://marmelab.com/react-admin/CreateEdit.html#the-simpleform-component) components.
122
-
For simple inputs, you can pass as children API Platform Admin [<InputGuesser>](components.md#inputguesser), or any React Admin [Input components](https://marmelab.com/react-admin/Inputs.html#input-components) for more complex inputs.
122
+
Displays a creation page for a single item. Uses React Admin [Create](https://marmelab.com/react-admin/CreateEdit.html) and [SimpleForm](https://marmelab.com/react-admin/CreateEdit.html#the-simpleform-component) components.
123
+
For simple inputs, you can pass as children API Platform Admin [InputGuesser](components.md#inputguesser), or any React Admin [Input components](https://marmelab.com/react-admin/Inputs.html#input-components) for more complex inputs.
| resource | string | - | yes | endpoint of the resource |
145
146
146
-
You can also use props accepted by React Admin [<Create>](https://marmelab.com/react-admin/CreateEdit.html).
147
+
You can also use props accepted by React Admin [Create](https://marmelab.com/react-admin/CreateEdit.html).
147
148
148
149
### EditGuesser
149
150
150
-
Displays an edition page for a single item. Uses React Admin [<Edit>](https://marmelab.com/react-admin/CreateEdit.html) and [<SimpleForm>](https://marmelab.com/react-admin/CreateEdit.html#the-simpleform-component) components.
151
-
For simple inputs, you can use API Platform Admin [<InputGuesser>](components.md#inputguesser), or any React Admin [Input components](https://marmelab.com/react-admin/Inputs.html#input-components) for more complex inputs.
151
+
Displays an edition page for a single item. Uses React Admin [Edit](https://marmelab.com/react-admin/CreateEdit.html) and [SimpleForm](https://marmelab.com/react-admin/CreateEdit.html#the-simpleform-component) components.
152
+
For simple inputs, you can use API Platform Admin [InputGuesser](components.md#inputguesser), or any React Admin [Input components](https://marmelab.com/react-admin/Inputs.html#input-components) for more complex inputs.
| resource | string | - | yes | endpoint of the resource |
174
175
175
-
You can also use props accepted by React Admin [<Edit>](https://marmelab.com/react-admin/CreateEdit.html).
176
+
You can also use props accepted by React Admin [Edit](https://marmelab.com/react-admin/CreateEdit.html).
176
177
177
178
### ShowGuesser
178
179
179
-
Displays a detailed page for one item. Based on React Admin [<Show> component](https://marmelab.com/react-admin/Show.html). You can pass [<FieldGuesser>](components.md#fieldguesser) as children for simple fields, or use any of React Admin [basic fields](https://marmelab.com/react-admin/Fields.html#basic-fields) for more complex fields.
180
+
Displays a detailed page for one item. Based on React Admin [Show component](https://marmelab.com/react-admin/Show.html). You can pass [FieldGuesser](components.md#fieldguesser) as children for simple fields, or use any of React Admin [basic fields](https://marmelab.com/react-admin/Fields.html#basic-fields) for more complex fields.
| resource | string | - | yes | endpoint of the resource |
202
203
203
-
You can also use props accepted by React Admin [<Show> component](https://marmelab.com/react-admin/Show.html).
204
+
You can also use props accepted by React Admin [Show component](https://marmelab.com/react-admin/Show.html).
204
205
205
206
## Hydra
206
207
207
208
### HydraAdmin
208
209
209
-
Creates a complete Admin, as [`<AdminGuesser>`](components.md#adminguesser), but configured specially for [Hydra](https://www.hydra-cg.com/). If you want to use other formats (see supported formats: `@api-platform/api-doc-parser`) use [<AdminGuesser>](components.md#adminguesser) instead.
210
+
Creates a complete Admin, as [AdminGuesser](components.md#adminguesser), but configured specially for [Hydra](https://www.hydra-cg.com/).
211
+
If you want to use other formats (see supported formats: `@api-platform/api-doc-parser`) use [AdminGuesser](components.md#adminguesser) instead.
| entrypoint | string | - | yes | entrypoint of the API |
237
+
| mercure | boolean|object | * | yes | configuration to use Mercure |
238
+
239
+
\*`false` to explicitly disable, `true` to enable with default parameters or an object with the following properties:
240
+
-`hub`: the URL to your Mercure hub
241
+
-`jwt`: a subscriber JWT to access your Mercure hub
242
+
-`topicUrl`: the topic URL of your resources
234
243
235
244
### Data Provider
236
245
237
-
Based on React Admin `create`, `delete`, `getList`, `getManyReference`, `getOne`, `update` methods, the `dataProvider` is used by API Platform Admin to communicate with the API. In addition, the specific `introspect` method parses your API documentation.
246
+
Based on React Admin `create`, `delete`, `getList`, `getManyReference`, `getOne`, `update` methods, the `dataProvider` is used by API Platform Admin to communicate with the API.
247
+
In addition, the specific `introspect` method parses your API documentation.
238
248
Note that the `dataProvider` can be overridden to fit your API needs.
239
249
240
250
### Schema Analyzer
@@ -245,13 +255,15 @@ Analyses your resources and retrieves their types according to the [Schema.org](
245
255
246
256
### Pagination
247
257
248
-
Set by default in the [<ListGuesser> component](components.md#listguesser), the `Pagination` component uses React Admin [<Pagination> component](https://marmelab.com/react-admin/List.html#pagination).
249
-
By default, it renders 30 items per page and displays a navigation UI. If you want to change the number of items per page or disable the pagination, see the [Pagination documentation](../core/pagination.md).
258
+
Set by default in the [ListGuesser component](components.md#listguesser), the `Pagination` component uses React Admin [Pagination component](https://marmelab.com/react-admin/List.html#pagination).
259
+
By default, it renders 30 items per page and displays a navigation UI.
260
+
If you want to change the number of items per page or disable the pagination, see the [Pagination documentation](../core/pagination.md).
250
261
It is also capable to handle partial pagination.
251
262
252
263
### FieldGuesser
253
264
254
-
Renders fields according to their types, using the [schema analyzer](components.md#schemaanalyzer). Based on React Admin [field components](https://marmelab.com/react-admin/Fields.html).
265
+
Renders fields according to their types, using the [schema analyzer](components.md#schemaanalyzer).
266
+
Based on React Admin [field components](https://marmelab.com/react-admin/Fields.html).
Copy file name to clipboardExpand all lines: admin/customizing.md
+8-13Lines changed: 8 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,19 +6,18 @@ To do so, you can use the React components provided by API Platform Admin itself
6
6
7
7
## Customizing the Admin's Main Page and the Resource List
8
8
9
-
By default, API Platform Admin automatically builds a tailored [`<Resource>` component](https://marmelab.com/react-admin/Resource.html) (and all its appropriate children) for each resource type exposed by a web API.
9
+
By default, API Platform Admin automatically builds a tailored [Resource component](https://marmelab.com/react-admin/Resource.html) (and all its appropriate children) for each resource type exposed by a web API.
10
10
Under the hood it uses the `@api-platform/api-doc-parser` library to parse the API documentation. The API documentation can use Hydra, OpenAPI and any other format supported by the library.
11
11
Resources are listed in the order they appear in the machine-readable documentation.
12
12
13
13
However, it's also possible to display only specific resources, and to order them, while still benefiting from all discovery features provided by API Platform Admin.
14
14
To cherry-pick the resources to make available through the admin, pass a list of `<ResourceGuesser>` components as children of the root component:
Instead of using the `<ResourceGuesser>` component provided by API Platform Admin, you can also pass custom React Admin's [`<Resource>` components](https://marmelab.com/react-admin/Resource.html), or any other React components that are supported by React Admin's [`<Admin>`](https://marmelab.com/react-admin/Admin.html).
30
+
Instead of using the `<ResourceGuesser>` component provided by API Platform Admin, you can also pass custom React Admin's [Resource components](https://marmelab.com/react-admin/Resource.html), or any other React components that are supported by React Admin's [Admin](https://marmelab.com/react-admin/Admin.html).
32
31
33
32
## Customizing the List View
34
33
35
34
The list view can be customized following the same pattern:
@@ -183,6 +178,6 @@ For instance, using an autocomplete input is straightforward, [checkout the dedi
183
178
## Going Further
184
179
185
180
API Platform is built on top of [React Admin](https://marmelab.com/react-admin/).
186
-
You can use all the features provided by the underlying library with API Platform Admin, including support for [file upload](https://marmelab.com/react-admin/DataProviders.html#decorating-your-data-provider-example-of-file-upload), [authentication](https://marmelab.com/react-admin/Authentication.html), [authorization](https://marmelab.com/react-admin/Authorization.html) and deeper customization.
181
+
You can use all the features provided by the underlying library with API Platform Admin, including support for [authentication](https://marmelab.com/react-admin/Authentication.html), [authorization](https://marmelab.com/react-admin/Authorization.html) and deeper customization.
187
182
188
183
To learn more about these capabilities, refer to [the React Admin documentation](https://marmelab.com/react-admin/).
0 commit comments