refactor: cleanup vue.js global properties usage
[e-mobility-charging-stations-simulator.git] / ui / web / src / components / actions / SetSupervisionUrl.vue
CommitLineData
f8696170 1<template>
916f0920
JB
2 <h1 id="action">Set Supervision Url</h1>
3 <h2>{{ chargingStationId }}</h2>
f8696170
JB
4 <p>Supervision Url:</p>
5 <input
6 id="supervision-url"
d18fc1e3 7 v-model.trim="state.supervisionUrl"
70627077 8 type="url"
f8696170 9 name="supervision-url"
0475290a 10 placeholder="wss://"
f8696170
JB
11 />
12 <br />
13 <Button
14ee627a 14 id="action-button"
f8696170
JB
15 @click="
16 () => {
7e315430 17 $uiClient
4b10e4f9 18 .setSupervisionUrl(hashId, state.supervisionUrl)
cea23fa0
JB
19 .then(() => {
20 $toast.success('Supervision url successfully set')
21 })
f8696170 22 .catch((error: Error) => {
cea23fa0 23 $toast.error('Error at setting supervision url')
f8696170
JB
24 console.error('Error at setting supervision url:', error)
25 })
26 .finally(() => {
27 $router.push({ name: 'charging-stations' })
28 })
29 }
30 "
f8696170 31 >
1eb5f592
JB
32 Set Supervision Url
33 </Button>
f8696170
JB
34</template>
35
36<script setup lang="ts">
7e315430 37import { ref } from 'vue'
f8696170
JB
38import Button from '@/components/buttons/Button.vue'
39
4b10e4f9 40defineProps<{
f8696170
JB
41 hashId: string
42 chargingStationId: string
43}>()
44
cf959670 45const state = ref<{ supervisionUrl: string }>({
0475290a 46 supervisionUrl: ''
f8696170 47})
f8696170
JB
48</script>
49
50<style>
51#supervision-url {
b221407f
JB
52 width: 90%;
53 text-align: left;
f8696170
JB
54}
55</style>