bfg-common 1.3.229 → 1.3.230
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/localization/local_be.json +6 -6
- package/assets/localization/local_en.json +6 -6
- package/assets/localization/local_hy.json +6 -6
- package/assets/localization/local_kk.json +6 -6
- package/assets/localization/local_ru.json +6 -6
- package/assets/localization/local_zh.json +6 -6
- package/components/atoms/alert/Alert.vue +95 -95
- package/components/atoms/alert/Notification.vue +170 -170
- package/components/atoms/switch/Switch.vue +111 -111
- package/components/atoms/table/compact/Compact.vue +526 -526
- package/components/atoms/tooltip/Signpost.vue +225 -225
- package/components/common/diagramMain/modals/lib/config/vmKernelAdapter.ts +1 -1
- package/components/common/pages/Tasks.vue +120 -120
- package/components/common/recursionTree/RecursionTree.vue +203 -203
- package/components/common/vm/actions/add/Add.vue +575 -575
- package/components/common/vm/actions/clone/Clone.vue +518 -518
- package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +269 -269
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue +693 -693
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CpuModel.vue +220 -220
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/config/dropdownItems.ts +59 -59
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +294 -294
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDevice.vue +165 -165
- package/components/common/vm/actions/common/select/storage/lib/config/config.ts +166 -166
- package/components/common/vm/actions/editSettings/EditSettings.vue +313 -313
- package/components/common/weekSelect/WeekSelect.vue +112 -112
- package/components/common/weekSelect/lib/config/options.ts +10 -10
- package/components/common/wizards/network/add/lib/config/initialData.ts +1 -1
- package/composables/useAppVersion.ts +21 -21
- package/composables/useEnvLanguage.ts +20 -20
- package/lib/utils/sendTask.ts +72 -72
- package/minify.js +146 -146
- package/package.json +1 -1
- package/public/spice-console/application/codec.js +257 -257
- package/public/spice-console/lib/rasterEngine.js +907 -907
- package/public/spice-console/network/spicechannel.js +369 -369
- package/store/main/lib/interfaces.ts +9 -9
- package/store/tasks/actions.ts +133 -133
- package/store/tasks/getters.ts +25 -25
- package/store/tasks/lib/models/interfaces.ts +18 -18
- package/store/tasks/mutations.ts +58 -58
- package/store/tasks/state.ts +16 -16
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="flex-align-center">
|
|
3
|
-
<common-select-input
|
|
4
|
-
v-model="selectedOption"
|
|
5
|
-
:data="options"
|
|
6
|
-
class="mr-1"
|
|
7
|
-
/>
|
|
8
|
-
|
|
9
|
-
<div class="btn-group">
|
|
10
|
-
<button
|
|
11
|
-
v-for="item in tabs"
|
|
12
|
-
:key="item"
|
|
13
|
-
:class="['btn btn-sm btn-secondary', { 'btn-primary': item.isActive }]"
|
|
14
|
-
:disabled="!isCustom"
|
|
15
|
-
@click="onSelectDay(item.value)"
|
|
16
|
-
>
|
|
17
|
-
{{ item.text }}
|
|
18
|
-
</button>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
</template>
|
|
22
|
-
|
|
23
|
-
<script lang="ts" setup>
|
|
24
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
25
|
-
import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
|
|
26
|
-
import type { UI_I_TabItem } from '~/components/common/weekSelect/lib/models/interfaces'
|
|
27
|
-
import { optionsFunc } from '~/components/common/weekSelect/lib/config/options'
|
|
28
|
-
|
|
29
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
30
|
-
|
|
31
|
-
const model = defineModel<number[]>()
|
|
32
|
-
|
|
33
|
-
const selectedOption = ref<number>(0)
|
|
34
|
-
if (model.value.length === 2 && model.value.includes(6) && model.value.includes(0)) {
|
|
35
|
-
selectedOption.value = 1
|
|
36
|
-
} else if (model.value.length < 7) {
|
|
37
|
-
selectedOption.value = 2
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const options = ref<UI_I_SelectInputItem[]>(optionsFunc(localization.value))
|
|
41
|
-
|
|
42
|
-
const isCustom = computed<boolean>(() => selectedOption.value === 2)
|
|
43
|
-
const onSelectDay = (value: number): void => {
|
|
44
|
-
const index = model.value?.indexOf(value)
|
|
45
|
-
if (index === -1) {
|
|
46
|
-
model.value.push(value)
|
|
47
|
-
model.value.sort((a: number, b: number) => a - b)
|
|
48
|
-
}
|
|
49
|
-
else if (model.value.length > 1) {
|
|
50
|
-
model.value = model.value?.filter((_: number, key: number) => key !== index)
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const tabs = computed<UI_I_TabItem[]>(() => {
|
|
55
|
-
return [
|
|
56
|
-
{ text: localization.value.weekM, value: 1, isActive: checkIsActiveDay(1) },
|
|
57
|
-
{ text: localization.value.weekT, value: 2, isActive: checkIsActiveDay(2) },
|
|
58
|
-
{ text: localization.value.weekW, value: 3, isActive: checkIsActiveDay(3) },
|
|
59
|
-
{
|
|
60
|
-
text: localization.value.weekTh,
|
|
61
|
-
value: 4,
|
|
62
|
-
isActive: checkIsActiveDay(4),
|
|
63
|
-
},
|
|
64
|
-
{ text: localization.value.weekF, value: 5, isActive: checkIsActiveDay(5) },
|
|
65
|
-
{ text: localization.value.weekS, value: 6, isActive: checkIsActiveDay(6) },
|
|
66
|
-
{
|
|
67
|
-
text: localization.value.weekSu,
|
|
68
|
-
value: 0,
|
|
69
|
-
isActive: checkIsActiveDay(0),
|
|
70
|
-
},
|
|
71
|
-
]
|
|
72
|
-
})
|
|
73
|
-
const checkIsActiveDay = (value: number): boolean => {
|
|
74
|
-
let result = false
|
|
75
|
-
switch (selectedOption.value) {
|
|
76
|
-
case 0:
|
|
77
|
-
result = true
|
|
78
|
-
break
|
|
79
|
-
case 1:
|
|
80
|
-
if (value === 6 || value === 0) result = true
|
|
81
|
-
break
|
|
82
|
-
default:
|
|
83
|
-
result = !!model.value?.includes(value)
|
|
84
|
-
break
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return result
|
|
88
|
-
}
|
|
89
|
-
watch(
|
|
90
|
-
tabs,
|
|
91
|
-
(newValue: UI_I_TabItem[]) => {
|
|
92
|
-
if (selectedOption.value === 2) return
|
|
93
|
-
|
|
94
|
-
model.value = newValue.filter((tab) => tab.isActive).map((tab) => tab.value)
|
|
95
|
-
},
|
|
96
|
-
{ immediate: true }
|
|
97
|
-
)
|
|
98
|
-
</script>
|
|
99
|
-
|
|
100
|
-
<style lang="scss" scoped>
|
|
101
|
-
:deep(.select::after) {
|
|
102
|
-
top: 2px;
|
|
103
|
-
right: -16px;
|
|
104
|
-
}
|
|
105
|
-
.btn-group {
|
|
106
|
-
button {
|
|
107
|
-
width: 24px;
|
|
108
|
-
min-width: 24px;
|
|
109
|
-
padding: 0;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex-align-center">
|
|
3
|
+
<common-select-input
|
|
4
|
+
v-model="selectedOption"
|
|
5
|
+
:data="options"
|
|
6
|
+
class="mr-1"
|
|
7
|
+
/>
|
|
8
|
+
|
|
9
|
+
<div class="btn-group">
|
|
10
|
+
<button
|
|
11
|
+
v-for="item in tabs"
|
|
12
|
+
:key="item"
|
|
13
|
+
:class="['btn btn-sm btn-secondary', { 'btn-primary': item.isActive }]"
|
|
14
|
+
:disabled="!isCustom"
|
|
15
|
+
@click="onSelectDay(item.value)"
|
|
16
|
+
>
|
|
17
|
+
{{ item.text }}
|
|
18
|
+
</button>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script lang="ts" setup>
|
|
24
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
25
|
+
import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
|
|
26
|
+
import type { UI_I_TabItem } from '~/components/common/weekSelect/lib/models/interfaces'
|
|
27
|
+
import { optionsFunc } from '~/components/common/weekSelect/lib/config/options'
|
|
28
|
+
|
|
29
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
30
|
+
|
|
31
|
+
const model = defineModel<number[]>()
|
|
32
|
+
|
|
33
|
+
const selectedOption = ref<number>(0)
|
|
34
|
+
if (model.value.length === 2 && model.value.includes(6) && model.value.includes(0)) {
|
|
35
|
+
selectedOption.value = 1
|
|
36
|
+
} else if (model.value.length < 7) {
|
|
37
|
+
selectedOption.value = 2
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const options = ref<UI_I_SelectInputItem[]>(optionsFunc(localization.value))
|
|
41
|
+
|
|
42
|
+
const isCustom = computed<boolean>(() => selectedOption.value === 2)
|
|
43
|
+
const onSelectDay = (value: number): void => {
|
|
44
|
+
const index = model.value?.indexOf(value)
|
|
45
|
+
if (index === -1) {
|
|
46
|
+
model.value.push(value)
|
|
47
|
+
model.value.sort((a: number, b: number) => a - b)
|
|
48
|
+
}
|
|
49
|
+
else if (model.value.length > 1) {
|
|
50
|
+
model.value = model.value?.filter((_: number, key: number) => key !== index)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const tabs = computed<UI_I_TabItem[]>(() => {
|
|
55
|
+
return [
|
|
56
|
+
{ text: localization.value.weekM, value: 1, isActive: checkIsActiveDay(1) },
|
|
57
|
+
{ text: localization.value.weekT, value: 2, isActive: checkIsActiveDay(2) },
|
|
58
|
+
{ text: localization.value.weekW, value: 3, isActive: checkIsActiveDay(3) },
|
|
59
|
+
{
|
|
60
|
+
text: localization.value.weekTh,
|
|
61
|
+
value: 4,
|
|
62
|
+
isActive: checkIsActiveDay(4),
|
|
63
|
+
},
|
|
64
|
+
{ text: localization.value.weekF, value: 5, isActive: checkIsActiveDay(5) },
|
|
65
|
+
{ text: localization.value.weekS, value: 6, isActive: checkIsActiveDay(6) },
|
|
66
|
+
{
|
|
67
|
+
text: localization.value.weekSu,
|
|
68
|
+
value: 0,
|
|
69
|
+
isActive: checkIsActiveDay(0),
|
|
70
|
+
},
|
|
71
|
+
]
|
|
72
|
+
})
|
|
73
|
+
const checkIsActiveDay = (value: number): boolean => {
|
|
74
|
+
let result = false
|
|
75
|
+
switch (selectedOption.value) {
|
|
76
|
+
case 0:
|
|
77
|
+
result = true
|
|
78
|
+
break
|
|
79
|
+
case 1:
|
|
80
|
+
if (value === 6 || value === 0) result = true
|
|
81
|
+
break
|
|
82
|
+
default:
|
|
83
|
+
result = !!model.value?.includes(value)
|
|
84
|
+
break
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return result
|
|
88
|
+
}
|
|
89
|
+
watch(
|
|
90
|
+
tabs,
|
|
91
|
+
(newValue: UI_I_TabItem[]) => {
|
|
92
|
+
if (selectedOption.value === 2) return
|
|
93
|
+
|
|
94
|
+
model.value = newValue.filter((tab) => tab.isActive).map((tab) => tab.value)
|
|
95
|
+
},
|
|
96
|
+
{ immediate: true }
|
|
97
|
+
)
|
|
98
|
+
</script>
|
|
99
|
+
|
|
100
|
+
<style lang="scss" scoped>
|
|
101
|
+
:deep(.select::after) {
|
|
102
|
+
top: 2px;
|
|
103
|
+
right: -16px;
|
|
104
|
+
}
|
|
105
|
+
.btn-group {
|
|
106
|
+
button {
|
|
107
|
+
width: 24px;
|
|
108
|
+
min-width: 24px;
|
|
109
|
+
padding: 0;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
</style>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
2
|
-
import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
|
|
3
|
-
|
|
4
|
-
export const optionsFunc = (
|
|
5
|
-
localization: UI_I_Localization
|
|
6
|
-
): UI_I_SelectInputItem[] => [
|
|
7
|
-
{ label: localization.daily, value: 0 },
|
|
8
|
-
{ label: localization.weekly, value: 1 },
|
|
9
|
-
{ label: localization.custom, value: 2 },
|
|
10
|
-
]
|
|
1
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
2
|
+
import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
|
|
3
|
+
|
|
4
|
+
export const optionsFunc = (
|
|
5
|
+
localization: UI_I_Localization
|
|
6
|
+
): UI_I_SelectInputItem[] => [
|
|
7
|
+
{ label: localization.daily, value: 0 },
|
|
8
|
+
{ label: localization.weekly, value: 1 },
|
|
9
|
+
{ label: localization.custom, value: 2 },
|
|
10
|
+
]
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import type { UI_I_UseAppVersionReturnType } from '~/lib/models/composables/useAppVersion/interfaces'
|
|
2
|
-
|
|
3
|
-
export function useAppVersion(): UI_I_UseAppVersionReturnType {
|
|
4
|
-
const config = useRuntimeConfig()
|
|
5
|
-
const version = config.public.APP_VERSION
|
|
6
|
-
|
|
7
|
-
const regexHasDot = /\./
|
|
8
|
-
const regexHasDotAndB = /\..*b/
|
|
9
|
-
const regexHasDotAndD = /\..*d/
|
|
10
|
-
|
|
11
|
-
const isBeta = regexHasDotAndB.test(version)
|
|
12
|
-
const isDev =
|
|
13
|
-
regexHasDotAndD.test(version) ||
|
|
14
|
-
(!regexHasDot.test(version) && version.length < 8)
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
version,
|
|
18
|
-
isBeta,
|
|
19
|
-
isDev,
|
|
20
|
-
}
|
|
21
|
-
}
|
|
1
|
+
import type { UI_I_UseAppVersionReturnType } from '~/lib/models/composables/useAppVersion/interfaces'
|
|
2
|
+
|
|
3
|
+
export function useAppVersion(): UI_I_UseAppVersionReturnType {
|
|
4
|
+
const config = useRuntimeConfig()
|
|
5
|
+
const version = config.public.APP_VERSION
|
|
6
|
+
|
|
7
|
+
const regexHasDot = /\./
|
|
8
|
+
const regexHasDotAndB = /\..*b/
|
|
9
|
+
const regexHasDotAndD = /\..*d/
|
|
10
|
+
|
|
11
|
+
const isBeta = regexHasDotAndB.test(version)
|
|
12
|
+
const isDev =
|
|
13
|
+
regexHasDotAndD.test(version) ||
|
|
14
|
+
(!regexHasDot.test(version) && version.length < 8)
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
version,
|
|
18
|
+
isBeta,
|
|
19
|
+
isDev,
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export function useEnvLanguage(): string {
|
|
2
|
-
const { $store }: any = useNuxtApp()
|
|
3
|
-
|
|
4
|
-
let localizationCode = 'en_US'
|
|
5
|
-
const langFromLocalStorage =
|
|
6
|
-
useLocalStorage('lang') || $store.getters['main/getInterfaceLang'] // Из $store для Сферы, но думаю нужно сделать одинаково из localStorage
|
|
7
|
-
if (langFromLocalStorage) {
|
|
8
|
-
if (
|
|
9
|
-
langFromLocalStorage === 'en_US' ||
|
|
10
|
-
langFromLocalStorage === 'ru_RU' ||
|
|
11
|
-
langFromLocalStorage === 'hy_AM'
|
|
12
|
-
) {
|
|
13
|
-
localizationCode = langFromLocalStorage
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
localizationCode = localizationCode.slice(0, 2).toUpperCase()
|
|
18
|
-
|
|
19
|
-
return localizationCode
|
|
20
|
-
}
|
|
1
|
+
export function useEnvLanguage(): string {
|
|
2
|
+
const { $store }: any = useNuxtApp()
|
|
3
|
+
|
|
4
|
+
let localizationCode = 'en_US'
|
|
5
|
+
const langFromLocalStorage =
|
|
6
|
+
useLocalStorage('lang') || $store.getters['main/getInterfaceLang'] // Из $store для Сферы, но думаю нужно сделать одинаково из localStorage
|
|
7
|
+
if (langFromLocalStorage) {
|
|
8
|
+
if (
|
|
9
|
+
langFromLocalStorage === 'en_US' ||
|
|
10
|
+
langFromLocalStorage === 'ru_RU' ||
|
|
11
|
+
langFromLocalStorage === 'hy_AM'
|
|
12
|
+
) {
|
|
13
|
+
localizationCode = langFromLocalStorage
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
localizationCode = localizationCode.slice(0, 2).toUpperCase()
|
|
18
|
+
|
|
19
|
+
return localizationCode
|
|
20
|
+
}
|
package/lib/utils/sendTask.ts
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
2
|
-
import type {
|
|
3
|
-
API_UI_I_Error,
|
|
4
|
-
UI_I_RequestBody,
|
|
5
|
-
} from '~/lib/models/store/interfaces'
|
|
6
|
-
import type {
|
|
7
|
-
UI_I_NotifyBodyMessage,
|
|
8
|
-
UI_I_SendTaskParams,
|
|
9
|
-
} from '~/lib/models/interfaces'
|
|
10
|
-
import { base64 } from './base64'
|
|
11
|
-
|
|
12
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
13
|
-
|
|
14
|
-
const showNotification = (message: UI_I_NotifyBodyMessage): void => {
|
|
15
|
-
const { title, desc, status } = message
|
|
16
|
-
const { $store } = useNuxtApp()
|
|
17
|
-
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
$store.dispatch('main/A_SHOW_NOTIFICATION', {
|
|
20
|
-
status,
|
|
21
|
-
messages: [
|
|
22
|
-
{
|
|
23
|
-
title,
|
|
24
|
-
descriptions: [desc],
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
headline: '',
|
|
28
|
-
timeout: status === 'success' ? 3000 : '',
|
|
29
|
-
})
|
|
30
|
-
}
|
|
31
|
-
const msgError: UI_I_NotifyBodyMessage = {
|
|
32
|
-
status: 'error',
|
|
33
|
-
title: localization.value.error,
|
|
34
|
-
desc: '',
|
|
35
|
-
}
|
|
36
|
-
const handleErrors = (error: Ref<API_UI_I_Error>): void => {
|
|
37
|
-
if (error.value.data?.error_message) {
|
|
38
|
-
msgError.desc = error.value.data?.error_message
|
|
39
|
-
showNotification(msgError)
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export const handleRequest = async (
|
|
44
|
-
url: string,
|
|
45
|
-
body: UI_I_RequestBody
|
|
46
|
-
): Promise<void> => {
|
|
47
|
-
// @ts-ignore
|
|
48
|
-
const { error } = await useMyFetch<never, API_UI_I_Error>(url, {
|
|
49
|
-
body,
|
|
50
|
-
method: 'POST',
|
|
51
|
-
key: Date.now().toString(),
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
if (error.value && error.value.data.error_code !== 0) {
|
|
55
|
-
handleErrors(error)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export async function sendTask({
|
|
60
|
-
method,
|
|
61
|
-
target,
|
|
62
|
-
args,
|
|
63
|
-
}: UI_I_SendTaskParams): Promise<void> {
|
|
64
|
-
const argsToBase64 = args ? base64.encode(args) : ''
|
|
65
|
-
await handleRequest('/ui/tasks', {
|
|
66
|
-
method,
|
|
67
|
-
params: {
|
|
68
|
-
target,
|
|
69
|
-
args: argsToBase64,
|
|
70
|
-
},
|
|
71
|
-
})
|
|
72
|
-
}
|
|
1
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
2
|
+
import type {
|
|
3
|
+
API_UI_I_Error,
|
|
4
|
+
UI_I_RequestBody,
|
|
5
|
+
} from '~/lib/models/store/interfaces'
|
|
6
|
+
import type {
|
|
7
|
+
UI_I_NotifyBodyMessage,
|
|
8
|
+
UI_I_SendTaskParams,
|
|
9
|
+
} from '~/lib/models/interfaces'
|
|
10
|
+
import { base64 } from './base64'
|
|
11
|
+
|
|
12
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
13
|
+
|
|
14
|
+
const showNotification = (message: UI_I_NotifyBodyMessage): void => {
|
|
15
|
+
const { title, desc, status } = message
|
|
16
|
+
const { $store } = useNuxtApp()
|
|
17
|
+
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
$store.dispatch('main/A_SHOW_NOTIFICATION', {
|
|
20
|
+
status,
|
|
21
|
+
messages: [
|
|
22
|
+
{
|
|
23
|
+
title,
|
|
24
|
+
descriptions: [desc],
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
headline: '',
|
|
28
|
+
timeout: status === 'success' ? 3000 : '',
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
const msgError: UI_I_NotifyBodyMessage = {
|
|
32
|
+
status: 'error',
|
|
33
|
+
title: localization.value.error,
|
|
34
|
+
desc: '',
|
|
35
|
+
}
|
|
36
|
+
const handleErrors = (error: Ref<API_UI_I_Error>): void => {
|
|
37
|
+
if (error.value.data?.error_message) {
|
|
38
|
+
msgError.desc = error.value.data?.error_message
|
|
39
|
+
showNotification(msgError)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const handleRequest = async (
|
|
44
|
+
url: string,
|
|
45
|
+
body: UI_I_RequestBody
|
|
46
|
+
): Promise<void> => {
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
const { error } = await useMyFetch<never, API_UI_I_Error>(url, {
|
|
49
|
+
body,
|
|
50
|
+
method: 'POST',
|
|
51
|
+
key: Date.now().toString(),
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
if (error.value && error.value.data.error_code !== 0) {
|
|
55
|
+
handleErrors(error)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export async function sendTask({
|
|
60
|
+
method,
|
|
61
|
+
target,
|
|
62
|
+
args,
|
|
63
|
+
}: UI_I_SendTaskParams): Promise<void> {
|
|
64
|
+
const argsToBase64 = args ? base64.encode(args) : ''
|
|
65
|
+
await handleRequest('/ui/tasks', {
|
|
66
|
+
method,
|
|
67
|
+
params: {
|
|
68
|
+
target,
|
|
69
|
+
args: argsToBase64,
|
|
70
|
+
},
|
|
71
|
+
})
|
|
72
|
+
}
|