Commit | Line | Data |
---|---|---|
32de5a57 LM |
1 | # Web UI |
2 | ||
98262391 | 3 | The 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 | ### Dependencies |
8 | ||
d6b76da3 | 9 | ```shell |
603f1011 | 10 | corepack enable |
1a662d29 | 11 | corepack prepare pnpm@latest --activate |
603f1011 | 12 | pnpm install |
32de5a57 LM |
13 | ``` |
14 | ||
217db058 JB |
15 | ### Configuration |
16 | ||
17 | #### Simulator UI Server Configuration | |
18 | ||
19 | The 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 |
20 | |
21 | ```json | |
22 | "uiServer": { | |
23 | "enabled": true, | |
24 | "type": "ws", | |
25 | "authentication": { | |
26 | "enabled": false, | |
27 | "type": "basic-auth", | |
28 | "username": "admin", | |
29 | "password": "admin" | |
30 | } | |
31 | }, | |
32 | ``` | |
33 | ||
b4c9f3c1 | 34 | See [here](./../../README.md#charging-stations-simulator-configuration) for more details. |
8228f972 | 35 | |
217db058 JB |
36 | #### Web UI configuration |
37 | ||
45a98393 | 38 | Copy the configuration template [src/assets/config-template.ts](src/assets/config-template.ts) to `src/assets/config.ts`. |
217db058 | 39 | |
32de5a57 LM |
40 | ### Run |
41 | ||
217db058 | 42 | #### Compiles for production |
32de5a57 | 43 | |
d6b76da3 | 44 | ```shell |
217db058 | 45 | pnpm build |
32de5a57 LM |
46 | ``` |
47 | ||
217db058 JB |
48 | #### Compiles and preview locally for production |
49 | ||
50 | ```shell | |
51 | pnpm preview | |
52 | ``` | |
53 | ||
54 | #### Compiles and run for production | |
32de5a57 | 55 | |
d6b76da3 | 56 | ```shell |
217db058 | 57 | pnpm start |
32de5a57 | 58 | ``` |
bbe10d5f | 59 | |
d07e35d2 MK |
60 | #### Try it out |
61 | ||
62 | For both options above you can then follow the link displayed in the terminal at the end of compilation. The Web UI looks like the following | |
63 | ||
64 | ![webui](./assets/webui.png) | |
65 | ||
66 | 1. With the top 2 buttons you can now stop and afterwards start the simulator and inspect the server console for the number of charging stations, e.g. with the default configuration: `Charging stations simulator ... started with 10 charging station(s)` | |
67 | 2. Each charging station is a row in the table below, try "Stop Charging Station" and refresh with the large blue button and see the status Started turns from Yes into No. | |
32de5a57 | 68 | |
217db058 JB |
69 | ### Development |
70 | ||
71 | #### Compiles and run for development | |
32de5a57 | 72 | |
d6b76da3 | 73 | ```shell |
217db058 JB |
74 | pnpm dev |
75 | ``` | |
76 | ||
77 | #### Formats files | |
78 | ||
79 | ```shell | |
80 | pnpm format | |
32de5a57 LM |
81 | ``` |
82 | ||
217db058 | 83 | #### Lints and fixes files |
32de5a57 | 84 | |
d6b76da3 | 85 | ```shell |
217db058 | 86 | pnpm lint:fix |
32de5a57 | 87 | ``` |