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()" />
10 getCurrentInstance()?.appContext.config.globalProperties.$chargingStations ?? []
16 <script setup lang="ts">
17 import { getCurrentInstance, reactive } from 'vue'
18 import CSTable from '@/components/charging-stations/CSTable.vue'
19 import type { ResponsePayload } from '@/types'
20 import Container from '@/components/Container.vue'
21 import ReloadButton from '@/components/buttons/ReloadButton.vue'
22 import Button from '@/components/buttons/Button.vue'
24 const state = reactive({
28 const app = getCurrentInstance()
29 const uiClient = app?.appContext.config.globalProperties.$uiClient
31 function loadChargingStations(): void {
32 if (state.isLoading === false) {
33 state.isLoading = true
35 .listChargingStations()
36 .then((response: ResponsePayload) => {
38 app.appContext.config.globalProperties.$chargingStations = response.chargingStations
41 .catch((error: Error) => {
42 // TODO: add code for UI notifications or other error handling logic
43 console.error('Error at fetching charging stations:', error)
46 state.isLoading = false
51 function startSimulator(): void {
52 uiClient.startSimulator()
54 function stopSimulator(): void {
55 uiClient.stopSimulator()
64 flex-direction: column;
75 background-color: blue;
79 justify-content: center;
82 #reload-button:hover {
83 background-color: rgb(0, 0, 225);
86 #reload-button:active {
87 background-color: red;