</td>
<td class="cs-table__connectors-column">
<table id="connectors-table">
+ <caption></caption>
<thead id="connectors-table__head">
<tr class="connectors-table__row">
<th scope="col" class="connectors-table__column">Identifier</th>
public registerWSEventListener<K extends keyof WebSocketEventMap>(
event: K,
- listener: (event: WebSocketEventMap[K]) => void
+ listener: (event: WebSocketEventMap[K]) => void,
+ options?: boolean | AddEventListenerOptions
) {
- this.ws.addEventListener(event, listener)
+ this.ws.addEventListener(event, listener, options)
}
public async startSimulator(): Promise<ResponsePayload> {
getFromLocalStorage<number>('uiServerConfigurationIndex', 0)
]
)
- app.config.globalProperties.$uiClient.registerWSEventListener('open', () => {
- app.config.globalProperties.$uiClient
- .listChargingStations()
- .then((response: ResponsePayload) => {
- app.config.globalProperties.$chargingStations = response.chargingStations
- })
- .catch((error: Error) => {
- // TODO: add code for UI notifications or other error handling logic
- console.error('Error at fetching charging stations:', error)
- })
- .finally(() => {
- app.use(router).use(ToastPlugin).mount('#app')
- })
- })
+ app.config.globalProperties.$uiClient.registerWSEventListener(
+ 'open',
+ () => {
+ app.config.globalProperties.$uiClient
+ .listChargingStations()
+ .then((response: ResponsePayload) => {
+ app.config.globalProperties.$chargingStations = response.chargingStations
+ })
+ .catch((error: Error) => {
+ // TODO: add code for UI notifications or other error handling logic
+ console.error('Error at fetching charging stations:', error)
+ })
+ .finally(() => {
+ app.use(router).use(ToastPlugin).mount('#app')
+ })
+ },
+ { once: true }
+ )
}
}
getFromLocalStorage<number>('uiServerConfigurationIndex', 0) !== state.uiServerIndex
) {
setToLocalStorage<number>('uiServerConfigurationIndex', state.uiServerIndex)
- app!.appContext.config.globalProperties.$uiClient.setConfiguration(
+ app?.appContext.config.globalProperties.$uiClient.registerWSEventListener(
+ 'close',
+ () => {
+ app!.appContext.config.globalProperties.$chargingStations = []
+ },
+ { once: true }
+ )
+ app?.appContext.config.globalProperties.$uiClient.setConfiguration(
app?.appContext.config.globalProperties.$configuration.uiServer[
getFromLocalStorage<number>('uiServerConfigurationIndex', state.uiServerIndex)
]
)
+ app?.appContext.config.globalProperties.$uiClient.registerWSEventListener(
+ 'open',
+ () => {
+ loadChargingStations(() => (state.renderChargingStationsList = randomUUID()))
+ },
+ { once: true }
+ )
}
} catch (error) {
$toast.error('Error at changing UI server configuration')