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,
56 @clicked="$emit('need-refresh')"
60 <Button @click="openConnection()">
63 <Button @click="closeConnection()">
66 <Button @click="deleteChargingStation()">
67 Delete Charging Station
70 <td class="cs-table__connectors-column">
71 <table id="connectors-table">
73 <thead id="connectors-table__head">
74 <tr class="connectors-table__row">
76 class="connectors-table__column"
82 class="connectors-table__column"
88 class="connectors-table__column"
94 class="connectors-table__column"
100 class="connectors-table__column"
107 <tbody id="connectors-table__body">
109 v-for="(connector, index) in getConnectorStatuses()"
111 :atg-status="getATGStatus(index + 1)"
112 :charging-station-id="chargingStation.stationInfo.chargingStationId"
113 :connector="connector"
114 :connector-id="index + 1"
115 :hash-id="chargingStation.stationInfo.hashId"
116 @need-refresh="$emit('need-refresh')"
124 <script setup lang="ts">
125 import { useToast } from 'vue-toast-notification'
127 import type { ChargingStationData, ConnectorStatus, Status } from '@/types'
129 import Button from '@/components/buttons/Button.vue'
130 import ToggleButton from '@/components/buttons/ToggleButton.vue'
131 import CSConnector from '@/components/charging-stations/CSConnector.vue'
132 import { deleteFromLocalStorage, getLocalStorage, useUIClient } from '@/composables'
134 const props = defineProps<{
135 chargingStation: ChargingStationData
138 const $emit = defineEmits(['need-refresh'])
140 const getConnectorStatuses = (): ConnectorStatus[] => {
141 if (Array.isArray(props.chargingStation.evses) && props.chargingStation.evses.length > 0) {
142 const connectorStatuses: ConnectorStatus[] = []
143 for (const [evseId, evseStatus] of props.chargingStation.evses.entries()) {
144 if (evseId > 0 && Array.isArray(evseStatus.connectors) && evseStatus.connectors.length > 0) {
145 for (const connectorStatus of evseStatus.connectors) {
146 connectorStatuses.push(connectorStatus)
150 return connectorStatuses
152 return props.chargingStation.connectors?.slice(1)
154 const getATGStatus = (connectorId: number): Status | undefined => {
155 return props.chargingStation.automaticTransactionGenerator
156 ?.automaticTransactionGeneratorStatuses?.[connectorId - 1]
158 const getSupervisionUrl = (): string => {
159 const supervisionUrl = new URL(props.chargingStation.supervisionUrl)
160 return `${supervisionUrl.protocol}//${supervisionUrl.host.split('.').join('.\u200b')}`
162 const getWSState = (): string => {
163 switch (props.chargingStation?.wsState) {
164 case WebSocket.CLOSED:
166 case WebSocket.CLOSING:
168 case WebSocket.CONNECTING:
177 const uiClient = useUIClient()
179 const $toast = useToast()
181 const startChargingStation = (): void => {
183 .startChargingStation(props.chargingStation.stationInfo.hashId)
185 return $toast.success('Charging station successfully started')
187 .catch((error: Error) => {
188 $toast.error('Error at starting charging station')
189 console.error('Error at starting charging station:', error)
192 const stopChargingStation = (): void => {
194 .stopChargingStation(props.chargingStation.stationInfo.hashId)
196 return $toast.success('Charging station successfully stopped')
198 .catch((error: Error) => {
199 $toast.error('Error at stopping charging station')
200 console.error('Error at stopping charging station:', error)
203 const openConnection = (): void => {
205 .openConnection(props.chargingStation.stationInfo.hashId)
207 return $toast.success('Connection successfully opened')
209 .catch((error: Error) => {
210 $toast.error('Error at opening connection')
211 console.error('Error at opening connection:', error)
214 const closeConnection = (): void => {
216 .closeConnection(props.chargingStation.stationInfo.hashId)
218 return $toast.success('Connection successfully closed')
220 .catch((error: Error) => {
221 $toast.error('Error at closing connection')
222 console.error('Error at closing connection:', error)
225 const deleteChargingStation = (): void => {
227 .deleteChargingStation(props.chargingStation.stationInfo.hashId)
229 for (const key in getLocalStorage()) {
230 if (key.includes(props.chargingStation.stationInfo.hashId)) {
231 deleteFromLocalStorage(key)
234 return $toast.success('Charging station successfully deleted')
236 .catch((error: Error) => {
237 $toast.error('Error at deleting charging station')
238 console.error('Error at deleting charging station:', error)
246 flex-direction: column;
247 background-color: white;
248 overflow: auto hidden;
249 border-collapse: collapse;
253 #connectors-table__body {
255 flex-direction: column;
258 .connectors-table__row {
261 justify-content: center;
263 border: solid 0.25px black;
266 .connectors-table__row:nth-of-type(even) {
267 background-color: whitesmoke;
270 #connectors-table__head .connectors-table__row {
271 background-color: lightgrey;
274 .connectors-table__column {
275 width: calc(100% / 5);
277 flex-direction: column;