From: Jérôme Benoit Date: Mon, 19 Feb 2024 19:59:35 +0000 (+0100) Subject: feat(ui): add helper to dynamically set configuration on UI client X-Git-Tag: v1.2.38~75 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a4baab6300ff8bd111e0915f860b1cb05bb594e9;p=e-mobility-charging-stations-simulator.git feat(ui): add helper to dynamically set configuration on UI client singleton Signed-off-by: Jérôme Benoit --- diff --git a/ui/web/src/components/charging-stations/CSData.vue b/ui/web/src/components/charging-stations/CSData.vue index b8808639..4cd878ba 100644 --- a/ui/web/src/components/charging-stations/CSData.vue +++ b/ui/web/src/components/charging-stations/CSData.vue @@ -79,15 +79,15 @@ const props = defineProps<{ const getConnectorStatuses = (): ConnectorStatus[] => { if (Array.isArray(props.chargingStation.evses) && props.chargingStation.evses.length > 0) { - const connectorsStatus: ConnectorStatus[] = [] + const connectorStatuses: ConnectorStatus[] = [] for (const [evseId, evseStatus] of props.chargingStation.evses.entries()) { if (evseId > 0 && Array.isArray(evseStatus.connectors) && evseStatus.connectors.length > 0) { for (const connectorStatus of evseStatus.connectors) { - connectorsStatus.push(connectorStatus) + connectorStatuses.push(connectorStatus) } } } - return connectorsStatus + return connectorStatuses } return props.chargingStation.connectors?.slice(1) } diff --git a/ui/web/src/composables/UIClient.ts b/ui/web/src/composables/UIClient.ts index 9a692041..c6e80946 100644 --- a/ui/web/src/composables/UIClient.ts +++ b/ui/web/src/composables/UIClient.ts @@ -33,6 +33,12 @@ export class UIClient { return UIClient.instance } + public setConfiguration(uiServerConfiguration: UIServerConfigurationSection): void { + this.ws.close() + this.uiServerConfiguration = uiServerConfiguration + this.openWS() + } + public registerWSEventListener( event: K, listener: (event: WebSocketEventMap[K]) => void