build: align eslint imports sorting settings
[e-mobility-charging-stations-simulator.git] / ui / web / src / components / charging-stations / CSData.vue
1 <template>
2 <tr v-for="(connector, index) in getConnectors()" class="cs-table__row">
3 <CSConnector
4 :hash-id="getHashId()"
5 :connector="connector"
6 :connector-id="index + 1"
7 :transaction-id="connector.transactionId"
8 :id-tag="props.idTag"
9 />
10 <td class="cs-table__name-col">{{ getId() }}</td>
11 <td class="cs-table__started-col">{{ getStarted() }}</td>
12 <td class="cs-table__wsState-col">{{ getWsState() }}</td>
13 <td class="cs-table__registration-status-col">{{ getRegistrationStatus() }}</td>
14 <td class="cs-table__vendor-col">{{ getVendor() }}</td>
15 <td class="cs-table__model-col">{{ getModel() }}</td>
16 <td class="cs-table__firmware-col">{{ getFirmwareVersion() }}</td>
17 </tr>
18 </template>
19
20 <script setup lang="ts">
21 // import { reactive } from 'vue';
22 import CSConnector from './CSConnector.vue';
23 import type {
24 ChargingStationData,
25 ChargingStationInfo,
26 ConnectorStatus,
27 } from '@/types/ChargingStationType';
28 import Utils from '@/composables/Utils';
29
30 const props = defineProps<{
31 chargingStation: ChargingStationData;
32 idTag: string;
33 }>();
34
35 // type State = {
36 // isTagModalVisible: boolean;
37 // idTag: string;
38 // };
39
40 // const state: State = reactive({
41 // isTagModalVisible: false,
42 // idTag: '',
43 // });
44
45 function getConnectors(): ConnectorStatus[] {
46 return props.chargingStation.connectors?.slice(1);
47 }
48 function getInfo(): ChargingStationInfo {
49 return props.chargingStation.stationInfo;
50 }
51 function getHashId(): string {
52 return getInfo().hashId;
53 }
54 function getId(): string {
55 return Utils.ifUndefined<string>(getInfo().chargingStationId, 'Ø');
56 }
57 function getModel(): string {
58 return getInfo().chargePointModel;
59 }
60 function getVendor(): string {
61 return getInfo().chargePointVendor;
62 }
63 function getFirmwareVersion(): string {
64 return Utils.ifUndefined<string>(getInfo().firmwareVersion, 'Ø');
65 }
66 function getStarted(): string {
67 return props.chargingStation.started === true ? 'Yes' : 'No';
68 }
69 function getWsState(): string {
70 switch (props.chargingStation?.wsState) {
71 case WebSocket.CONNECTING:
72 return 'Connecting';
73 case WebSocket.OPEN:
74 return 'Open';
75 case WebSocket.CLOSING:
76 return 'Closing';
77 case WebSocket.CLOSED:
78 return 'Closed';
79 default:
80 return 'Ø';
81 }
82 }
83 function getRegistrationStatus(): string {
84 return props.chargingStation?.bootNotificationResponse?.status ?? 'Ø';
85 }
86 // function showTagModal(): void {
87 // state.isTagModalVisible = true;
88 // }
89 // function hideTagModal(): void {
90 // state.isTagModalVisible = false;
91 // }
92 </script>