bfg-common 1.3.486 → 1.3.488
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/img/icons/icons-sprite-dark-8.svg +190 -190
- package/assets/img/icons/icons-sprite-light-8.svg +190 -190
- package/assets/scss/common/normalize.scss +340 -340
- package/components/atoms/TheIcon2.vue +1353 -1353
- package/components/atoms/loader/Loader.vue +30 -30
- package/components/atoms/loader/PreLoader.vue +38 -38
- package/components/atoms/switch/Switch.vue +111 -111
- package/components/atoms/table/compact/Compact.vue +526 -526
- package/components/common/adapterManager/ui/table/Header.vue +93 -93
- package/components/common/adapterManager/ui/table/Table.vue +162 -162
- package/components/common/context/Context.vue +99 -99
- package/components/common/layout/theHeader/userMenu/modals/preferences/View.vue +129 -129
- package/components/common/lib/config/states.ts +160 -160
- package/components/common/mainNavigationPanel/MainNavigationPanel.vue +142 -142
- package/components/common/mainNavigationPanel/MainNavigationPanelNew.vue +248 -248
- package/components/common/mainNavigationPanel/MainNavigationPanelOld.vue +288 -288
- package/components/common/readyToComplete/ReadyToComplete.vue +15 -15
- package/components/common/resource/progressBlock/ProgressBlock.vue +142 -142
- package/components/common/split/horizontal/Horizontal.vue +70 -70
- package/components/common/vm/actions/clone/Clone.vue +511 -511
- package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +273 -273
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue +697 -697
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Cpu.vue +400 -400
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +329 -329
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +305 -305
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDevice.vue +168 -168
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbController.vue +82 -82
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/Other.vue +32 -32
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCard.vue +182 -182
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptions.vue +114 -114
- package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +192 -192
- package/components/common/vm/actions/common/customizeHardware/vmoptions/tools/Tools.vue +72 -72
- package/components/common/vm/actions/common/select/computeResource/ComputeResource.vue +164 -164
- package/components/common/vm/actions/common/select/name/Name.vue +235 -235
- package/components/common/vm/actions/common/select/storage/Storage.vue +198 -198
- package/components/common/vm/actions/editSettings/EditSettings.vue +316 -316
- package/components/common/weekSelect/lib/config/options.ts +10 -10
- package/components/common/wizards/datastore/add/Add.vue +436 -436
- package/components/common/wizards/datastore/add/lib/config/stepItems.ts +191 -191
- package/components/common/wizards/datastore/add/lib/models/interfaces.ts +38 -38
- package/components/common/wizards/datastore/add/lib/utils.ts +70 -70
- package/components/common/wizards/datastore/add/local/createName/CreateName.vue +160 -160
- package/components/common/wizards/datastore/add/nfs/Nfs.vue +112 -112
- package/components/common/wizards/datastore/add/nfs/accessibility/Accessibility.vue +104 -104
- package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/compatibleTable.ts +62 -62
- package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/hostsTableItems.ts +53 -53
- package/components/common/wizards/datastore/add/readyComplete/ReadyComplete.vue +86 -86
- package/components/common/wizards/datastore/add/readyComplete/lib/config/propertiesDetails.ts +184 -184
- package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/DeviceSelection.vue +459 -459
- package/components/common/wizards/datastore/add/types/Types.vue +80 -80
- package/components/common/wizards/datastore/add/types/lib/config/typeOptions.ts +49 -49
- package/composables/useAppVersion.ts +22 -22
- package/composables/useEnvLanguage.ts +20 -20
- package/lib/utils/sendTask.ts +73 -73
- package/minify.js +146 -146
- package/package.json +1 -1
- package/plugins/spice-console/spice.console.ts +147 -147
- package/public/spice-console/application/codec.js +263 -263
- package/public/spice-console/lib/rasterEngine.js +907 -907
- package/public/spice-console/network/spicechannel.js +375 -375
- 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/mappers/recentTasks.ts +45 -43
- package/store/tasks/mutations.ts +58 -58
- package/store/tasks/state.ts +16 -16
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<section class="datastore-types">
|
|
3
|
-
<div class="header-row">
|
|
4
|
-
<span class="datastore-types__subtitle">
|
|
5
|
-
{{ localization.specifyDatastoreType }}
|
|
6
|
-
</span>
|
|
7
|
-
<div id="type-select-help-icon" class="signpost-container relative">
|
|
8
|
-
<atoms-the-icon
|
|
9
|
-
data-id="toggle-type-select-help-icon"
|
|
10
|
-
fill="#0072a3"
|
|
11
|
-
width="24px"
|
|
12
|
-
height="24px"
|
|
13
|
-
name="info-circle"
|
|
14
|
-
@click="isShowTypeHelp = !isShowTypeHelp"
|
|
15
|
-
/>
|
|
16
|
-
<atoms-tooltip-signpost
|
|
17
|
-
v-if="isShowTypeHelp"
|
|
18
|
-
elem-id="type-select-help-icon"
|
|
19
|
-
@hide="isShowTypeHelp = false"
|
|
20
|
-
>
|
|
21
|
-
<p class="help-desc">{{ localization.datastoreTypeHelpDesc }}</p>
|
|
22
|
-
</atoms-tooltip-signpost>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
<common-select-radio-group
|
|
27
|
-
v-model="selectedType"
|
|
28
|
-
:options="datastoreTypes"
|
|
29
|
-
/>
|
|
30
|
-
</section>
|
|
31
|
-
</template>
|
|
32
|
-
|
|
33
|
-
<script lang="ts" setup>
|
|
34
|
-
import { UI_I_Localization } from '~/lib/models/interfaces'
|
|
35
|
-
import { UI_T_Project } from '~/lib/models/types'
|
|
36
|
-
import { UI_I_RadioOption } from '~/components/common/select/radio/lib/models/interfaces'
|
|
37
|
-
import { datastoreTypesFunc } from '~/components/common/wizards/datastore/add/types/lib/config/typeOptions'
|
|
38
|
-
|
|
39
|
-
const props = defineProps<{
|
|
40
|
-
project: UI_T_Project
|
|
41
|
-
type: string
|
|
42
|
-
}>()
|
|
43
|
-
const emits = defineEmits<{
|
|
44
|
-
(event: 'update:type', value: string): void
|
|
45
|
-
}>()
|
|
46
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
47
|
-
|
|
48
|
-
const datastoreTypes = ref<UI_I_RadioOption[]>(
|
|
49
|
-
datastoreTypesFunc(localization.value, props.project)
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
const selectedType = computed<string>({
|
|
53
|
-
get() {
|
|
54
|
-
return props.type
|
|
55
|
-
},
|
|
56
|
-
set(newValue) {
|
|
57
|
-
emits('update:type', newValue)
|
|
58
|
-
},
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
const isShowTypeHelp = ref<boolean>(false)
|
|
62
|
-
</script>
|
|
63
|
-
|
|
64
|
-
<style lang="scss" scoped>
|
|
65
|
-
.datastore-types {
|
|
66
|
-
.signpost-container {
|
|
67
|
-
display: flex;
|
|
68
|
-
cursor: pointer;
|
|
69
|
-
|
|
70
|
-
.help-desc-container {
|
|
71
|
-
max-width: 350px;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
.header-row {
|
|
75
|
-
display: flex;
|
|
76
|
-
align-items: center;
|
|
77
|
-
gap: 10px;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<section class="datastore-types">
|
|
3
|
+
<div class="header-row">
|
|
4
|
+
<span class="datastore-types__subtitle">
|
|
5
|
+
{{ localization.specifyDatastoreType }}
|
|
6
|
+
</span>
|
|
7
|
+
<div id="type-select-help-icon" class="signpost-container relative">
|
|
8
|
+
<atoms-the-icon
|
|
9
|
+
data-id="toggle-type-select-help-icon"
|
|
10
|
+
fill="#0072a3"
|
|
11
|
+
width="24px"
|
|
12
|
+
height="24px"
|
|
13
|
+
name="info-circle"
|
|
14
|
+
@click="isShowTypeHelp = !isShowTypeHelp"
|
|
15
|
+
/>
|
|
16
|
+
<atoms-tooltip-signpost
|
|
17
|
+
v-if="isShowTypeHelp"
|
|
18
|
+
elem-id="type-select-help-icon"
|
|
19
|
+
@hide="isShowTypeHelp = false"
|
|
20
|
+
>
|
|
21
|
+
<p class="help-desc">{{ localization.datastoreTypeHelpDesc }}</p>
|
|
22
|
+
</atoms-tooltip-signpost>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<common-select-radio-group
|
|
27
|
+
v-model="selectedType"
|
|
28
|
+
:options="datastoreTypes"
|
|
29
|
+
/>
|
|
30
|
+
</section>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<script lang="ts" setup>
|
|
34
|
+
import { UI_I_Localization } from '~/lib/models/interfaces'
|
|
35
|
+
import { UI_T_Project } from '~/lib/models/types'
|
|
36
|
+
import { UI_I_RadioOption } from '~/components/common/select/radio/lib/models/interfaces'
|
|
37
|
+
import { datastoreTypesFunc } from '~/components/common/wizards/datastore/add/types/lib/config/typeOptions'
|
|
38
|
+
|
|
39
|
+
const props = defineProps<{
|
|
40
|
+
project: UI_T_Project
|
|
41
|
+
type: string
|
|
42
|
+
}>()
|
|
43
|
+
const emits = defineEmits<{
|
|
44
|
+
(event: 'update:type', value: string): void
|
|
45
|
+
}>()
|
|
46
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
47
|
+
|
|
48
|
+
const datastoreTypes = ref<UI_I_RadioOption[]>(
|
|
49
|
+
datastoreTypesFunc(localization.value, props.project)
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
const selectedType = computed<string>({
|
|
53
|
+
get() {
|
|
54
|
+
return props.type
|
|
55
|
+
},
|
|
56
|
+
set(newValue) {
|
|
57
|
+
emits('update:type', newValue)
|
|
58
|
+
},
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
const isShowTypeHelp = ref<boolean>(false)
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<style lang="scss" scoped>
|
|
65
|
+
.datastore-types {
|
|
66
|
+
.signpost-container {
|
|
67
|
+
display: flex;
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
|
|
70
|
+
.help-desc-container {
|
|
71
|
+
max-width: 350px;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
.header-row {
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
gap: 10px;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { UI_I_Localization } from '~/lib/models/interfaces'
|
|
2
|
-
import { UI_T_Project } from '~/lib/models/types'
|
|
3
|
-
import { UI_I_RadioOption } from '~/components/common/select/radio/lib/models/interfaces'
|
|
4
|
-
|
|
5
|
-
export const datastoreTypesFunc = (
|
|
6
|
-
localization: UI_I_Localization,
|
|
7
|
-
project: UI_T_Project
|
|
8
|
-
): UI_I_RadioOption[] => {
|
|
9
|
-
const types = [
|
|
10
|
-
{
|
|
11
|
-
label: localization.stormSharedStorage,
|
|
12
|
-
value: 'shared-storm',
|
|
13
|
-
disabled: false,
|
|
14
|
-
description: localization.sharedStormDesc,
|
|
15
|
-
isTooltip: false,
|
|
16
|
-
tooltipContent: localization.stormSharedStorageHelpDesc,
|
|
17
|
-
testId: 'datastore-type-shared-storm',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
label: localization.nfs,
|
|
21
|
-
value: 'nfs',
|
|
22
|
-
disabled: false,
|
|
23
|
-
description: localization.nfsDesc,
|
|
24
|
-
isTooltip: false,
|
|
25
|
-
tooltipContent: localization.nfsHelpDesc,
|
|
26
|
-
testId: 'datastore-type-nfs',
|
|
27
|
-
},
|
|
28
|
-
// {
|
|
29
|
-
// label: localization.vVol,
|
|
30
|
-
// value: 'vVol',
|
|
31
|
-
// disabled: true,
|
|
32
|
-
// desc: localization.vVolDesc,
|
|
33
|
-
// },
|
|
34
|
-
]
|
|
35
|
-
|
|
36
|
-
if (project === 'procurator') {
|
|
37
|
-
types.unshift({
|
|
38
|
-
label: localization.localStorage,
|
|
39
|
-
value: 'local',
|
|
40
|
-
disabled: false,
|
|
41
|
-
description: localization.localDesc,
|
|
42
|
-
isTooltip: false,
|
|
43
|
-
tooltipContent: localization.localStorageHelpDesc,
|
|
44
|
-
testId: 'datastore-type-local',
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return types
|
|
49
|
-
}
|
|
1
|
+
import { UI_I_Localization } from '~/lib/models/interfaces'
|
|
2
|
+
import { UI_T_Project } from '~/lib/models/types'
|
|
3
|
+
import { UI_I_RadioOption } from '~/components/common/select/radio/lib/models/interfaces'
|
|
4
|
+
|
|
5
|
+
export const datastoreTypesFunc = (
|
|
6
|
+
localization: UI_I_Localization,
|
|
7
|
+
project: UI_T_Project
|
|
8
|
+
): UI_I_RadioOption[] => {
|
|
9
|
+
const types = [
|
|
10
|
+
{
|
|
11
|
+
label: localization.stormSharedStorage,
|
|
12
|
+
value: 'shared-storm',
|
|
13
|
+
disabled: false,
|
|
14
|
+
description: localization.sharedStormDesc,
|
|
15
|
+
isTooltip: false,
|
|
16
|
+
tooltipContent: localization.stormSharedStorageHelpDesc,
|
|
17
|
+
testId: 'datastore-type-shared-storm',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: localization.nfs,
|
|
21
|
+
value: 'nfs',
|
|
22
|
+
disabled: false,
|
|
23
|
+
description: localization.nfsDesc,
|
|
24
|
+
isTooltip: false,
|
|
25
|
+
tooltipContent: localization.nfsHelpDesc,
|
|
26
|
+
testId: 'datastore-type-nfs',
|
|
27
|
+
},
|
|
28
|
+
// {
|
|
29
|
+
// label: localization.vVol,
|
|
30
|
+
// value: 'vVol',
|
|
31
|
+
// disabled: true,
|
|
32
|
+
// desc: localization.vVolDesc,
|
|
33
|
+
// },
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
if (project === 'procurator') {
|
|
37
|
+
types.unshift({
|
|
38
|
+
label: localization.localStorage,
|
|
39
|
+
value: 'local',
|
|
40
|
+
disabled: false,
|
|
41
|
+
description: localization.localDesc,
|
|
42
|
+
isTooltip: false,
|
|
43
|
+
tooltipContent: localization.localStorageHelpDesc,
|
|
44
|
+
testId: 'datastore-type-local',
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return types
|
|
49
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
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 regexHasDotAndB = /\.\d*b$/
|
|
10
|
-
const regexHasDotAndD = /\..*d/
|
|
11
|
-
|
|
12
|
-
const isBeta = regexHasDotAndB.test(version)
|
|
13
|
-
const isDev =
|
|
14
|
-
regexHasDotAndD.test(version) ||
|
|
15
|
-
(!regexHasDot.test(version) && version.length < 8)
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
version,
|
|
19
|
-
isBeta,
|
|
20
|
-
isDev,
|
|
21
|
-
}
|
|
22
|
-
}
|
|
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 regexHasDotAndB = /\.\d*b$/
|
|
10
|
+
const regexHasDotAndD = /\..*d/
|
|
11
|
+
|
|
12
|
+
const isBeta = regexHasDotAndB.test(version)
|
|
13
|
+
const isDev =
|
|
14
|
+
regexHasDotAndD.test(version) ||
|
|
15
|
+
(!regexHasDot.test(version) && version.length < 8)
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
version,
|
|
19
|
+
isBeta,
|
|
20
|
+
isDev,
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -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,73 +1,73 @@
|
|
|
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
|
-
encode = true,
|
|
64
|
-
}: UI_I_SendTaskParams): Promise<void> {
|
|
65
|
-
const argsToBase64 = encode ? (args ? base64.encode(args) : '') : args
|
|
66
|
-
await handleRequest('/ui/tasks', {
|
|
67
|
-
method,
|
|
68
|
-
params: {
|
|
69
|
-
target,
|
|
70
|
-
args: argsToBase64,
|
|
71
|
-
},
|
|
72
|
-
})
|
|
73
|
-
}
|
|
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
|
+
encode = true,
|
|
64
|
+
}: UI_I_SendTaskParams): Promise<void> {
|
|
65
|
+
const argsToBase64 = encode ? (args ? base64.encode(args) : '') : args
|
|
66
|
+
await handleRequest('/ui/tasks', {
|
|
67
|
+
method,
|
|
68
|
+
params: {
|
|
69
|
+
target,
|
|
70
|
+
args: argsToBase64,
|
|
71
|
+
},
|
|
72
|
+
})
|
|
73
|
+
}
|