2 <tr class="cs-table__row">
3 <td class="cs-table__column">
4 {{ chargingStation.stationInfo.chargingStationId }}
6 <td class="cs-table__column">
7 {{ chargingStation.started === true ? 'Yes' : 'No' }}
9 <td class="cs-table__column">
10 {{ getSupervisionUrl() }}
12 <td class="cs-table__column">
15 <td class="cs-table__column">
16 {{ chargingStation.bootNotificationResponse?.status ?? 'Ø' }}
18 <td class="cs-table__column">
19 {{ chargingStation.stationInfo.templateName }}
21 <td class="cs-table__column">
22 {{ chargingStation.stationInfo.chargePointVendor }}
24 <td class="cs-table__column">
25 {{ chargingStation.stationInfo.chargePointModel }}
27 <td class="cs-table__column">
28 {{ chargingStation.stationInfo.firmwareVersion ?? 'Ø' }}
30 <td class="cs-table__column">
31 <Button @click="startChargingStation()">
32 Start Charging Station
34 <Button @click="stopChargingStation()">
38 :id="`${chargingStation.stationInfo.hashId}-set-supervision-url`"
41 $router.push({ name: 'charging-stations' })
47 name: 'set-supervision-url',
49 hashId: chargingStation.stationInfo.hashId,
50 chargingStationId: chargingStation.stationInfo.chargingStationId,
64 <Button @click="openConnection()">
67 <Button @click="closeConnection()">
70 <Button @click="deleteChargingStation()">
71 Delete Charging Station
74 <td class="cs-table__connectors-column">
75 <table id="connectors-table">
77 <thead id="connectors-table__head">
78 <tr class="connectors-table__row">
80 class="connectors-table__column"
86 class="connectors-table__column"
92 class="connectors-table__column"
98 class="connectors-table__column"
104 class="connectors-table__column"
111 <tbody id="connectors-table__body">
113 v-for="(connector, index) in getConnectorStatuses()"
115 :atg-status="getATGStatus(index + 1)"
116 :charging-station-id="chargingStation.stationInfo.chargingStationId"
117 :connector="connector"
118 :connector-id="index + 1"
119 :hash-id="chargingStation.stationInfo.hashId"
120 @need-refresh="$emit('need-refresh')"
128 <script setup lang="ts">
129 import type { ChargingStationData, ConnectorStatus, Status } from '@/types'
131 import Button from '@/components/buttons/Button.vue'
132 import ToggleButton from '@/components/buttons/ToggleButton.vue'
133 import CSConnector from '@/components/charging-stations/CSConnector.vue'
134 import { useUIClient } from '@/composables'
135 import { useToast } from 'vue-toast-notification'
137 const props = defineProps<{
138 chargingStation: ChargingStationData
141 const $emit = defineEmits(['need-refresh'])
143 const getConnectorStatuses = (): ConnectorStatus[] => {
144 if (Array.isArray(props.chargingStation.evses) && props.chargingStation.evses.length > 0) {
145 const connectorStatuses: ConnectorStatus[] = []
146 for (const [evseId, evseStatus] of props.chargingStation.evses.entries()) {
147 if (evseId > 0 && Array.isArray(evseStatus.connectors) && evseStatus.connectors.length > 0) {
148 for (const connectorStatus of evseStatus.connectors) {
149 connectorStatuses.push(connectorStatus)
153 return connectorStatuses
155 return props.chargingStation.connectors?.slice(1)
157 const getATGStatus = (connectorId: number): Status | undefined => {
158 return props.chargingStation.automaticTransactionGenerator
159 ?.automaticTransactionGeneratorStatuses?.[connectorId - 1]
161 const getSupervisionUrl = (): string => {
162 const supervisionUrl = new URL(props.chargingStation.supervisionUrl)
163 return `${supervisionUrl.protocol}//${supervisionUrl.host.split('.').join('.\u200b')}`
165 const getWSState = (): string => {
166 switch (props.chargingStation?.wsState) {
167 case WebSocket.CONNECTING:
171 case WebSocket.CLOSING:
173 case WebSocket.CLOSED:
180 const uiClient = useUIClient()
182 const $toast = useToast()
184 const startChargingStation = (): void => {
186 .startChargingStation(props.chargingStation.stationInfo.hashId)
188 return $toast.success('Charging station successfully started')
190 .catch((error: Error) => {
191 $toast.error('Error at starting charging station')
192 console.error('Error at starting charging station:', error)
195 const stopChargingStation = (): void => {
197 .stopChargingStation(props.chargingStation.stationInfo.hashId)
199 return $toast.success('Charging station successfully stopped')
201 .catch((error: Error) => {
202 $toast.error('Error at stopping charging station')
203 console.error('Error at stopping charging station:', error)
206 const openConnection = (): void => {
208 .openConnection(props.chargingStation.stationInfo.hashId)
210 return $toast.success('Connection successfully opened')
212 .catch((error: Error) => {
213 $toast.error('Error at opening connection')
214 console.error('Error at opening connection:', error)
217 const closeConnection = (): void => {
219 .closeConnection(props.chargingStation.stationInfo.hashId)
221 return $toast.success('Connection successfully closed')
223 .catch((error: Error) => {
224 $toast.error('Error at closing connection')
225 console.error('Error at closing connection:', error)
228 const deleteChargingStation = (): void => {
230 .deleteChargingStation(props.chargingStation.stationInfo.hashId)
232 return $toast.success('Charging station successfully deleted')
234 .catch((error: Error) => {
235 $toast.error('Error at deleting charging station')
236 console.error('Error at deleting charging station:', error)
244 flex-direction: column;
245 background-color: white;
246 overflow: auto hidden;
247 border-collapse: collapse;
251 #connectors-table__body {
253 flex-direction: column;
256 .connectors-table__row {
259 justify-content: center;
261 border: solid 0.25px black;
264 .connectors-table__row:nth-of-type(even) {
265 background-color: whitesmoke;
268 #connectors-table__head .connectors-table__row {
269 background-color: lightgrey;
272 .connectors-table__column {
273 width: calc(100% / 5);
275 flex-direction: column;