build(deps-dev): apply updates
[e-mobility-charging-stations-simulator.git] / ui / web / src / components / actions / AddChargingStations.vue
index d0a21276f7f453e4843a871e2a26b1c7758ec555..51e8a83093f1f2591e74bf32957318edf595f132 100644 (file)
@@ -1,7 +1,8 @@
 <template>
-  <h2>Action Add Charging Stations</h2>
+  <h1 id="action">Action</h1>
+  <h2>Add Charging Stations</h2>
   <p>Template:</p>
-  <select v-if="state.ready" v-model="state.template">
+  <select v-show="state.ready" v-model="state.template">
     <option disabled value="">Please select a template</option>
     <option v-for="template in app?.appContext.config.globalProperties.$templates">
       {{ template }}
     name="number-of-stations"
     placeholder="number of stations"
   />
+  <p>Template options overrides:</p>
+  <ul>
+    <li>
+      Supervision url:
+      <input
+        id="supervision-url"
+        v-model.trim="state.supervisionUrl"
+        type="url"
+        name="supervision-url"
+        placeholder="wss://"
+      />
+    </li>
+    <li>
+      Auto start:
+      <input v-model="state.autoStart" type="checkbox" true-value="true" false-value="false" />
+    </li>
+    <li>
+      Persistent configuration:
+      <input
+        v-model="state.persistentConfiguration"
+        type="checkbox"
+        true-value="true"
+        false-value="false"
+      />
+    </li>
+    <li>
+      OCPP strict compliance:
+      <input
+        v-model="state.ocppStrictCompliance"
+        type="checkbox"
+        true-value="true"
+        false-value="false"
+      />
+    </li>
+    <li>
+      Performance statistics:
+      <input
+        v-model="state.enableStatistics"
+        type="checkbox"
+        true-value="true"
+        false-value="false"
+      />
+    </li>
+  </ul>
   <br />
   <Button
+    id="action-button"
     @click="
       () => {
         uiClient
-          .addChargingStations(state.template, state.numberOfStations)
+          .addChargingStations(state.template, state.numberOfStations, {
+            supervisionUrls: state.supervisionUrl.length > 0 ? state.supervisionUrl : undefined,
+            autoStart: convertToBoolean(state.autoStart),
+            persistentConfiguration: convertToBoolean(state.persistentConfiguration),
+            ocppStrictCompliance: convertToBoolean(state.ocppStrictCompliance),
+            enableStatistics: convertToBoolean(state.enableStatistics)
+          })
           .then(() => {
             $toast.success('Charging stations successfully added')
           })
@@ -37,7 +89,7 @@
   >
     Add Charging Stations
   </Button>
-  <Button @click="$router.push({ name: 'charging-stations' })">Cancel</Button>
+  <Button id="action-button" @click="$router.push({ name: 'charging-stations' })">Cancel</Button>
 </template>
 
 <script setup lang="ts">
@@ -45,11 +97,17 @@ import { getCurrentInstance, onMounted, reactive } from 'vue'
 import { useToast } from 'vue-toast-notification'
 import Button from '@/components/buttons/Button.vue'
 import type { ResponsePayload } from '@/types'
+import { convertToBoolean } from '@/composables'
 
 const state = reactive({
   ready: false,
   template: '',
-  numberOfStations: 1
+  numberOfStations: 1,
+  supervisionUrl: '',
+  autoStart: false,
+  persistentConfiguration: true,
+  ocppStrictCompliance: true,
+  enableStatistics: false
 })
 
 const app = getCurrentInstance()
@@ -80,4 +138,9 @@ onMounted(() => {
   width: 15%;
   text-align: center;
 }
+
+#supervision-url {
+  width: 90%;
+  text-align: left;
+}
 </style>