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 JB |
9 | name="supervision-url" |
10 | placeholder="supervision url" | |
11 | /> | |
12 | <br /> | |
13 | <Button | |
14 | @click=" | |
15 | () => { | |
16 | uiClient | |
17 | .setSupervisionUrl(props.hashId, state.supervisionUrl) | |
cea23fa0 JB |
18 | .then(() => { |
19 | $toast.success('Supervision url successfully set') | |
20 | }) | |
f8696170 | 21 | .catch((error: Error) => { |
cea23fa0 | 22 | $toast.error('Error at setting supervision url') |
f8696170 JB |
23 | console.error('Error at setting supervision url:', error) |
24 | }) | |
25 | .finally(() => { | |
26 | $router.push({ name: 'charging-stations' }) | |
27 | }) | |
28 | } | |
29 | " | |
30 | >Set Supervision Url</Button | |
31 | > | |
32 | <Button @click="$router.push({ name: 'charging-stations' })">Cancel</Button> | |
33 | </template> | |
34 | ||
35 | <script setup lang="ts"> | |
36 | import { getCurrentInstance, reactive } from 'vue' | |
37 | import Button from '@/components/buttons/Button.vue' | |
38 | ||
39 | const props = defineProps<{ | |
40 | hashId: string | |
41 | chargingStationId: string | |
42 | }>() | |
43 | ||
44 | const state = reactive({ | |
b221407f | 45 | supervisionUrl: 'ws://' |
f8696170 JB |
46 | }) |
47 | ||
48 | const uiClient = getCurrentInstance()?.appContext.config.globalProperties.$uiClient | |
49 | </script> | |
50 | ||
51 | <style> | |
52 | #supervision-url { | |
b221407f JB |
53 | width: 90%; |
54 | text-align: left; | |
f8696170 JB |
55 | } |
56 | </style> |