bfg-common 1.3.216 → 1.3.218
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 +2 -1
- package/assets/localization/local_en.json +4 -1
- package/assets/localization/local_hy.json +2 -1
- package/assets/localization/local_kk.json +2 -1
- package/assets/localization/local_ru.json +2 -1
- package/assets/localization/local_zh.json +2 -1
- 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/lib/models/interfaces.ts +6 -11
- package/components/common/diagramMain/modals/editSettings/tabs/Security.vue +8 -11
- package/components/common/diagramMain/modals/editSettings/tabs/TeamingFailover.vue +2 -9
- package/components/common/diagramMain/modals/editSettings/tabs/TrafficShaping.vue +6 -139
- package/components/common/diagramMain/modals/lib/config/index.ts +0 -4
- package/components/common/diagramMain/modals/lib/config/initial.ts +0 -154
- package/components/common/diagramMain/modals/lib/config/networkModal.ts +92 -165
- 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/Add.vue +17 -1
- package/components/common/wizards/network/add/validations/physicalAdapter.ts +70 -0
- package/composables/productNameLocal.ts +22 -22
- 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
|
+
]
|
|
@@ -691,6 +691,22 @@ const validationFunc = async (
|
|
|
691
691
|
connectionSettingsValidation.stepHasError
|
|
692
692
|
}
|
|
693
693
|
|
|
694
|
+
// if (wizard.isValidateForStep(6, currentStep.id, nextStep.id)) {
|
|
695
|
+
// const connectionSettingsValidation = checkConnectionSettingsSync(
|
|
696
|
+
// localization.value,
|
|
697
|
+
// connectionSettings.value,
|
|
698
|
+
// wizard,
|
|
699
|
+
// value
|
|
700
|
+
// )
|
|
701
|
+
//
|
|
702
|
+
// value = connectionSettingsValidation.newValue
|
|
703
|
+
//
|
|
704
|
+
// stepHasError =
|
|
705
|
+
// stepHasError ||
|
|
706
|
+
// labelValidation.stepHasError ||
|
|
707
|
+
// connectionSettingsValidation.stepHasError
|
|
708
|
+
// }
|
|
709
|
+
|
|
694
710
|
return {
|
|
695
711
|
newValue: value,
|
|
696
712
|
stepHasError,
|
|
@@ -1002,4 +1018,4 @@ watch(
|
|
|
1002
1018
|
color: var(--main-color-mode2);
|
|
1003
1019
|
}
|
|
1004
1020
|
}
|
|
1005
|
-
</style>
|
|
1021
|
+
</style>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// import { UI_E_ValidationFields } from '~/components/common/wizards/network/add/lib/models/enums'
|
|
2
|
+
// import { UI_I_Localization } from '~/lib/models/interfaces'
|
|
3
|
+
// import type Wizard from '~/components/atoms/wizard/lib/utils/utils'
|
|
4
|
+
// import {
|
|
5
|
+
// UI_I_ValidationReturn,
|
|
6
|
+
// UI_I_WizardStep,
|
|
7
|
+
// } from '~/components/atoms/wizard/lib/models/interfaces'
|
|
8
|
+
// import {
|
|
9
|
+
// UI_I_AdapterStatus,
|
|
10
|
+
// UI_I_Adapter,
|
|
11
|
+
// UI_I_DiagramData,
|
|
12
|
+
// } from '~/components/common/diagramMain/lib/models/interfaces'
|
|
13
|
+
//
|
|
14
|
+
// export const checkPhysicalAdaptersSync = (
|
|
15
|
+
// localization: UI_I_Localization,
|
|
16
|
+
// adapterStatus: UI_I_AdapterStatus,
|
|
17
|
+
// diagramsData: UI_I_DiagramData[],
|
|
18
|
+
// switchId: string,
|
|
19
|
+
// wizard: Wizard,
|
|
20
|
+
// value: UI_I_WizardStep[]
|
|
21
|
+
// ): UI_I_ValidationReturn => {
|
|
22
|
+
// let stepHasError = false
|
|
23
|
+
//
|
|
24
|
+
// const adapters = [
|
|
25
|
+
// ...(adapterStatus.active as string[]),
|
|
26
|
+
// ...(adapterStatus.standby as string[]),
|
|
27
|
+
// ...(adapterStatus.unused as string[]),
|
|
28
|
+
// ]
|
|
29
|
+
//
|
|
30
|
+
// const switchData: UI_I_DiagramData | undefined = diagramsData.find(
|
|
31
|
+
// (diagram: UI_I_DiagramData) => diagram.id === switchId
|
|
32
|
+
// )
|
|
33
|
+
//
|
|
34
|
+
// let existing: string[] = []
|
|
35
|
+
//
|
|
36
|
+
// if (!switchData) {
|
|
37
|
+
// existing = []
|
|
38
|
+
// } else {
|
|
39
|
+
// existing =
|
|
40
|
+
// switchData.physicalAdapters?.adapters.map(
|
|
41
|
+
// (adapter: UI_I_Adapter) => adapter.id
|
|
42
|
+
// ) || []
|
|
43
|
+
// }
|
|
44
|
+
//
|
|
45
|
+
// const assignedAdapters: string[] = adapters.filter(
|
|
46
|
+
// (adapterId: string) => !existing.includes(adapterId)
|
|
47
|
+
// )
|
|
48
|
+
//
|
|
49
|
+
// if (checkVlanId(data.vlanId)) {
|
|
50
|
+
// stepHasError = wizard.setValidation(
|
|
51
|
+
// 3,
|
|
52
|
+
// UI_E_ValidationFields.PORT_PROPERTIES_VLAN,
|
|
53
|
+
// {
|
|
54
|
+
// fieldMessage: localization.vlanIdInvalidMessage,
|
|
55
|
+
// alertMessage: localization.vlanIdInvalidMessage,
|
|
56
|
+
// }
|
|
57
|
+
// )
|
|
58
|
+
// } else if (wizard.hasMessage(3, UI_E_ValidationFields.PORT_PROPERTIES_VLAN)) {
|
|
59
|
+
// value = wizard.removeValidation(
|
|
60
|
+
// 3,
|
|
61
|
+
// UI_E_ValidationFields.PORT_PROPERTIES_VLAN,
|
|
62
|
+
// value
|
|
63
|
+
// )
|
|
64
|
+
// }
|
|
65
|
+
//
|
|
66
|
+
// return {
|
|
67
|
+
// newValue: value,
|
|
68
|
+
// stepHasError,
|
|
69
|
+
// }
|
|
70
|
+
// }
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
2
|
-
|
|
3
|
-
export function productNameLocal(
|
|
4
|
-
localization: UI_I_Localization
|
|
5
|
-
): UI_I_Localization {
|
|
6
|
-
const config = useRuntimeConfig()
|
|
7
|
-
|
|
8
|
-
const keys = Object.keys(localization)
|
|
9
|
-
const productName =
|
|
10
|
-
config.public.LOCALIZATION_CODE === 'ru'
|
|
11
|
-
? config.public.PRODUCT_NAME_RU
|
|
12
|
-
: config.public.PRODUCT_NAME_EN
|
|
13
|
-
|
|
14
|
-
for (let key in localization) {
|
|
15
|
-
localization[key] = localization[key].replaceAll(
|
|
16
|
-
'{productName}',
|
|
17
|
-
String(productName)
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return localization
|
|
22
|
-
}
|
|
1
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
2
|
+
|
|
3
|
+
export function productNameLocal(
|
|
4
|
+
localization: UI_I_Localization
|
|
5
|
+
): UI_I_Localization {
|
|
6
|
+
const config = useRuntimeConfig()
|
|
7
|
+
|
|
8
|
+
const keys = Object.keys(localization)
|
|
9
|
+
const productName =
|
|
10
|
+
config.public.LOCALIZATION_CODE === 'ru'
|
|
11
|
+
? config.public.PRODUCT_NAME_RU
|
|
12
|
+
: config.public.PRODUCT_NAME_EN
|
|
13
|
+
|
|
14
|
+
for (let key in localization) {
|
|
15
|
+
localization[key] = localization[key].replaceAll(
|
|
16
|
+
'{productName}',
|
|
17
|
+
String(productName)
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return localization
|
|
22
|
+
}
|
|
@@ -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
|
+
}
|