From: Jérôme Benoit Date: Sun, 18 Feb 2024 13:27:59 +0000 (+0100) Subject: feat(ui): prefer arrow functions X-Git-Tag: v1.2.37~12 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=fa5d129a53f8b3d30685c017fa0420da66224ed5;p=e-mobility-charging-stations-simulator.git feat(ui): prefer arrow functions Signed-off-by: Jérôme Benoit --- diff --git a/ui/web/src/components/charging-stations/CSConnector.vue b/ui/web/src/components/charging-stations/CSConnector.vue index 8b577f58..e0b62e4f 100644 --- a/ui/web/src/components/charging-stations/CSConnector.vue +++ b/ui/web/src/components/charging-stations/CSConnector.vue @@ -43,7 +43,7 @@ const uiClient = getCurrentInstance()?.appContext.config.globalProperties.$uiCli const $toast = useToast() -function stopTransaction(): void { +const stopTransaction = (): void => { uiClient .stopTransaction(props.hashId, props.connector.transactionId) .then(() => { @@ -54,7 +54,7 @@ function stopTransaction(): void { console.error('Error at stopping transaction:', error) }) } -function startAutomaticTransactionGenerator(): void { +const startAutomaticTransactionGenerator = (): void => { uiClient .startAutomaticTransactionGenerator(props.hashId, props.connectorId) .then(() => { @@ -65,7 +65,7 @@ function startAutomaticTransactionGenerator(): void { console.error('Error at starting automatic transaction generator:', error) }) } -function stopAutomaticTransactionGenerator(): void { +const stopAutomaticTransactionGenerator = (): void => { uiClient .stopAutomaticTransactionGenerator(props.hashId, props.connectorId) .then(() => { diff --git a/ui/web/src/components/charging-stations/CSData.vue b/ui/web/src/components/charging-stations/CSData.vue index 423014bd..300cfa44 100644 --- a/ui/web/src/components/charging-stations/CSData.vue +++ b/ui/web/src/components/charging-stations/CSData.vue @@ -76,7 +76,7 @@ const props = defineProps<{ chargingStation: ChargingStationData }>() -function getConnectors(): ConnectorStatus[] { +const getConnectors = (): ConnectorStatus[] => { if (Array.isArray(props.chargingStation.evses) && props.chargingStation.evses.length > 0) { const connectorsStatus: ConnectorStatus[] = [] for (const [evseId, evseStatus] of props.chargingStation.evses.entries()) { @@ -90,15 +90,15 @@ function getConnectors(): ConnectorStatus[] { } return props.chargingStation.connectors?.slice(1) } -function getATGStatus(connectorId: number): Status | undefined { +const getATGStatus = (connectorId: number): Status | undefined => { return props.chargingStation.automaticTransactionGenerator ?.automaticTransactionGeneratorStatuses?.[connectorId - 1] } -function getSupervisionUrl(): string { +const getSupervisionUrl = (): string => { const supervisionUrl = new URL(props.chargingStation.supervisionUrl) return `${supervisionUrl.protocol}//${supervisionUrl.host.split('.').join('.\u200b')}` } -function getWsState(): string { +const getWsState = (): string => { switch (props.chargingStation?.wsState) { case WebSocket.CONNECTING: return 'Connecting' @@ -117,7 +117,7 @@ const uiClient = getCurrentInstance()?.appContext.config.globalProperties.$uiCli const $toast = useToast() -function startChargingStation(): void { +const startChargingStation = (): void => { uiClient .startChargingStation(props.chargingStation.stationInfo.hashId) .then(() => { @@ -128,7 +128,7 @@ function startChargingStation(): void { console.error('Error at starting charging station', error) }) } -function stopChargingStation(): void { +const stopChargingStation = (): void => { uiClient .stopChargingStation(props.chargingStation.stationInfo.hashId) .then(() => { @@ -139,7 +139,7 @@ function stopChargingStation(): void { console.error('Error at stopping charging station', error) }) } -function openConnection(): void { +const openConnection = (): void => { uiClient .openConnection(props.chargingStation.stationInfo.hashId) .then(() => { @@ -150,7 +150,7 @@ function openConnection(): void { console.error('Error at opening connection', error) }) } -function closeConnection(): void { +const closeConnection = (): void => { uiClient .closeConnection(props.chargingStation.stationInfo.hashId) .then(() => { @@ -161,7 +161,7 @@ function closeConnection(): void { console.error('Error at closing connection', error) }) } -function deleteChargingStation(): void { +const deleteChargingStation = (): void => { uiClient .deleteChargingStation(props.chargingStation.stationInfo.hashId) .then(() => { diff --git a/ui/web/src/views/ChargingStationsView.vue b/ui/web/src/views/ChargingStationsView.vue index b8a719b7..3549ec7c 100644 --- a/ui/web/src/views/ChargingStationsView.vue +++ b/ui/web/src/views/ChargingStationsView.vue @@ -34,7 +34,7 @@ const uiClient = app?.appContext.config.globalProperties.$uiClient const $toast = useToast() -function loadChargingStations(reloadCallback?: () => void): void { +const loadChargingStations = (reloadCallback?: () => void): void => { if (state.isLoading === false) { state.isLoading = true uiClient @@ -57,7 +57,7 @@ function loadChargingStations(reloadCallback?: () => void): void { } } -function startSimulator(): void { +const startSimulator = (): void => { uiClient .startSimulator() .then(() => { @@ -68,7 +68,7 @@ function startSimulator(): void { console.error('Error at starting simulator:', error) }) } -function stopSimulator(): void { +const stopSimulator = (): void => { uiClient .stopSimulator() .then(() => {