2 <tr class="cs-table__row">
3 <td class="cs-table__column">{{ getId() }}</td>
4 <td class="cs-table__column">{{ getStarted() }}</td>
5 <td class="cs-table__column">
6 {{ getSupervisionUrl() }}
8 <td class="cs-table__column">{{ getWsState() }}</td>
9 <td class="cs-table__column">
10 {{ getRegistrationStatus() }}
12 <td class="cs-table__column">
13 {{ getInfo().templateName }}
15 <td class="cs-table__column">{{ getVendor() }}</td>
16 <td class="cs-table__column">{{ getModel() }}</td>
17 <td class="cs-table__column">
18 {{ getFirmwareVersion() }}
20 <td class="cs-table__column">
21 <Button @click="startChargingStation()">Start Charging Station</Button>
22 <Button @click="stopChargingStation()">Stop Charging Station</Button>
23 <Button @click="openConnection()">Open Connection</Button>
24 <Button @click="closeConnection()">Close Connection</Button>
26 <td class="cs-table__connectors-column">
27 <table id="connectors-table">
28 <thead id="connectors-table__head">
29 <tr class="connectors-table__row">
30 <th scope="col" class="connectors-table__column">Identifier</th>
31 <th scope="col" class="connectors-table__column">Status</th>
32 <th scope="col" class="connectors-table__column">Transaction</th>
33 <th scope="col" class="connectors-table__column">ATG Started</th>
34 <th scope="col" class="connectors-table__column">Actions</th>
37 <tbody id="connectors-table__body">
38 <!-- eslint-disable-next-line vue/valid-v-for -->
40 v-for="(connector, index) in getConnectors()"
41 :hash-id="getHashId()"
42 :connector-id="index + 1"
43 :connector="connector"
44 :atg-status="getATGStatus(index + 1)"
45 :transaction-id="connector.transactionId"
54 <script setup lang="ts">
55 // import { reactive } from 'vue'
56 import { getCurrentInstance } from 'vue'
57 import CSConnector from '@/components/charging-stations/CSConnector.vue'
58 import type { ChargingStationData, ChargingStationInfo, ConnectorStatus, Status } from '@/types'
60 const props = defineProps<{
61 chargingStation: ChargingStationData
66 // isTagModalVisible: boolean
70 // const state: State = reactive({
71 // isTagModalVisible: false,
75 function getStarted(): string {
76 return props.chargingStation.started === true ? 'Yes' : 'No'
78 function getATGStatus(connectorId: number): Status | undefined {
79 return props.chargingStation.automaticTransactionGenerator
80 ?.automaticTransactionGeneratorStatuses?.[connectorId - 1]
82 function getInfo(): ChargingStationInfo {
83 return props.chargingStation.stationInfo
85 function getHashId(): string {
86 return getInfo().hashId
88 function getId(): string {
89 return getInfo().chargingStationId ?? 'Ø'
91 function getModel(): string {
92 return getInfo().chargePointModel
94 function getVendor(): string {
95 return getInfo().chargePointVendor
97 function getFirmwareVersion(): string {
98 return getInfo().firmwareVersion ?? 'Ø'
100 function getSupervisionUrl(): string {
101 const supervisionUrl = new URL(props.chargingStation.supervisionUrl)
102 return `${supervisionUrl.protocol}//${supervisionUrl.host.split('.').join('.\u200b')}`
104 function getWsState(): string {
105 switch (props.chargingStation?.wsState) {
106 case WebSocket.CONNECTING:
110 case WebSocket.CLOSING:
112 case WebSocket.CLOSED:
118 function getRegistrationStatus(): string {
119 return props.chargingStation?.bootNotificationResponse?.status ?? 'Ø'
121 function getConnectors(): ConnectorStatus[] {
122 if (Array.isArray(props.chargingStation.evses) && props.chargingStation.evses.length > 0) {
123 const connectorsStatus: ConnectorStatus[] = []
124 for (const [evseId, evseStatus] of props.chargingStation.evses.entries()) {
125 if (evseId > 0 && Array.isArray(evseStatus.connectors) && evseStatus.connectors.length > 0) {
126 for (const connectorStatus of evseStatus.connectors) {
127 connectorsStatus.push(connectorStatus)
131 return connectorsStatus
133 return props.chargingStation.connectors?.slice(1)
136 const UIClient = getCurrentInstance()?.appContext.config.globalProperties.$UIClient
138 function startChargingStation(): void {
139 UIClient.startChargingStation(getHashId())
141 function stopChargingStation(): void {
142 UIClient.stopChargingStation(getHashId())
144 function openConnection(): void {
145 UIClient.openConnection(getHashId())
147 function closeConnection(): void {
148 UIClient.closeConnection(getHashId())
150 // function showTagModal(): void {
151 // state.isTagModalVisible = true
153 // function hideTagModal(): void {
154 // state.isTagModalVisible = false
161 background-color: white;
162 flex-direction: column;
163 overflow: auto hidden;
164 border-collapse: collapse;
168 #connectors-table__head,
169 #connectors-table__body {
171 flex-direction: column;
174 .connectors-table__row {
176 justify-content: center;
180 #connectors-table__head .connectors-table__row {
181 background-color: lightgrey;
184 .connectors-table__row:nth-of-type(even) {
185 background-color: whitesmoke;
188 .connectors-table__column {
189 width: calc(100% / 5);