| 1 | # Web UI |
| 2 | |
| 3 | The Web UI code and configuration is in the repository directory [ui/web](./../../ui/web/). Commands execution is relative to that directory. |
| 4 | |
| 5 | ## Project setup |
| 6 | |
| 7 | ```shell |
| 8 | corepack enable |
| 9 | corepack prepare pnpm@latest --activate |
| 10 | pnpm install |
| 11 | ``` |
| 12 | |
| 13 | The simulator UI server must be enabled, use WebSocket and disable authentication. The simulator main configuration file should have a `uiServer` section like this: |
| 14 | |
| 15 | ```json |
| 16 | "uiServer": { |
| 17 | "enabled": true, |
| 18 | "type": "ws", |
| 19 | "authentication": { |
| 20 | "enabled": false, |
| 21 | "type": "basic-auth", |
| 22 | "username": "admin", |
| 23 | "password": "admin" |
| 24 | } |
| 25 | }, |
| 26 | ``` |
| 27 | |
| 28 | See [here](./../../README.md#charging-stations-simulator-configuration) for more details. |
| 29 | |
| 30 | ### Run |
| 31 | |
| 32 | #### Compiles and run for production |
| 33 | |
| 34 | ```shell |
| 35 | pnpm start |
| 36 | ``` |
| 37 | |
| 38 | #### Compiles and run for development |
| 39 | |
| 40 | ```shell |
| 41 | pnpm serve |
| 42 | ``` |
| 43 | |
| 44 | #### Try it out |
| 45 | |
| 46 | 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 |
| 47 | |
| 48 | ![webui](./assets/webui.png) |
| 49 | |
| 50 | 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)` |
| 51 | 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. |
| 52 | |
| 53 | ### Compiles and minifies for production |
| 54 | |
| 55 | ```shell |
| 56 | pnpm build |
| 57 | ``` |
| 58 | |
| 59 | ### Lints files |
| 60 | |
| 61 | ```shell |
| 62 | pnpm lint |
| 63 | ``` |