Skip to content

Commit 5b6140a

Browse files
authored
Merge pull request #2 from CAAPIM/4.5.3-release
Release version 4.5.3
2 parents 6c455d8 + 39ec494 commit 5b6140a

304 files changed

Lines changed: 34697 additions & 194473 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ yarn-error.log*
2828

2929
# config
3030
packages/example/public/config.js
31+
packages/healthcare/public/config.js
3132

3233
# cypress
3334
cypress/screenshots

.travis.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ script: make test
2828

2929
stages:
3030
- name: test
31-
- name: deploy
3231
if: branch = master
3332

3433
jobs:
@@ -38,17 +37,3 @@ jobs:
3837
env:
3938
- DEPLOY_ENV=test
4039
- NODE_ENV=test
41-
- stage: deploy
42-
name: Deploy
43-
env:
44-
- DEPLOY_ENV=integration
45-
- NODE_ENV=production
46-
install: NODE_ENV=development make install # Install development dependencies
47-
script: skip
48-
before_deploy:
49-
- pip install --user awscli
50-
- export PATH=$PATH:$HOME/.local/bin
51-
deploy:
52-
skip_cleanup: true
53-
provider: script
54-
script: make deploy

Makefile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ help:
1111
install: package.json ## Install dependencies
1212
@yarn
1313

14-
copy-config-example: ## Copy config of the example. Usage DEPLOY_ENV=[dev|integration|staging] make copy-config-example.
14+
copy-config-example: ## Copy config of the example. Usage DEPLOY_ENV=[dev|integration|layer7] make copy-config-example.
1515
cp packages/example/config/config-${DEPLOY_ENV}.js packages/example/public/config.js
1616

17+
copy-config-healthcare: ## Copy config of the healthcare. Usage DEPLOY_ENV=[dev|integration|layer7] make copy-config-healthcare.
18+
cp packages/healthcare/config/config-${DEPLOY_ENV}.js packages/healthcare/public/config.js
19+
1720
generate-mock-data: ## Generate new data for the mock server. Usage OUTPUT_FILE=my-file.json make generate-mock-data. OUTPUT_FILE is optionnal.
1821
./packages/layer7-apihub-mock/bin/generateData.js ${OUTPUT_FILE}
1922

@@ -25,6 +28,9 @@ build: ## Build the library
2528
build-example: ## Build the example
2629
@yarn build-example
2730

31+
build-healthcare: ## Build the healthcare
32+
@yarn build-healthcare
33+
2834
build-storybook: ## Build the storybook
2935
@yarn build-storybook
3036

@@ -34,6 +40,9 @@ build-storybook: ## Build the storybook
3440
start: copy-config-example build ## Starts the application in development mode
3541
@yarn start-example
3642

43+
start-healthcare: copy-config-healthcare build ## Starts the application in development mode
44+
@yarn start-healthcare
45+
3746
watch-lib: ## Starts the library in development mode
3847
@yarn start-lib
3948

@@ -59,8 +68,3 @@ test-e2e-local: ## Opens the end-to-end tests GUI. Usage make test-e2e-local.
5968
lint: ## Runs linting tools
6069
@yarn lint
6170

62-
63-
#### Deployment ####
64-
65-
copy-deploy-config-example: ## Copy config of the example. Usage DEPLOY_ENV=[dev|integration|staging] make copy-deploy-config-example.
66-
cp packages/example/config/config-${DEPLOY_ENV}.js packages/example/build/config.js

OVERVIEW.md

Lines changed: 73 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@ This overview includes information about the following:
66
- The Material-UI library and its integration in react-admin.
77
- Guidelines for developing a react-admin application.
88

9-
## Overview of the React-Admin Framework
9+
## Overview of the React-admin Framework
1010

1111
> This section provides an overview of the react-admin application structure, describes the key directories, and their content.
1212
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.
1414

1515
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.
1616

1717
Useful links:
1818

