Commit | Line | Data |
---|---|---|
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" | |
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 | |
18 | .setSupervisionUrl(props.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> | |
14ee627a | 34 | <Button id="action-button" @click="$router.push({ name: 'charging-stations' })">Cancel</Button> |
f8696170 JB |
35 | </template> |
36 | ||
37 | <script setup lang="ts"> | |
38 | import { getCurrentInstance, reactive } from 'vue' | |
39 | import Button from '@/components/buttons/Button.vue' | |
40 | ||
41 | const props = defineProps<{ | |
42 | hashId: string | |
43 | chargingStationId: string | |
44 | }>() | |
45 | ||
46 | const state = reactive({ | |
0475290a | 47 | supervisionUrl: '' |
f8696170 JB |
48 | }) |
49 | ||
50 | const uiClient = getCurrentInstance()?.appContext.config.globalProperties.$uiClient | |
51 | </script> | |
52 | ||
53 | <style> | |
54 | #supervision-url { | |
b221407f JB |
55 | width: 90%; |
56 | text-align: left; | |
f8696170 JB |
57 | } |
58 | </style> |