2 <Container id="charging-stations">
3 <Container id="buttons-container">
4 <Button id="simulator-button" @click="startSimulator()">Start Simulator</Button>
5 <Button id="simulator-button" @click="stopSimulator()">Stop Simulator</Button>
6 <ReloadButton id="reload-button" :loading="state.isLoading" @click="load()" />
8 <Container id="inputs-container">
14 placeholder="RFID tag"
17 <CSTable :charging-stations="state.chargingStations" :id-tag="state.idTag" />
21 <script setup lang="ts">
22 import { getCurrentInstance, onMounted, reactive } from 'vue'
23 import CSTable from '@/components/charging-stations/CSTable.vue'
24 import type { ChargingStationData } from '@/types'
25 import Container from '@/components/Container.vue'
26 import ReloadButton from '@/components/buttons/ReloadButton.vue'
27 import Button from '@/components/buttons/Button.vue'
29 const UIClient = getCurrentInstance()?.appContext.config.globalProperties.$UIClient
32 UIClient.registerWSonOpenListener(load)
37 chargingStations: ChargingStationData[]
41 const state: State = reactive({
47 async function load(): Promise<void> {
48 if (state.isLoading === false) {
49 state.isLoading = true
50 state.chargingStations = (await UIClient.listChargingStations())
51 .chargingStations as ChargingStationData[]
52 state.isLoading = false
56 function startSimulator(): void {
57 UIClient.startSimulator()
59 function stopSimulator(): void {
60 UIClient.stopSimulator()
69 flex-direction: column;
85 background-color: blue;
91 #reload-button:hover {
92 background-color: rgb(0, 0, 225);
95 #reload-button:active {
96 background-color: red;