bfg-common 1.3.211 → 1.3.214

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.
Files changed (43) hide show
  1. package/assets/localization/local_be.json +19 -21
  2. package/assets/localization/local_en.json +7 -9
  3. package/assets/localization/local_hy.json +15 -17
  4. package/assets/localization/local_kk.json +21 -23
  5. package/assets/localization/local_ru.json +2346 -2348
  6. package/assets/localization/local_zh.json +10 -12
  7. package/assets/scss/common/icons/icons-4.scss +266 -267
  8. package/assets/scss/common/normalize.scss +0 -3
  9. package/components/atoms/alert/Alert.vue +95 -95
  10. package/components/atoms/alert/Notification.vue +170 -170
  11. package/components/atoms/switch/Switch.vue +111 -111
  12. package/components/atoms/table/compact/Compact.vue +526 -526
  13. package/components/atoms/tooltip/Signpost.vue +225 -225
  14. package/components/common/pages/Tasks.vue +120 -120
  15. package/components/common/recursionTree/RecursionTree.vue +203 -203
  16. package/components/common/vm/actions/add/Add.vue +575 -575
  17. package/components/common/vm/actions/clone/Clone.vue +518 -518
  18. package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +269 -269
  19. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue +693 -693
  20. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CpuModel.vue +220 -220
  21. package/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/config/dropdownItems.ts +59 -59
  22. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +294 -294
  23. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDevice.vue +165 -165
  24. package/components/common/vm/actions/common/select/storage/lib/config/config.ts +166 -166
  25. package/components/common/vm/actions/editSettings/EditSettings.vue +313 -313
  26. package/components/common/weekSelect/WeekSelect.vue +112 -112
  27. package/components/common/weekSelect/lib/config/options.ts +10 -10
  28. package/composables/productNameLocal.ts +22 -0
  29. package/composables/useAppVersion.ts +21 -21
  30. package/composables/useEnvLanguage.ts +20 -20
  31. package/composables/useLocal.ts +18 -9
  32. package/lib/utils/sendTask.ts +72 -72
  33. package/minify.js +146 -146
  34. package/package.json +1 -1
  35. package/public/spice-console/application/codec.js +257 -257
  36. package/public/spice-console/lib/rasterEngine.js +907 -907
  37. package/public/spice-console/network/spicechannel.js +369 -369
  38. package/store/main/lib/interfaces.ts +9 -9
  39. package/store/tasks/actions.ts +133 -133
  40. package/store/tasks/getters.ts +25 -25
  41. package/store/tasks/lib/models/interfaces.ts +18 -18
  42. package/store/tasks/mutations.ts +58 -58
  43. 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
+ ]
@@ -0,0 +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 procuratorName =
10
+ config.public.LOCALIZATION_CODE === 'ru'
11
+ ? config.public.PRODUCT_NAME_RU
12
+ : config.public.PRODUCT_NAME_EN
13
+
14
+ keys.forEach((key) => {
15
+ localization[key] = localization[key].replaceAll(
16
+ '{productName}',
17
+ String(procuratorName)
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
+ }
@@ -1,9 +1,11 @@
1
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
1
2
  import localRu from '~/assets/localization/local_ru.json'
2
3
  import localEn from '~/assets/localization/local_en.json'
3
4
  import localHy from '~/assets/localization/local_hy.json'
4
5
  import localZh from '~/assets/localization/local_zh.json'
5
6
  import localKk from '~/assets/localization/local_kk.json'
6
7
  import localBe from '~/assets/localization/local_be.json'
8
+
7
9
  const locals = {
8
10
  localRu,
9
11
  localEn,
@@ -12,27 +14,34 @@ const locals = {
12
14
  localKk,
13
15
  localBe,
14
16
  }
15
- export const useLocal = () => {
17
+ export const useLocal = (): UI_I_Localization => {
16
18
  const config = useRuntimeConfig()
17
19
 
18
20
  const code: string = config?.public?.LOCALIZATION_CODE?.toLowerCase() || 'ru'
19
21
 
20
22
  document.getElementsByTagName('html')[0].setAttribute('lang', code)
21
23
 
24
+ let result: UI_I_Localization = locals.localRu
22
25
  switch (code) {
23
26
  case 'ru':
24
- return locals.localRu
27
+ result = locals.localRu
28
+ break
25
29
  case 'en':
26
- return locals.localEn
30
+ result = locals.localEn
31
+ break
27
32
  case 'hy':
28
- return locals.localHy
33
+ result = locals.localHy
34
+ break
29
35
  case 'zh':
30
- return locals.localZh
36
+ result = locals.localZh
37
+ break
31
38
  case 'kk':
32
- return locals.localKk
39
+ result = locals.localKk
40
+ break
33
41
  case 'be':
34
- return locals.localBe
35
- default:
36
- return locals.localRu
42
+ result = locals.localBe
43
+ break
37
44
  }
45
+
46
+ return productNameLocal(result)
38
47
  }
@@ -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
+ }