1919
- [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.
2323

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.
2525

2626
### Application Structure
2727

28-
The following structure is a simplified version of the Simple example:
28+
The following structure is a simplified version of the Simple Example:
2929

3030
- /src
3131
- /posts
@@ -131,7 +131,7 @@ export default apiUrl => {
131131
json: { uuid, ...data },
132132
} = await fetchUtils.fetchJson(url, { credentials: 'include' });
133133

134-
// React-Admin needs an id instead of an uuid.
134+
// React Admin needs an id instead of an uuid.
135135
// So the getOne method makes the transformation
136136
return {
137137
data: {
@@ -154,9 +154,10 @@ export default apiUrl => {
154154
};
155155
```
156156

157-
The Layer 7 API Hub library provides a built-in data provider that works with the API Portal.
157+
The Layer 7 API Hub library provides a built-in data provider that works with API Portal.
158+
159+
**Tip:** Consider using [the pre-built react-admin data providers](https://marmelab.com/react-admin/DataProviders.html#available-providers).
158160

159-
**Tip:** Consider using [the pre-built data providers](https://marmelab.com/react-admin/DataProviders.html#available-providers).
160161

161162
### The Authentication Provider
162163

@@ -190,13 +191,15 @@ export const authProvider = {
190191
};
191192
```
192193

193-
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).
194197

195198
### The i18n Provider
196199

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.
198201

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).
200203

201204
The i18n provider uses the following format:
202205

@@ -258,13 +261,13 @@ export const frenchMessages = mergeTranslations(raFrenchMessages, {
258261

259262
> This section provides an overview of the Material-UI library.
260263
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).
262265

263266
### Material-UI Components
264267

265268
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.
266269

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/).
268271

269272
The following example builds a custom <Button /> that display a loader when saving:
270273

@@ -316,7 +319,7 @@ export function CustomButton(props) {
316319

317320
### Material-UI Icons
318321

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:
320323

321324
``` js
322325
import { Save as SaveIcon } from '@material-ui/icons';
@@ -329,6 +332,7 @@ import { Save as SaveIcon } from '@material-ui/icons';
329332
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).
330333

331334
In react-admin, pass the theme to the <Admin /> component:
335+
332336
``` js
333337
// Admin.js
334338
import { defaultTheme } from 'react-admin';
@@ -355,6 +359,57 @@ export function ApiHubAdmin() {
355359
}
356360
```
357361

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:
371+
372+
```js
373+
const theme = {
374+
// ...Theme Design Tokens (palette, etc.)
375+
overrides: {
376+
// Overrides Material UI AppBar styles
377+
MuiAppBar: {
378+
root: {
379+
paddingTop: defaultMuiTheme.spacing(1),
380+
paddingBottom: defaultMuiTheme.spacing(1),
381+
background: `linear-gradient(127deg, #10054d, #33065b);`,
382+
},
383+
},
384+
// Overrides React Admin Sidebar styles
385+
RaSidebar: {
386+
drawerPaper: {
387+
backgroundColor: palette.common.white,
388+
color: palette.primary.main,
389+
marginTop: '0.5rem !important',
390+
height: `calc(100% - 0.5rem)`,
391+
boxShadow: `2px 0px 1px -1px rgba(0,0,0,0.2),
392+
1px 0px 3px 0px rgba(0,0,0,0.1)`,
393+
},
394+
},
395+
// Overrides Layer7 ApiHub CardGrid styles
396+
Layer7CardGrid: {
397+
root: {
398+
marginTop: '0px',
399+
marginRight: '0px',
400+
marginBottom: '0px',
401+
marginLeft: '0px',
402+
// },
403+
},
404+
}
405+
}
406+
```
407+
408+
## 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:
411+
412+
- [useDataProvider Hook](https://marmelab.com/react-admin/Actions.html#usedataprovider-hook).
413+
- [Specialized Hooks](https://marmelab.com/react-admin/Actions.html#specialized-hooks).
359414
360-
// TODO
415+
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).

README.md

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,83 +4,99 @@
44

55
## Packages Directory
66

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.
88
99
### Layer7 API Hub Library
1010

11-
For more information about the Layer7 API Hub library, see [the README](./packages/layer7-apihub/README.md):
11+
[The Layer7 API Hub library README](./packages/layer7-apihub/README.md) includes the following information:
1212

13-
- [Add custom pages](./packages/layer7-apihub/README.md##add-a-pages)
14-
- [Change the styles](./packages/layer7-apihub/README.md##how-to-change-the-styles)
15-
- [Add additional language support](./packages/layer7-apihub/README.md##how-to-add-additional-language-support)
16-
- [Catch and display PAPI errors](./packages/layer7-apihub/README.md##How-to-catch-and-display-papi-errors)
13+
- [Add pages](./packages/layer7-apihub/README.md##add-a-pages)
14+
- [Add additional language support](./packages/layer7-apihub/README.md##add-additional-language-support)
1715

1816
### Example App
1917

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:
2119

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)
2521
- [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)
28-
- [Enable HTTPS](./packages/example/README.md##enable-https)
22+
- [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)
2924
- [Auto-detect the API Hub URL](./packages/example/README.md##auto-detect-the-api-hub-url)
25+
- [Customization Tutorials](./packages/example/README.md##customization-tutorials)
26+
27+
### Healthcare App
28+
29+
[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:
32+
33+
- [Available users](./packages/healthcare/README.md##available-users)
34+
- [Customize the Healthcare app](./packages/layer7-apihub-mock/README.md##customize-the-healthcare-app)
3035

3136
### Layer7 API Hub Mock Server
3237

33-
For more information about the API Hub mock server, see [the Layer7 API Hub Mock Server Package README](./packages/layer7-apihub-mock/README.md):
38+
[The Layer7 API Hub mock server README](./packages/layer7-apihub-mock/README.md) includes the following information:
3439

35-
- [Use the mock server in your application](./packages/layer7-apihub-mock/README.md##How-to-use-it-in-your-application)
40+
- [Start the mock server in your client application](./packages/layer7-apihub-mock/README.md##start-the-cock-server-in-your-client-application)
3641
- [Available users](./packages/layer7-apihub-mock/README.md##available-users)
37-
- [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)
3843

3944
### Cypress End-To-End Testing
4045

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.
4247

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.
4453

4554
**Prerequisites:**
4655

56+
Before setting up your local development environment, ensure that you have completed the following:
4757
- You have installed [Yarn](https://yarnpkg.com/).
4858
- You have installed Make.
4959

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:
5163

5264
```sh
5365
make install
5466
```
55-
## Start the Application
67+
### Start an App
68+
69+
Start the Example app or the Healthcare app in watch mode.
5670

57-
Start the application in watch mode by issuing the following command:
71+
To start the **Example app**, issue the following command:
5872

5973
```sh
6074
make start
6175
```
6276

63-
## Run the Tests
77+
To start the **Healthcare app**, issue the following command:
6478

65-
Run the unit tests and the end-to-end (E2E) tests by issuing the following command:
79+
```sh
80+
make start-healthcare
81+
```
6682

67-
``` sh
83+
### Run the Tests
84+
85+
Run the unit tests and the E2E tests by issuing the following command:
86+
87+
```
6888
make test
6989
```
7090

71-
### Unit Tests
91+
#### Unit Tests
7292

7393
Run only the unit tests by issuing the following command:
7494

7595
``` sh
7696
make test-unit
7797
```
7898

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
84100

85101
Run only the E2E tests:
86102

@@ -94,9 +110,9 @@ Open the E2E tests GUI (useful for writing and debugging E2E tests):
94110
make test-e2e-local
95111
```
96112

97-
## Deploy the Example API Hub
113+
## Deploy the Example App
98114

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:
100116

101117
```sh
102118
make build
@@ -109,3 +125,5 @@ Copy the contents of the `packages/example/build` directory to your favorite web
109125
```sh
110126
docker run --name APIHub -v `pwd`/packages/example/build:/usr/share/nginx/html:ro -p 8888:80 nginx
111127
```
128+
129+

cypress/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Cypress - End-To-End Testing
22

3-
The E2E tests use the [Cypress](https://www.cypress.io) testing framework. These tests are for the [Example Application](../packages/example).
3+
The E2E tests use the [Cypress](https://www.cypress.io) testing framework. These tests are for the [Example App](../packages/example).
44

55
If you create a new application, create your own E2E tests.

0 commit comments

Comments
 (0)