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
Copy file name to clipboardExpand all lines: OVERVIEW.md
+73-18Lines changed: 73 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,26 +6,26 @@ This overview includes information about the following:
6
6
- The Material-UI library and its integration in react-admin.
7
7
- Guidelines for developing a react-admin application.
8
8
9
-
## Overview of the React-Admin Framework
9
+
## Overview of the React-admin Framework
10
10
11
11
> This section provides an overview of the react-admin application structure, describes the key directories, and their content.
12
12
13
-
The Layer7 API Hub library is based on top of [react-admin](https://marmelab.com/react-admin). It's a frontend framework for building admin applications running in the browser, on top of REST/GraphQL APIs, using ES6, React, and Material Design. React-admin is open-sourced and maintained by [Marmelab](https://marmelab.com).
13
+
The Layer7 API Hub library is a front-end framework for building admin applications running in the browser, on top of REST/GraphQL APIs, using ES6, React, and Material Design. It is based on top of [react-admin](https://marmelab.com/react-admin). [Marmelab](https://marmelab.com) open sources and maintains react-admin.
14
14
15
15
The best way to start with API Hub is to walk through [the react-admin tutorial](https://marmelab.com/react-admin/Tutorial.html). This tutorial is a 30-minute step-by-step walkthrough of how to build a react-admin application.
16
16
17
17
Useful links:
18
18
19
19
-[React-admin documentation](https://marmelab.com/react-admin/Readme.html): Contains documentation and tutorials to help you get started.
20
-
-[Open-source code on GitHub](https://github.com/marmelab/react-admin): To go deeper, you can read the code source. Everything is public.
21
-
-[Report issues on GitHub](https://github.com/marmelab/react-admin/issues): Report bugs in the react-admin repository.
22
-
-[React-admin community on StackOverflow](http://stackoverflow.com/questions/tagged/react-admin): Ask "How To" questions, get usage advice, or troubleshoot your own code.
20
+
-[React-admin open-source code on GitHub](https://github.com/marmelab/react-admin): To go deeper, you can read the code source. Everything is public.
21
+
-[Report react-admin issues on GitHub](https://github.com/marmelab/react-admin/issues): Report bugs in the React Admin repository.
22
+
-[React-admin community on StackOverflow](http://stackoverflow.com/questions/tagged/react-admin): Ask "How To" questions, get react-admin usage advice, or troubleshoot your own code.
23
23
24
-
The following sections are based on the [simple example](https://github.com/marmelab/react-admin/tree/master/examples/simple) in the react-admin repository.
24
+
The following sections are based on the [react-admin Simple Example](https://github.com/marmelab/react-admin/tree/master/examples/simple) in the react-admin repository.
25
25
26
26
### Application Structure
27
27
28
-
The following structure is a simplified version of the Simple example:
28
+
The following structure is a simplified version of the Simple Example:
The Layer7 API Hub library provides a built-in authentication provider. Implement it if you have a special authentication strategy. For more information about how to implement the built-in authentication provider, see the [the react-admin Authentication Documentation](https://marmelab.com/react-admin/Authentication.html).
194
+
Implement the Layer7 API Hub library if you have a special authentication strategy.
195
+
196
+
For more information about how to implement the built-in authentication provider, see the [the react-admin authentication provider documentation](https://marmelab.com/react-admin/Authentication.html).
194
197
195
198
### The i18n Provider
196
199
197
-
The i18n provider is a dedicated built-in provider that manages the translations. It is based on [Polyglot.js](https://airbnb.io/polyglot.js/). The Layer7 API Hub library provides translations for English (default), Spanish, French, and Italian.
200
+
The i18n provider is a dedicated built-in provider that manages the translations. It is based on [Polyglot.js](https://airbnb.io/polyglot.js/). The Layer7 API Hub library provides translations for English (default), Spanish, and French.
198
201
199
-
**Tip**: For support of other languages, see [the list of available locales](https://marmelab.com/react-admin/Translation.html#available-locales).
202
+
For more information about the other languages that you can add, see [available locales](https://marmelab.com/react-admin/Translation.html#available-locales).
> This section provides an overview of the Material-UI library.
260
263
261
-
The react-admin front-end framework relies on [Material-UI](https://material-ui.com), a library of components. Material-UI is an implementation for React of the [material design](https://material.io/design). When designing interfaces in react-admin applications, we recommend that you reference the [the Material Design guidelines](https://material.io/design).
264
+
The Layer7 API Hub library react-admin front-end framework relies on [Material-UI](https://material-ui.com). Material-UI is a library of components and an implementation for React of the [material design](https://material.io/design). When designing interfaces in react-admin applications, we recommend that you reference the [the Material Design guidelines](https://material.io/design).
262
265
263
266
### Material-UI Components
264
267
265
268
React-admin uses Material-UI components internally. But sometimes you need to use these components directly. For example, when you are composing a custom interface.
266
269
267
-
For more information about how to use Material-UI, see [the Material-UI documentation](https://material-ui.com).
270
+
For more information about how to use Material-UI, see [the Material-UI documentation](https://material-ui.com/getting-started/usage/).
268
271
269
272
The following example builds a custom <Button /> that display a loader when saving:
270
273
@@ -316,7 +319,7 @@ export function CustomButton(props) {
316
319
317
320
### Material-UI Icons
318
321
319
-
You can use the Material-UI icons as components, and you can customize them. For more information about these icons, see [the Material-UI library](https://material-ui.com/components/material-icons).
322
+
You can use the [Material-UI icons](https://material-ui.com/components/material-icons) as components, and you can customize them:
@@ -329,6 +332,7 @@ import { Save as SaveIcon } from '@material-ui/icons';
329
332
You can customize the [Material-UI theme](https://material-ui.com/customization/theming) by overriding the [default theme](https://material-ui.com/customization/default-theme).
330
333
331
334
In react-admin, pass the theme to the <Admin /> component:
335
+
332
336
```js
333
337
// Admin.js
334
338
import { defaultTheme } from'react-admin';
@@ -355,6 +359,57 @@ export function ApiHubAdmin() {
355
359
}
356
360
```
357
361
358
-
## Guidelines for Developing a React-Admin Application
362
+
The theme can be much more than that. Most components, either from material-ui, react-admin, or Layer7 API Hub, have a *stylesheet* name. This name follows a convention:
363
+
364
+
-`Mui[ComponentName]` for MaterialUI components
365
+
-`Ra[ComponentName]` for react-admin components
366
+
-`Layer7[ComponentName]` for Layer7 API Hub components
367
+
368
+
The theme can contain an [`overrides`](https://material-ui.com/customization/components/#global-theme-override) object with overrides for those components.
369
+
370
+
For example, the Healthcare app overrides many components like this:
## Guidelines for Developing a React-admin Application
409
+
410
+
When developing custom react-admin components, you might have to deal with errors. The react-admin default components automatically handle data provider errors. You can also handle errors and react to them (notifications, etc.) using the following custom data provider hooks:
If you are concerned about performances related to querying your API too much, you might want to take advantage of react-admin built in caching capabilities. For more information, see [the react-admin Caching documentation](https://marmelab.com/react-admin/Caching.html).
Copy file name to clipboardExpand all lines: README.md
+50-32Lines changed: 50 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,83 +4,99 @@
4
4
5
5
## Packages Directory
6
6
7
-
> This section provides an overview of the react-admin application structure, describes the key directories, and their content. The packages directory includes the following libraries and apps.
7
+
> This section provides an overview of the react-admin application structure, describes the key directories, and the content of these directories. The packages directory includes the following libraries and apps.
8
8
9
9
### Layer7 API Hub Library
10
10
11
-
For more information about the Layer7 API Hub library, see [the README](./packages/layer7-apihub/README.md):
11
+
[The Layer7 API Hub libraryREADME](./packages/layer7-apihub/README.md) includes the following information:
-[Add additional language support](./packages/layer7-apihub/README.md##add-additional-language-support)
17
15
18
16
### Example App
19
17
20
-
The Example app has the same source code as the standard API Hub.
18
+
The Example app has the same source code as the standard API Hub.[The Example app README](./packages/example/README.md) includes the following information:
21
19
22
-
For more information about the Example app, see [the Example App README](./packages/example/README.md):
23
-
24
-
-[Change the configuration](./packages/example/README.md##change-the-configuration)
20
+
-[Configure the Example app](./packages/example/README.md##configure-the-example-app)
25
21
-[Change the page title](./packages/example/README.md##change-the-page-title)
26
-
-[Connect to Portal API (PAPI) or use the Layer7 API Hub mock server](./packages/example/README.md##connecting-to-portal-apis-or-using-the-mock-server)
27
-
-[Host the app on another domain](./packages/example/README.md##host-the-app-on-another-domain)
-[Make calls to the Layer7 API Hub Mock Server or Portal API (PAPI)](./packages/example/README.md##make-calls-to-the-layer7-api-hub-mock-server-or-portal-api-papi)
23
+
-[Host the Example app on another domain](./packages/example/README.md##host-the-example-app-on-another-domain)
29
24
-[Auto-detect the API Hub URL](./packages/example/README.md##auto-detect-the-api-hub-url)
[The Healthcare app](./packages/healthcare/README.md) demonstrates a possible customized variation of API Hub with a Healthcare theme. It includes the same developer features as the Example app. It further extends the API Hub to include custom pages and additional calls (PAPI and Portal Metrics API). You use this app with the mock server.
30
+
31
+
The Healthcare app README includes the following information:
-[Customize API Hub mock server](./packages/layer7-apihub-mock/README.md##customize-API-hub-mock-server)
42
+
-[Customize the mock server](./packages/layer7-apihub-mock/README.md##customize-the-mock-server)
38
43
39
44
### Cypress End-To-End Testing
40
45
41
-
For more information about end-to-end testing, see [the Cypress README](./cypress/README.md).
46
+
The end-to-end (E2E) tests are for the Example app.
42
47
43
-
## Development
48
+
For more information about this testing, see [the Cypress - End-To-End Testing README](./cypress/README.md).
49
+
50
+
## Quick Start
51
+
52
+
Use the following commands to set up you local development environment.
44
53
45
54
**Prerequisites:**
46
55
56
+
Before setting up your local development environment, ensure that you have completed the following:
47
57
- You have installed [Yarn](https://yarnpkg.com/).
48
58
- You have installed Make.
49
59
50
-
**Tip:** You can install the dependencies by issuing the following command:
60
+
### Install the JavaScript Dependencies
61
+
62
+
Install the JavaScript dependencies by issuing the following command:
51
63
52
64
```sh
53
65
make install
54
66
```
55
-
## Start the Application
67
+
### Start an App
68
+
69
+
Start the Example app or the Healthcare app in watch mode.
56
70
57
-
Start the application in watch mode by issuing the following command:
71
+
To start the **Example app**, issue the following command:
58
72
59
73
```sh
60
74
make start
61
75
```
62
76
63
-
## Run the Tests
77
+
To start the **Healthcare app**, issue the following command:
64
78
65
-
Run the unit tests and the end-to-end (E2E) tests by issuing the following command:
79
+
```sh
80
+
make start-healthcare
81
+
```
66
82
67
-
```sh
83
+
### Run the Tests
84
+
85
+
Run the unit tests and the E2E tests by issuing the following command:
86
+
87
+
```
68
88
make test
69
89
```
70
90
71
-
### Unit Tests
91
+
####Unit Tests
72
92
73
93
Run only the unit tests by issuing the following command:
74
94
75
95
```sh
76
96
make test-unit
77
97
```
78
98
79
-
### End-To-End Tests
80
-
81
-
The E2E tests are based on the Example app. For more information about this package, see [Example app](./packages/example).
82
-
83
-
**Prerequisite:** You have a running instance of the Example app at <https://localhost:3000>. For more information, see ([Host the Example app on another domain](./packages/example/README.md##host-the-app-on-another-domain)).
99
+
#### End-To-End Tests
84
100
85
101
Run only the E2E tests:
86
102
@@ -94,9 +110,9 @@ Open the E2E tests GUI (useful for writing and debugging E2E tests):
94
110
make test-e2e-local
95
111
```
96
112
97
-
## Deploy the Example API Hub
113
+
## Deploy the Example App
98
114
99
-
Build the Layer7 API Hub library, build the Example app, and copy the production configuration by issuing the following commands:
115
+
Build the API Hub library, the Example app, and then copy the production configuration by issuing the following commands:
100
116
101
117
```sh
102
118
make build
@@ -109,3 +125,5 @@ Copy the contents of the `packages/example/build` directory to your favorite web
109
125
```sh
110
126
docker run --name APIHub -v `pwd`/packages/example/build:/usr/share/nginx/html:ro -p 8888:80 nginx
0 commit comments