Skip to content

os2display/display-admin-client

Repository files navigation

OS2Display Admin

This is an admin for OS2Display. This is based on create-react-app. See https://github.com/os2display/display-docs/blob/main/admin.md for a description of the admin.

Docker development setup

Create public/config file

By default the api that is requested is located at /api/. This can be configured by:

cp public/example_config.json public/config.json

And modify the entries to suit your setup.

{
  "api": "[WHERE TO FIND THE API]"
}

Create public/access-config file

This file contains the access config. This file is only required if other access setting are required than what is default.

cp public/example-access-config.json public/access-config.json

Up the containers

docker compose up --detach

Install npm packages

docker compose run --rm node yarn install

Note: When to node container is running, the JavaScript is continously being built.

Redux Toolkit

The communication with the API is generated from an OpenAPI specification with Redux Toolkit.

To regenerate (when the API specification has changed):

# Action: Replace api.json with the new api.json OpenAPI specification

# Install and run scripts to generate ned Redux Api slices.
docker compose exec node npm --prefix src/redux/api install
docker compose exec node npm --prefix src/redux/api start

Testing with cypress

We use cypress for testing.

To run cypress tests in the cypress container:

docker compose run --rm cypress run

Linting

docker compose run --rm node yarn check-coding-standards
docker compose run --rm node yarn apply-coding-standards