fix(ui): ensure the charging stations list re-rendered after UI server
[e-mobility-charging-stations-simulator.git] / ui / web / src / components / charging-stations / CSData.vue
index 423014bdae8b9e27ae6c92e3a4d93f8da468fcfb..2462e6d6172daeba545bbec7f03add81eae16bf2 100644 (file)
@@ -7,7 +7,7 @@
     <td class="cs-table__column">
       {{ getSupervisionUrl() }}
     </td>
-    <td class="cs-table__column">{{ getWsState() }}</td>
+    <td class="cs-table__column">{{ getWSState() }}</td>
     <td class="cs-table__column">
       {{ props.chargingStation?.bootNotificationResponse?.status ?? 'Ø' }}
     </td>
             }
           })
         "
-        >Set Supervision Url</Button
       >
+        Set Supervision Url
+      </Button>
       <Button @click="openConnection()">Open Connection</Button>
       <Button @click="closeConnection()">Close Connection</Button>
       <Button @click="deleteChargingStation()">Delete Charging Station</Button>
     </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>
@@ -52,7 +54,7 @@
         <tbody id="connectors-table__body">
           <!-- eslint-disable-next-line vue/valid-v-for -->
           <CSConnector
-            v-for="(connector, index) in getConnectors()"
+            v-for="(connector, index) in getConnectorStatuses()"
             :hash-id="props.chargingStation.stationInfo.hashId"
             :charging-station-id="props.chargingStation.stationInfo.chargingStationId"
             :connector-id="index + 1"
@@ -76,29 +78,29 @@ const props = defineProps<{
   chargingStation: ChargingStationData
 }>()
 
-function getConnectors(): ConnectorStatus[] {
+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)
 }
-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 +119,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 +130,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 +141,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 +152,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 +163,7 @@ function closeConnection(): void {
       console.error('Error at closing connection', error)
     })
 }
-function deleteChargingStation(): void {
+const deleteChargingStation = (): void => {
   uiClient
     .deleteChargingStation(props.chargingStation.stationInfo.hashId)
     .then(() => {
@@ -194,6 +196,7 @@ function deleteChargingStation(): void {
   flex-direction: row;
   justify-content: center;
   align-items: center;
+  border: solid 0.25px black;
 }
 
 .connectors-table__row:nth-of-type(even) {