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="loadChargingStations()" />
8 <Container id="inputs-container">
14 placeholder="RFID tag"
19 getCurrentInstance()?.appContext.config.globalProperties.$chargingStations ?? []
26 <script setup lang="ts">
27 import { getCurrentInstance, reactive } from 'vue'
28 import CSTable from '@/components/charging-stations/CSTable.vue'
29 import type { ResponsePayload } from '@/types'
30 import Container from '@/components/Container.vue'
31 import ReloadButton from '@/components/buttons/ReloadButton.vue'
32 import Button from '@/components/buttons/Button.vue'
34 const state = reactive({
39 const app = getCurrentInstance()
40 const uiClient = app?.appContext.config.globalProperties.$uiClient
42 function loadChargingStations(): void {
43 if (state.isLoading === false) {
44 state.isLoading = true
46 .listChargingStations()
47 .then((response: ResponsePayload) => {
49 app.appContext.config.globalProperties.$chargingStations = response.chargingStations
52 .catch((error: Error) => {
53 console.error('Error at fetching charging stations:', error)
56 state.isLoading = false
61 function startSimulator(): void {
62 uiClient.startSimulator()
64 function stopSimulator(): void {
65 uiClient.stopSimulator()
74 flex-direction: column;
90 background-color: blue;
94 justify-content: center;
97 #reload-button:hover {
98 background-color: rgb(0, 0, 225);
101 #reload-button:active {
102 background-color: red;