Web UI: rename some directories to a sensible name
[e-mobility-charging-stations-simulator.git] / src / ui / web / src / components / charging-stations / CSConnector.vue
CommitLineData
32de5a57
LM
1<template>
2 <td class="cs-table__action-col">
8fc2e5cc
JB
3 <Button @click="startChargingStation()">Start Charging Station</Button>
4 <Button @click="stopChargingStation()">Stop Charging Station</Button>
5 <Button @click="openConnection()">Open Connection</Button>
6 <Button @click="closeConnection()">Close Connection</Button>
32de5a57 7 <Button @click="startTransaction()">Start Transaction</Button>
5a010bf0
JB
8 <!-- <IdTagInputModal
9 :visibility="state.isIdTagModalVisible"
10 :idTag="state.idTag"
11 @close="hideIdTagModal()"
12 @done="Utils.compose(state.transaction, hideIdTagModal)()"
32de5a57 13 >
5a010bf0
JB
14 Start Transaction
15 </IdTagInputModal> -->
16 <Button @click="stopTransaction()">Stop Transaction</Button>
32de5a57
LM
17 </td>
18 <td class="cs-table__connector-col">{{ connectorId }}</td>
5a010bf0 19 <td class="cs-table__status-col">{{ connector.status }}</td>
8fc2e5cc 20 <td class="cs-table__transaction-col">{{ connector.transactionStarted ? 'Yes' : 'No' }}</td>
32de5a57
LM
21</template>
22
23<script setup lang="ts">
5a010bf0 24// import IdTagInputModal from './IdTagInputModal.vue';
32de5a57
LM
25import Button from '../buttons/Button.vue';
26
5a010bf0 27// import { reactive } from 'vue';
f27eb751
JB
28import UIClient from '@/composables/UIClient';
29import type { ConnectorStatus } from '@/types/ChargingStationType';
30// import Utils from '@/composables/Utils';
32de5a57
LM
31
32const props = defineProps<{
33 hashId: string;
34 connector: ConnectorStatus;
35 transactionId?: number;
5a010bf0
JB
36 connectorId: number;
37 idTag?: string;
32de5a57
LM
38}>();
39
5a010bf0
JB
40// type State = {
41// isIdTagModalVisible: boolean;
42// idTag: string;
43// transaction: () => void;
44// };
32de5a57 45
5a010bf0
JB
46// const state: State = reactive({
47// isIdTagModalVisible: false,
48// idTag: '',
49// transaction: startTransaction,
50// });
32de5a57 51
5a010bf0
JB
52// function getIdTag(transaction: () => void): void {
53// state.transaction = transaction;
54// showTagModal();
55// }
56
57// function showTagModal(): void {
58// state.isIdTagModalVisible = true;
59// }
60// function hideIdTagModal(): void {
61// state.isIdTagModalVisible = false;
62// }
32de5a57 63
8fc2e5cc 64function startChargingStation(): void {
f27eb751 65 UIClient.getInstance().startChargingStation(props.hashId);
32de5a57 66}
8fc2e5cc 67function stopChargingStation(): void {
f27eb751 68 UIClient.getInstance().stopChargingStation(props.hashId);
32de5a57 69}
5a010bf0 70function openConnection(): void {
f27eb751 71 UIClient.getInstance().openConnection(props.hashId);
5a010bf0
JB
72}
73function closeConnection(): void {
f27eb751 74 UIClient.getInstance().closeConnection(props.hashId);
5a010bf0 75}
8fc2e5cc 76function startTransaction(): void {
f27eb751 77 UIClient.getInstance().startTransaction(props.hashId, props.connectorId, props.idTag);
8fc2e5cc
JB
78}
79function stopTransaction(): void {
f27eb751 80 UIClient.getInstance().stopTransaction(props.hashId, props.transactionId);
8fc2e5cc 81}
32de5a57 82</script>