Vue UI + UI server
[e-mobility-charging-stations-simulator.git] / src / ui / web / src / components / charging-stations / CSData.vue
1 <template>
2 <tr v-for="(connector, index) in getConnector()" class="cs-table__row">
3 <CSConnector
4 :hash-id="getHashId()"
5 :connector="connector"
6 :connector-id="index + 1"
7 :tag="props.tag"
8 />
9 <td class="cs-table__name-col">{{ getId() }}</td>
10 <td class="cs-table__model-col">{{ getModel() }}</td>
11 <td class="cs-table__vendor-col">{{ getVendor() }}</td>
12 <td class="cs-table__firmware-col">{{ getFirmwareVersion() }}</td>
13 </tr>
14 </template>
15
16 <script setup lang="ts">
17 import CSConnector from './CSConnector.vue';
18
19 import { reactive } from 'vue';
20 import Utils from '@/composable/Utils';
21 import {
22 ChargingStationData,
23 ChargingStationInfo,
24 ConnectorStatus,
25 } from '@/type/ChargingStationType';
26
27 const props = defineProps<{
28 chargingStation: ChargingStationData;
29 tag: string;
30 }>();
31
32 type State = {
33 isTagModalVisible: boolean;
34 // tag: string;
35 };
36 const state: State = reactive({
37 isTagModalVisible: false,
38 // tag: '',
39 });
40
41 function getHashId(): string {
42 return props.chargingStation.hashId;
43 }
44 function getConnector(): Array<ConnectorStatus> {
45 return props.chargingStation.connectors.slice(1);
46 }
47 function getInfo(): ChargingStationInfo {
48 return props.chargingStation.stationInfo;
49 }
50 function getId(): string {
51 return Utils.ifUndefined<string>(getInfo().chargingStationId, 'Ø');
52 }
53 function getModel(): string {
54 return getInfo().chargePointModel;
55 }
56 function getVendor(): string {
57 return getInfo().chargePointVendor;
58 }
59 function getFirmwareVersion(): string {
60 return Utils.ifUndefined<string>(getInfo().firmwareVersion, 'Ø');
61 }
62 // function showTagModal(): void {
63 // state.isTagModalVisible = true;
64 // }
65 // function hideTagModal(): void {
66 // state.isTagModalVisible = false;
67 // }
68 </script>