+ <Container
+ v-show="Array.isArray(uiServerConfigurations) && uiServerConfigurations.length > 1"
+ id="ui-server-container"
+ >
+ <select
+ id="ui-server-selector"
+ v-model="state.uiServerIndex"
+ @change="
+ () => {
+ try {
+ if (
+ getFromLocalStorage<number>('uiServerConfigurationIndex', 0) !== state.uiServerIndex
+ ) {
+ setToLocalStorage<number>('uiServerConfigurationIndex', state.uiServerIndex)
+ 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')
+ console.error('Error at changing UI server configuration:', error)
+ }
+ }
+ "
+ >
+ <option
+ v-for="uiServerConfiguration in uiServerConfigurations"
+ :value="uiServerConfiguration.index"
+ >
+ {{ uiServerConfiguration.configuration.name ?? uiServerConfiguration.configuration.host }}
+ </option>
+ </select>
+ </Container>