2 <tr class="cs-table__row">
3 <td class="cs-table__column">
4 {{ chargingStation.stationInfo.chargingStationId }}
6 <td class="cs-table__column">{{ chargingStation.started === true ? 'Yes' : 'No' }}</td>
7 <td class="cs-table__column">
8 {{ getSupervisionUrl() }}
10 <td class="cs-table__column">{{ getWSState() }}</td>
11 <td class="cs-table__column">
12 {{ chargingStation.bootNotificationResponse?.status ?? 'Ø' }}
14 <td class="cs-table__column">
15 {{ chargingStation.stationInfo.templateName }}
17 <td class="cs-table__column">{{ chargingStation.stationInfo.chargePointVendor }}</td>
18 <td class="cs-table__column">{{ chargingStation.stationInfo.chargePointModel }}</td>
19 <td class="cs-table__column">
20 {{ chargingStation.stationInfo.firmwareVersion ?? 'Ø' }}
22 <td class="cs-table__column">
23 <Button @click="startChargingStation()">Start Charging Station</Button>
24 <Button @click="stopChargingStation()">Stop Charging Station</Button>
26 :id="`${chargingStation.stationInfo.hashId}-set-supervision-url`"
31 name: 'set-supervision-url',
33 hashId: chargingStation.stationInfo.hashId,
34 chargingStationId: chargingStation.stationInfo.chargingStationId
41 $router.push({ name: 'charging-stations' })
52 <Button @click="openConnection()">Open Connection</Button>
53 <Button @click="closeConnection()">Close Connection</Button>
54 <Button @click="deleteChargingStation()">Delete Charging Station</Button>
56 <td class="cs-table__connectors-column">
57 <table id="connectors-table">
59 <thead id="connectors-table__head">
60 <tr class="connectors-table__row">
61 <th scope="col" class="connectors-table__column">Identifier</th>
62 <th scope="col" class="connectors-table__column">Status</th>
63 <th scope="col" class="connectors-table__column">Transaction</th>
64 <th scope="col" class="connectors-table__column">ATG Started</th>
65 <th scope="col" class="connectors-table__column">Actions</th>
68 <tbody id="connectors-table__body">
70 v-for="(connector, index) in getConnectorStatuses()"
72 :hash-id="chargingStation.stationInfo.hashId"
73 :charging-station-id="chargingStation.stationInfo.chargingStationId"
74 :connector-id="index + 1"
75 :connector="connector"
76 :atg-status="getATGStatus(index + 1)"
77 @need-refresh="$emit('need-refresh')"
85 <script setup lang="ts">
86 import { useToast } from 'vue-toast-notification'
88 import Button from '@/components/buttons/Button.vue'
89 import ToggleButton from '@/components/buttons/ToggleButton.vue'
90 import CSConnector from '@/components/charging-stations/CSConnector.vue'
91 import { useUIClient } from '@/composables'
92 import type { ChargingStationData, ConnectorStatus, Status } from '@/types'
94 const props = defineProps<{
95 chargingStation: ChargingStationData
98 const $emit = defineEmits(['need-refresh'])
100 const getConnectorStatuses = (): ConnectorStatus[] => {
101 if (Array.isArray(props.chargingStation.evses) && props.chargingStation.evses.length > 0) {
102 const connectorStatuses: ConnectorStatus[] = []
103 for (const [evseId, evseStatus] of props.chargingStation.evses.entries()) {
104 if (evseId > 0 && Array.isArray(evseStatus.connectors) && evseStatus.connectors.length > 0) {
105 for (const connectorStatus of evseStatus.connectors) {
106 connectorStatuses.push(connectorStatus)
110 return connectorStatuses
112 return props.chargingStation.connectors?.slice(1)
114 const getATGStatus = (connectorId: number): Status | undefined => {
115 return props.chargingStation.automaticTransactionGenerator
116 ?.automaticTransactionGeneratorStatuses?.[connectorId - 1]
118 const getSupervisionUrl = (): string => {
119 const supervisionUrl = new URL(props.chargingStation.supervisionUrl)
120 return `${supervisionUrl.protocol}//${supervisionUrl.host.split('.').join('.\u200b')}`
122 const getWSState = (): string => {
123 switch (props.chargingStation?.wsState) {
124 case WebSocket.CONNECTING:
128 case WebSocket.CLOSING:
130 case WebSocket.CLOSED:
137 const uiClient = useUIClient()
139 const $toast = useToast()
141 const startChargingStation = (): void => {
143 .startChargingStation(props.chargingStation.stationInfo.hashId)
145 $toast.success('Charging station successfully started')
147 .catch((error: Error) => {
148 $toast.error('Error at starting charging station')
149 console.error('Error at starting charging station:', error)
152 const stopChargingStation = (): void => {
154 .stopChargingStation(props.chargingStation.stationInfo.hashId)
156 $toast.success('Charging station successfully stopped')
158 .catch((error: Error) => {
159 $toast.error('Error at stopping charging station')
160 console.error('Error at stopping charging station:', error)
163 const openConnection = (): void => {
165 .openConnection(props.chargingStation.stationInfo.hashId)
167 $toast.success('Connection successfully opened')
169 .catch((error: Error) => {
170 $toast.error('Error at opening connection')
171 console.error('Error at opening connection:', error)
174 const closeConnection = (): void => {
176 .closeConnection(props.chargingStation.stationInfo.hashId)
178 $toast.success('Connection successfully closed')
180 .catch((error: Error) => {
181 $toast.error('Error at closing connection')
182 console.error('Error at closing connection:', error)
185 const deleteChargingStation = (): void => {
187 .deleteChargingStation(props.chargingStation.stationInfo.hashId)
189 $toast.success('Charging station successfully deleted')
191 .catch((error: Error) => {
192 $toast.error('Error at deleting charging station')
193 console.error('Error at deleting charging station:', error)
201 flex-direction: column;
202 background-color: white;
203 overflow: auto hidden;
204 border-collapse: collapse;
208 #connectors-table__body {
210 flex-direction: column;
213 .connectors-table__row {
216 justify-content: center;
218 border: solid 0.25px black;
221 .connectors-table__row:nth-of-type(even) {
222 background-color: whitesmoke;
225 #connectors-table__head .connectors-table__row {
226 background-color: lightgrey;
229 .connectors-table__column {
230 width: calc(100% / 5);
232 flex-direction: column;