README.md 1.78 KB
Newer Older
markchkhotua's avatar
markchkhotua committed
1
2
3
4
# Genesys Catalog UI

React application.

Matija Obreza's avatar
Matija Obreza committed
5
6
# Run with Docker

7
8
Pick an image from [Docker image registry](https://gitlab.croptrust.org/genesys-pgr/catalog/genesys-catalog-ui/container_registry).

Matija Obreza's avatar
Matija Obreza committed
9
10
```bash
docker run -it \
Matija Obreza's avatar
Matija Obreza committed
11
12
  -e CLIENT_ID=... \
  -e CLIENT_SECRET=... \
Matija Obreza's avatar
Matija Obreza committed
13
14
  -e CATALOG_API_URL=https://api.catalog.demo.genesys-pgr.org \
 dockerhub.croptrust.org/genesys-pgr/catalog/genesys-catalog-ui:1.9
Matija Obreza's avatar
Matija Obreza committed
15
16
```

Matija Obreza's avatar
Matija Obreza committed
17
18
You may need to obtain `CLIENT_ID` and `CLIENT_SECRET` from helpdesk@genesys-pgr.org.

19
20
Also inspect the Docker [swarm compose file](docker/review-compose-template.yml) that we use for CI.

markchkhotua's avatar
markchkhotua committed
21
22
23
24
# Development

This project uses npm, gulp and webpack to package the React TypeScript application.

25
26
Optional params supported:

Matija Obreza's avatar
Matija Obreza committed
27
`CLIENT_SECRET` - ui app secret used for OAuth 2 authentication in java server
28

Matija Obreza's avatar
Matija Obreza committed
29
`CLIENT_ID` - ui app id used for OAuth 2 authentication in java server
30

Matija Obreza's avatar
Matija Obreza committed
31
`CATALOG_API_URL` - url to java server
32

Matija Obreza's avatar
Matija Obreza committed
33
~~`googleClientId` - id of google project, used for OAuth authentication with Google.~~
34

Matija Obreza's avatar
Matija Obreza committed
35
~~Google api for configure projects: <https://console.developers.google.com>~~
36

markchkhotua's avatar
markchkhotua committed
37
38
39
To start a live-reload server and work on the application, run:

```bash
Matija Obreza's avatar
Matija Obreza committed
40
npm run serve
markchkhotua's avatar
markchkhotua committed
41
42
43
44
45
46
47
48
49
50
```

This starts the _webpack-dev-server_ on port 3000:

- <http://localhost:3000/webpack-dev-server/>
- <http://localhost:3000/>

Pack the React application for production and test server-side loading (run express server):

```bash
Matija Obreza's avatar
Matija Obreza committed
51
npm run serve:ssr
markchkhotua's avatar
markchkhotua committed
52
```
Matija Obreza's avatar
Matija Obreza committed
53

54
Example of using optional params:
markchkhotua's avatar
markchkhotua committed
55

56
```bash
Matija Obreza's avatar
Matija Obreza committed
57
CLIENT_ID=client-id CLIENT_SECRET=client-secret CATALOG_API_URL=http://localhost:8080 npm run serve
58
```
markchkhotua's avatar
markchkhotua committed
59
60
61
62
63

## Documentation

We rely on the following libraries to make things work:

64
- Material UI: <https://material-ui-1dab0.firebaseapp.com/>
markchkhotua's avatar
markchkhotua committed
65
66
- Material Icons: <https://material.io/icons/>
- Immutability helpers: <https://github.com/kolodny/immutability-helper>