if (
getFromLocalStorage<number>('uiServerConfigurationIndex', 0) !== state.uiServerIndex
) {
- $uiClient.setConfiguration($configuration.value.uiServer[state.uiServerIndex])
+ $uiClient.setConfiguration(
+ ($configuration.value.uiServer as UIServerConfigurationSection[])[
+ state.uiServerIndex
+ ]
+ )
registerWSEventListeners()
$uiClient.registerWSEventListener(
'open',
0
)
$uiClient.setConfiguration(
- $configuration.value.uiServer[
+ ($configuration.value.uiServer as UIServerConfigurationSection[])[
getFromLocalStorage<number>('uiServerConfigurationIndex', 0)
]
)
>
<option
v-for="uiServerConfiguration in uiServerConfigurations"
+ :key="uiServerConfiguration.index"
:value="uiServerConfiguration.index"
>
{{
<script setup lang="ts">
import { computed, getCurrentInstance, onMounted, onUnmounted, ref, watch } from 'vue'
import { useToast } from 'vue-toast-notification'
+
+import ReloadButton from '@/components/buttons/ReloadButton.vue'
+import ToggleButton from '@/components/buttons/ToggleButton.vue'
import CSTable from '@/components/charging-stations/CSTable.vue'
-import type { ResponsePayload, SimulatorState, UIServerConfigurationSection } from '@/types'
import Container from '@/components/Container.vue'
-import ReloadButton from '@/components/buttons/ReloadButton.vue'
import {
deleteFromLocalStorage,
getFromLocalStorage,
setToLocalStorage,
useUIClient
} from '@/composables'
-import ToggleButton from '@/components/buttons/ToggleButton.vue'
+import type {
+ ChargingStationData,
+ ResponsePayload,
+ SimulatorState,
+ UIServerConfigurationSection
+} from '@/types'
const simulatorState = ref<SimulatorState | undefined>(undefined)
const app = getCurrentInstance()
-watch(app?.appContext.config.globalProperties.$chargingStations, () => {
+watch(app!.appContext.config.globalProperties.$chargingStations, () => {
state.value.renderChargingStations = randomUUID()
})
.listTemplates()
.then((response: ResponsePayload) => {
if (app != null) {
- app.appContext.config.globalProperties.$templates.value = response.templates
+ app.appContext.config.globalProperties.$templates.value = response.templates as string[]
}
})
.catch((error: Error) => {
.listChargingStations()
.then((response: ResponsePayload) => {
if (app != null) {
- app.appContext.config.globalProperties.$chargingStations.value = response.chargingStations
+ app.appContext.config.globalProperties.$chargingStations.value =
+ response.chargingStations as ChargingStationData[]
}
})
.catch((error: Error) => {
unregisterWSEventListeners()
})
-const uiServerConfigurations: { index: number; configuration: UIServerConfigurationSection }[] =
- app?.appContext.config.globalProperties.$configuration.value.uiServer.map(
- (configuration: UIServerConfigurationSection, index: number) => ({
- index,
- configuration
- })
- )
+const uiServerConfigurations: { index: number; configuration: UIServerConfigurationSection }[] = (
+ app?.appContext.config.globalProperties.$configuration.value
+ .uiServer as UIServerConfigurationSection[]
+).map((configuration: UIServerConfigurationSection, index: number) => ({
+ index,
+ configuration
+}))
const startSimulator = (): void => {
uiClient
#buttons-container {
display: flex;
flex-direction: row;
+ position: sticky;
+ top: 0;
}
.simulator-start-button {
#reload-button {
color: ivory;
background-color: blue;
- font-size: 2rem;
+ font-size: 1.5rem;
}
#reload-button:hover {