2 <tr class="cs-table__row">
3 <td class="cs-table__column">
4 {{ props.chargingStation.stationInfo.chargingStationId }}
6 <td class="cs-table__column">{{ props.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 {{ props.chargingStation?.bootNotificationResponse?.status ?? 'Ø' }}
14 <td class="cs-table__column">
15 {{ props.chargingStation.stationInfo.templateName }}
17 <td class="cs-table__column">{{ props.chargingStation.stationInfo.chargePointVendor }}</td>
18 <td class="cs-table__column">{{ props.chargingStation.stationInfo.chargePointModel }}</td>
19 <td class="cs-table__column">
20 {{ props.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>
28 name: 'set-supervision-url',
30 hashId: props.chargingStation.stationInfo.hashId,
31 chargingStationId: props.chargingStation.stationInfo.chargingStationId
38 <Button @click="openConnection()">Open Connection</Button>
39 <Button @click="closeConnection()">Close Connection</Button>
40 <Button @click="deleteChargingStation()">Delete Charging Station</Button>
42 <td class="cs-table__connectors-column">
43 <table id="connectors-table">
44 <thead id="connectors-table__head">
45 <tr class="connectors-table__row">
46 <th scope="col" class="connectors-table__column">Identifier</th>
47 <th scope="col" class="connectors-table__column">Status</th>
48 <th scope="col" class="connectors-table__column">Transaction</th>
49 <th scope="col" class="connectors-table__column">ATG Started</th>
50 <th scope="col" class="connectors-table__column">Actions</th>
53 <tbody id="connectors-table__body">
54 <!-- eslint-disable-next-line vue/valid-v-for -->
56 v-for="(connector, index) in getConnectorStatuses()"
57 :hash-id="props.chargingStation.stationInfo.hashId"
58 :charging-station-id="props.chargingStation.stationInfo.chargingStationId"
59 :connector-id="index + 1"
60 :connector="connector"
61 :atg-status="getATGStatus(index + 1)"
69 <script setup lang="ts">
70 import { getCurrentInstance } from 'vue'
71 import { useToast } from 'vue-toast-notification'
72 import CSConnector from '@/components/charging-stations/CSConnector.vue'
73 import Button from '@/components/buttons/Button.vue'
74 import type { ChargingStationData, ConnectorStatus, Status } from '@/types'
76 const props = defineProps<{
77 chargingStation: ChargingStationData
80 const getConnectorStatuses = (): ConnectorStatus[] => {
81 if (Array.isArray(props.chargingStation.evses) && props.chargingStation.evses.length > 0) {
82 const connectorsStatus: ConnectorStatus[] = []
83 for (const [evseId, evseStatus] of props.chargingStation.evses.entries()) {
84 if (evseId > 0 && Array.isArray(evseStatus.connectors) && evseStatus.connectors.length > 0) {
85 for (const connectorStatus of evseStatus.connectors) {
86 connectorsStatus.push(connectorStatus)
90 return connectorsStatus
92 return props.chargingStation.connectors?.slice(1)
94 const getATGStatus = (connectorId: number): Status | undefined => {
95 return props.chargingStation.automaticTransactionGenerator
96 ?.automaticTransactionGeneratorStatuses?.[connectorId - 1]
98 const getSupervisionUrl = (): string => {
99 const supervisionUrl = new URL(props.chargingStation.supervisionUrl)
100 return `${supervisionUrl.protocol}//${supervisionUrl.host.split('.').join('.\u200b')}`
102 const getWSState = (): string => {
103 switch (props.chargingStation?.wsState) {
104 case WebSocket.CONNECTING:
108 case WebSocket.CLOSING:
110 case WebSocket.CLOSED:
117 const uiClient = getCurrentInstance()?.appContext.config.globalProperties.$uiClient
119 const $toast = useToast()
121 const startChargingStation = (): void => {
123 .startChargingStation(props.chargingStation.stationInfo.hashId)
125 $toast.success('Charging station successfully started')
127 .catch((error: Error) => {
128 $toast.error('Error at starting charging station')
129 console.error('Error at starting charging station', error)
132 const stopChargingStation = (): void => {
134 .stopChargingStation(props.chargingStation.stationInfo.hashId)
136 $toast.success('Charging station successfully stopped')
138 .catch((error: Error) => {
139 $toast.error('Error at stopping charging station')
140 console.error('Error at stopping charging station', error)
143 const openConnection = (): void => {
145 .openConnection(props.chargingStation.stationInfo.hashId)
147 $toast.success('Connection successfully opened')
149 .catch((error: Error) => {
150 $toast.error('Error at opening connection')
151 console.error('Error at opening connection', error)
154 const closeConnection = (): void => {
156 .closeConnection(props.chargingStation.stationInfo.hashId)
158 $toast.success('Connection successfully closed')
160 .catch((error: Error) => {
161 $toast.error('Error at closing connection')
162 console.error('Error at closing connection', error)
165 const deleteChargingStation = (): void => {
167 .deleteChargingStation(props.chargingStation.stationInfo.hashId)
169 $toast.success('Charging station successfully deleted')
171 .catch((error: Error) => {
172 $toast.error('Error at deleting charging station')
173 console.error('Error at deleting charging station', error)
181 flex-direction: column;
182 background-color: white;
183 overflow: auto hidden;
184 border-collapse: collapse;
188 #connectors-table__body {
190 flex-direction: column;
193 .connectors-table__row {
196 justify-content: center;
200 .connectors-table__row:nth-of-type(even) {
201 background-color: whitesmoke;
204 #connectors-table__head .connectors-table__row {
205 background-color: lightgrey;
208 .connectors-table__column {
209 width: calc(100% / 5);