Web UI: add one UT
[e-mobility-charging-stations-simulator.git] / src / ui / web / src / components / charging-stations / CSData.vue
index 1d2fc0202bd76d02dccd33ee5a887e0a25d8ba13..08a72d5e6e5bb801a3a05a6fb39d36498812fcdd 100644 (file)
@@ -1,14 +1,17 @@
 <template>
-  <tr v-for="(connector, index) in getConnector()" class="cs-table__row">
+  <tr v-for="(connector, index) in getConnectors()" class="cs-table__row">
     <CSConnector
       :hash-id="getHashId()"
       :connector="connector"
       :connector-id="index + 1"
-      :tag="props.tag"
+      :transaction-id="connector.transactionId"
+      :id-tag="props.idTag"
     />
     <td class="cs-table__name-col">{{ getId() }}</td>
-    <td class="cs-table__model-col">{{ getModel() }}</td>
+    <td class="cs-table__stopped-col">{{ getStopped() }}</td>
+    <td class="cs-table__registration-status-col">{{ getRegistrationStatus() }}</td>
     <td class="cs-table__vendor-col">{{ getVendor() }}</td>
+    <td class="cs-table__model-col">{{ getModel() }}</td>
     <td class="cs-table__firmware-col">{{ getFirmwareVersion() }}</td>
   </tr>
 </template>
@@ -16,9 +19,9 @@
 <script setup lang="ts">
 import CSConnector from './CSConnector.vue';
 
-import { reactive } from 'vue';
+// import { reactive } from 'vue';
 import Utils from '@/composable/Utils';
-import {
+import type {
   ChargingStationData,
   ChargingStationInfo,
   ConnectorStatus,
@@ -26,22 +29,23 @@ import {
 
 const props = defineProps<{
   chargingStation: ChargingStationData;
-  tag: string;
+  idTag: string;
 }>();
 
-type State = {
-  isTagModalVisible: boolean;
-  // tag: string;
-};
-const state: State = reactive({
-  isTagModalVisible: false,
-  // tag: '',
-});
+// type State = {
+//   isTagModalVisible: boolean;
+//   idTag: string;
+// };
+
+// const state: State = reactive({
+//   isTagModalVisible: false,
+//   idTag: '',
+// });
 
 function getHashId(): string {
   return props.chargingStation.hashId;
 }
-function getConnector(): Array<ConnectorStatus> {
+function getConnectors(): ConnectorStatus[] {
   return props.chargingStation.connectors.slice(1);
 }
 function getInfo(): ChargingStationInfo {
@@ -59,6 +63,12 @@ function getVendor(): string {
 function getFirmwareVersion(): string {
   return Utils.ifUndefined<string>(getInfo().firmwareVersion, 'Ø');
 }
+function getStopped(): string {
+  return props.chargingStation.stopped === true ? 'Yes' : 'No';
+}
+function getRegistrationStatus(): string {
+  return props.chargingStation?.bootNotificationResponse?.status ?? 'Ø';
+}
 // function showTagModal(): void {
 //   state.isTagModalVisible = true;
 // }