feat(ui): add set supervision url action
[e-mobility-charging-stations-simulator.git] / ui / web / src / components / actions / SetSupervisionUrl.vue
CommitLineData
f8696170
JB
1<template>
2 <h2>Action Set Supervision Url</h2>
3 <h3>Charging Station {{ chargingStationId }}</h3>
4 <p>Supervision Url:</p>
5 <input
6 id="supervision-url"
7 v-model="state.supervisionUrl"
8 type="text"
9 name="supervision-url"
10 placeholder="supervision url"
11 />
12 <br />
13 <Button
14 @click="
15 () => {
16 uiClient
17 .setSupervisionUrl(props.hashId, state.supervisionUrl)
18 .catch((error: Error) => {
19 // TODO: add code for UI notifications or other error handling logic
20 console.error('Error at setting supervision url:', error)
21 })
22 .finally(() => {
23 $router.push({ name: 'charging-stations' })
24 })
25 }
26 "
27 >Set Supervision Url</Button
28 >
29 <Button @click="$router.push({ name: 'charging-stations' })">Cancel</Button>
30</template>
31
32<script setup lang="ts">
33import { getCurrentInstance, reactive } from 'vue'
34import Button from '@/components/buttons/Button.vue'
35
36const props = defineProps<{
37 hashId: string
38 chargingStationId: string
39}>()
40
41const state = reactive({
42 supervisionUrl: ''
43})
44
45const uiClient = getCurrentInstance()?.appContext.config.globalProperties.$uiClient
46</script>
47
48<style>
49#supervision-url {
50 text-align: center;
51}
52</style>