build: use pnpm workspace
[e-mobility-charging-stations-simulator.git] / ui / web / README.md
CommitLineData
32de5a57
LM
1# Web UI
2
98262391 3The Web UI code and configuration is in the repository directory [ui/web](./../../ui/web/). Commands execution is relative to that directory.
603f3fdd 4
32de5a57
LM
5## Project setup
6
217db058
JB
7### Configuration
8
9#### Simulator UI Server Configuration
10
11The simulator UI server must be enabled, use WebSocket transport type and have authentication disabled. The simulator main configuration file should have a `uiServer` section like this:
8228f972
JB
12
13```json
14 "uiServer": {
15 "enabled": true,
16 "type": "ws",
17 "authentication": {
329eab0e
JB
18 "enabled": true,
19 "type": "protocol-basic-auth",
8228f972
JB
20 "username": "admin",
21 "password": "admin"
22 }
23 },
24```
25
b4c9f3c1 26See [here](./../../README.md#charging-stations-simulator-configuration) for more details.
8228f972 27
217db058
JB
28#### Web UI configuration
29
f80e9e18 30Copy the configuration template [src/assets/config-template.json](./src/assets/config-template.json) to `public/config.json`.
217db058 31
4b08c55e
JB
32##### Unique UI server:
33
34```json
35{
36 "uiServer": {
37 "host": "localhost",
38 "port": 8080,
39 "protocol": "ui",
40 "version": "0.0.1",
41 "authentication": {
42 "enabled": true,
43 "type": "protocol-basic-auth",
44 "username": "admin",
45 "password": "admin"
46 }
47 }
48}
49```
50
51##### Multiple UI servers:
52
53```json
54{
55 "uiServer": [
56 {
57 "host": "server1.domain.tld",
58 "port": 8080,
59 "protocol": "ui",
60 "version": "0.0.1",
61 "authentication": {
62 "enabled": true,
63 "type": "protocol-basic-auth",
64 "username": "admin",
65 "password": "admin"
66 }
67 },
68 ...
69 {
70 "host": "serverN.domain.tld",
71 "port": 8080,
72 "protocol": "ui",
73 "version": "0.0.1",
74 "authentication": {
75 "enabled": true,
76 "type": "protocol-basic-auth",
77 "username": "admin",
78 "password": "admin"
79 }
80 }
81 ]
82}
83```
84
32de5a57
LM
85### Run
86
0d7042e2 87#### Compiles for production and preview locally
217db058
JB
88
89```shell
90pnpm preview
91```
92
d07e35d2
MK
93#### Try it out
94
0d7042e2 95You can now follow the link displayed in the terminal. The Web UI looks like the following:
d07e35d2 96
9d76f5ec 97![webui](./src/assets/webui.png)
d07e35d2 98
4b08c55e
JB
991. With the buttons on the top you can change UI server, start/stop the simulator, add new charging stations and refresh the content.
1002. Each charging station is a row in the table with specific 'Actions' to execute on. Try 'Stop Charging Station' and refresh with the large blue button and see the status 'Started' turns from 'Yes' into 'No'.
32de5a57 101
217db058
JB
102### Development
103
104#### Compiles and run for development
32de5a57 105
d6b76da3 106```shell
217db058
JB
107pnpm dev
108```
109
110#### Formats files
111
112```shell
113pnpm format
32de5a57
LM
114```
115
217db058 116#### Lints and fixes files
32de5a57 117
d6b76da3 118```shell
217db058 119pnpm lint:fix
32de5a57 120```