Commit | Line | Data |
---|---|---|
f8696170 | 1 | <template> |
229d8c34 JB |
2 | <h1 id="action">Action</h1> |
3 | <h2>Set Supervision Url</h2> | |
f8696170 JB |
4 | <h3>Charging Station {{ chargingStationId }}</h3> |
5 | <p>Supervision Url:</p> | |
6 | <input | |
7 | id="supervision-url" | |
d18fc1e3 | 8 | v-model.trim="state.supervisionUrl" |
70627077 | 9 | type="url" |
f8696170 | 10 | name="supervision-url" |
0475290a | 11 | placeholder="wss://" |
f8696170 JB |
12 | /> |
13 | <br /> | |
14 | <Button | |
14ee627a | 15 | id="action-button" |
f8696170 JB |
16 | @click=" |
17 | () => { | |
18 | uiClient | |
19 | .setSupervisionUrl(props.hashId, state.supervisionUrl) | |
cea23fa0 JB |
20 | .then(() => { |
21 | $toast.success('Supervision url successfully set') | |
22 | }) | |
f8696170 | 23 | .catch((error: Error) => { |
cea23fa0 | 24 | $toast.error('Error at setting supervision url') |
f8696170 JB |
25 | console.error('Error at setting supervision url:', error) |
26 | }) | |
27 | .finally(() => { | |
28 | $router.push({ name: 'charging-stations' }) | |
29 | }) | |
30 | } | |
31 | " | |
f8696170 | 32 | > |
1eb5f592 JB |
33 | Set Supervision Url |
34 | </Button> | |
14ee627a | 35 | <Button id="action-button" @click="$router.push({ name: 'charging-stations' })">Cancel</Button> |
f8696170 JB |
36 | </template> |
37 | ||
38 | <script setup lang="ts"> | |
39 | import { getCurrentInstance, reactive } from 'vue' | |
40 | import Button from '@/components/buttons/Button.vue' | |
41 | ||
42 | const props = defineProps<{ | |
43 | hashId: string | |
44 | chargingStationId: string | |
45 | }>() | |
46 | ||
47 | const state = reactive({ | |
0475290a | 48 | supervisionUrl: '' |
f8696170 JB |
49 | }) |
50 | ||
51 | const uiClient = getCurrentInstance()?.appContext.config.globalProperties.$uiClient | |
52 | </script> | |
53 | ||
54 | <style> | |
55 | #supervision-url { | |
b221407f JB |
56 | width: 90%; |
57 | text-align: left; | |
f8696170 JB |
58 | } |
59 | </style> |