Commit | Line | Data |
---|---|---|
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 | () => { | |
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"> | |
3b0c6e17 | 37 | import { getCurrentInstance, ref } from 'vue' |
f8696170 JB |
38 | import Button from '@/components/buttons/Button.vue' |
39 | ||
4b10e4f9 | 40 | defineProps<{ |
f8696170 JB |
41 | hashId: string |
42 | chargingStationId: string | |
43 | }>() | |
44 | ||
cf959670 | 45 | const state = ref<{ supervisionUrl: string }>({ |
0475290a | 46 | supervisionUrl: '' |
f8696170 JB |
47 | }) |
48 | ||
49 | const uiClient = getCurrentInstance()?.appContext.config.globalProperties.$uiClient | |
50 | </script> | |
51 | ||
52 | <style> | |
53 | #supervision-url { | |
b221407f JB |
54 | width: 90%; |
55 | text-align: left; | |
f8696170 JB |
56 | } |
57 | </style> |