bfg-common 1.5.748 → 1.5.750

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 (117) hide show
  1. package/CODE_STYLE.md +109 -109
  2. package/assets/img/icons/icons-sprite-dark-3.svg +227 -227
  3. package/assets/img/icons/icons-sprite-dark-5.svg +488 -488
  4. package/assets/img/icons/icons-sprite-light-3.svg +227 -227
  5. package/assets/img/icons/icons-sprite-light-5.svg +488 -488
  6. package/assets/localization/local_be.json +6 -4
  7. package/assets/localization/local_en.json +6 -4
  8. package/assets/localization/local_hy.json +5 -3
  9. package/assets/localization/local_kk.json +5 -3
  10. package/assets/localization/local_ru.json +6 -4
  11. package/assets/localization/local_zh.json +6 -4
  12. package/components/atoms/TheIcon3.vue +50 -50
  13. package/components/atoms/collapse/CollapseNav.vue +170 -170
  14. package/components/atoms/perPage/PerPage.vue +58 -58
  15. package/components/atoms/table/dataGrid/DataGridPagination.vue +97 -97
  16. package/components/atoms/table/dataGrid/lib/config/settingsTable.ts +94 -94
  17. package/components/atoms/table/dataGrid/lib/utils/export.ts +16 -16
  18. package/components/common/backup/storage/actions/add/lib/utils.ts +51 -51
  19. package/components/common/browse/blocks/contents/filesNew/Skeleton.vue +18 -18
  20. package/components/common/diagramMain/Header.vue +4 -0
  21. package/components/common/diagramMain/modals/lib/config/vCenterModal.ts +48 -48
  22. package/components/common/diagramMain/port/Port.vue +580 -580
  23. package/components/common/layout/console/Console.vue +70 -70
  24. package/components/common/layout/theHeader/userMenu/modals/preferences/lib/models/types.ts +7 -7
  25. package/components/common/pages/backups/DetailView.vue +52 -52
  26. package/components/common/pages/backups/lib/models/interfaces.ts +36 -36
  27. package/components/common/pages/backups/modals/Modals.vue +243 -243
  28. package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/config/options.ts +6 -6
  29. package/components/common/pages/backups/modals/createBackup/lib/config/readyToCompleteOptions.ts +69 -69
  30. package/components/common/pages/backups/modals/lib/config/restore.ts +116 -116
  31. package/components/common/pages/backups/modals/lib/models/interfaces.ts +187 -187
  32. package/components/common/pages/backups/modals/restore/Restore.vue +302 -302
  33. package/components/common/pages/backups/modals/restore/disks/Disks.vue +50 -50
  34. package/components/common/pages/backups/modals/restore/lib/config/readyToCompleteOptions.ts +94 -94
  35. package/components/common/pages/backups/modals/restore/lib/config/steps.ts +130 -130
  36. package/components/common/pages/backups/modals/restore/name/lib/models/interfaces.ts +6 -6
  37. package/components/common/pages/backups/modals/restore/types/New.vue +95 -95
  38. package/components/common/pages/backups/modals/restore/types/Old.vue +62 -62
  39. package/components/common/pages/backups/modals/restore/types/Types.vue +31 -31
  40. package/components/common/pages/home/lib/models/interfaces.ts +48 -48
  41. package/components/common/pages/home/widgets/hosts/Hosts.vue +27 -27
  42. package/components/common/pages/home/widgets/hosts/lib/config/items.ts +23 -23
  43. package/components/common/pages/home/widgets/vms/VmsOld.vue +35 -35
  44. package/components/common/pages/home/widgets/vms/lib/config/items.ts +19 -19
  45. package/components/common/pages/scheduledTasks/lib/utils/utils.ts +84 -84
  46. package/components/common/pages/tasks/Tasks.vue +125 -125
  47. package/components/common/pages/tasks/table/Table.vue +373 -373
  48. package/components/common/pages/tasks/table/lib/config/config.ts +279 -279
  49. package/components/common/pages/tasks/table/lib/models/interfaces.ts +9 -9
  50. package/components/common/readyToComplete/ReadyToComplete.vue +17 -17
  51. package/components/common/select/radio/RadioGroup.vue +137 -137
  52. package/components/common/spiceConsole/Drawer.vue +420 -420
  53. package/components/common/spiceConsole/SpiceConsole.vue +184 -184
  54. package/components/common/spiceConsole/lib/models/interfaces.ts +5 -5
  55. package/components/common/tools/Actions.vue +207 -207
  56. package/components/common/treeView/TreeView.vue +52 -52
  57. package/components/common/vm/actions/clone/lib/config/steps.ts +295 -295
  58. package/components/common/vm/actions/clone/new/New.vue +438 -438
  59. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/lib/config/options.ts +28 -28
  60. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +283 -283
  61. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +156 -156
  62. package/components/common/vm/actions/common/select/compatibility/Old.vue +107 -107
  63. package/components/common/vm/actions/common/select/createType/lib/models/interfaces.ts +5 -5
  64. package/components/common/vm/actions/common/select/options/New.vue +264 -264
  65. package/components/common/vm/actions/common/select/options/Options.vue +58 -58
  66. package/components/common/vm/actions/common/select/storage/Old.vue +125 -125
  67. package/components/common/vm/actions/common/select/storage/new/New.vue +311 -311
  68. package/components/common/vm/actions/common/select/storage/new/lib/models/interfaces.ts +5 -5
  69. package/components/common/vm/actions/common/select/storage/new/lib/utils/utils.ts +21 -21
  70. package/components/common/vm/actions/common/select/template/old/Old.vue +50 -50
  71. package/components/common/vm/actions/editSettings/new/Skeleton.vue +88 -88
  72. package/components/common/vm/snapshots/modals/confirm/New.vue +5 -0
  73. package/components/common/vm/snapshots/modals/confirm/lib/models/enums.ts +2 -2
  74. package/components/common/vm/snapshots/modals/takeOrEdit/new/New.vue +23 -7
  75. package/components/common/vm/snapshots/new/New.vue +96 -13
  76. package/components/common/vm/snapshots/new/Skeleton.vue +112 -0
  77. package/components/common/vm/snapshots/new/contextMenuView/ContextMenuView.vue +17 -10
  78. package/components/common/vm/snapshots/new/lib/utils/details.ts +1 -1
  79. package/components/common/wizards/common/compatibility/Compatibility.vue +35 -35
  80. package/components/common/wizards/common/steps/computeResource/New.vue +93 -93
  81. package/components/common/wizards/common/steps/name/Name.vue +178 -178
  82. package/components/common/wizards/common/steps/name/New.vue +221 -221
  83. package/components/common/wizards/common/steps/name/Old.vue +121 -121
  84. package/components/common/wizards/common/steps/name/lib/models/interfaces.ts +4 -4
  85. package/components/common/wizards/common/steps/name/location/New.vue +40 -40
  86. package/components/common/wizards/datastore/add/Add.vue +227 -227
  87. package/components/common/wizards/datastore/add/lib/utils.ts +85 -85
  88. package/components/common/wizards/datastore/add/steps/typeMode/lib/config/typeOptions.ts +43 -43
  89. package/components/common/wizards/network/add/Add.vue +25 -5
  90. package/components/common/wizards/network/add/lib/config/config.ts +1 -1
  91. package/components/common/wizards/network/add/lib/config/initialData.ts +5 -3
  92. package/components/common/wizards/network/add/lib/config/selectConnectionTypeStep.ts +1 -0
  93. package/components/common/wizards/network/add/steps/selectTargetDevice/SelectTargetDeviceNew.vue +2 -1
  94. package/components/common/wizards/network/add/steps/selectTargetDevice/SelectTargetDeviceOld.vue +18 -6
  95. package/composables/useAppVersion.ts +21 -21
  96. package/composables/useBrowse.ts +24 -24
  97. package/composables/useLocal.ts +6 -6
  98. package/composables/useLocalCommon.ts +39 -39
  99. package/lib/models/types.ts +59 -59
  100. package/package.json +2 -2
  101. package/plugins/console.ts +21 -21
  102. package/plugins/mouse.ts +21 -21
  103. package/plugins/panelStates.ts +70 -70
  104. package/plugins/text.ts +59 -59
  105. package/public/spice-console/application/clientgui.js +854 -854
  106. package/public/spice-console/application/packetfactory.js +211 -211
  107. package/public/spice-console/application/virtualmouse.js +147 -147
  108. package/public/spice-console/lib/images/bitmap.js +203 -203
  109. package/public/spice-console/network/spicechannel.js +440 -440
  110. package/public/spice-console/process/cursorprocess.js +128 -128
  111. package/public/spice-console/process/inputprocess.js +227 -227
  112. package/public/spice-console/process/mainprocess.js +212 -212
  113. package/public/spice-console/run.js +210 -210
  114. package/store/main/mutations.ts +7 -7
  115. package/store/main/state.ts +7 -7
  116. package/store/tasks/mappers/recentTasks.ts +123 -123
  117. package/store/tasks/mutations.ts +82 -82
@@ -1,85 +1,85 @@
1
- import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
2
- import type { API_UI_I_Error } from '~/lib/models/store/interfaces'
3
- import type { UI_T_Project } from '~/lib/models/types'
4
- import { UI_E_Kind } from '~/lib/models/enums'
5
-
6
- export const checkValidityName = async ({
7
- name,
8
- wizard,
9
- project,
10
- sendMessage,
11
- datacenterId,
12
- }: {
13
- name: string
14
- wizard: Wizard
15
- project: UI_T_Project
16
- sendMessage: (message: string) => void
17
- datacenterId?: string
18
- }): Promise<void> => {
19
- wizard.setLoader(true)
20
- const url = buildValidationUrl(name, project, datacenterId)
21
-
22
- const { error } = await useMyFetch<null, API_UI_I_Error>(url, {
23
- method: 'GET',
24
- })
25
-
26
- wizard.setLoader(false)
27
-
28
- if (error.value && error.value.data.error_code !== 0) {
29
- const existError = error.value.data?.error_message || error.value.data
30
- sendMessage(existError)
31
- return
32
- }
33
- sendMessage('')
34
- }
35
-
36
- const buildValidationUrl = (
37
- name: string,
38
- project: UI_T_Project,
39
- datacenterId?: string
40
- ): string => {
41
- if (project === 'procurator') {
42
- const params = new URLSearchParams({ name })
43
- return `/ui/ds/validate?${params.toString()}`
44
- }
45
-
46
- const params = new URLSearchParams()
47
- params.set('name', name)
48
- params.set('kind', String(UI_E_Kind.STORAGE_VALIDATION_NAME))
49
- if (datacenterId) params.set('datacenter', datacenterId)
50
-
51
- return `/ui/object/validate_name_datacenter?${params.toString()}`
52
- }
53
-
54
- export const validateNameAndGenerateDataId = (
55
- name: string,
56
- _errorMessage: string,
57
- defaultDataId?: string
58
- ): string => {
59
- let baseDataId = defaultDataId || 'storage-name-alert-error'
60
-
61
- const patterns = [
62
- {
63
- regex: /^[a-zA-Z0-9_\-\.]+$/,
64
- error_message:
65
- /invalid name, must only contain letters, numbers, and '_', '-' '.' symbols/,
66
- suffix: '-invalid-name-symbols',
67
- },
68
- {
69
- regex: /^.{3,64}$/,
70
- error_message:
71
- /invalid name length, must be between: \d+ and \d+ characters/,
72
- suffix: '-invalid-name-length',
73
- },
74
- ]
75
-
76
- // Проверка error_message на соответствие шаблонам
77
-
78
- for (const pattern of patterns) {
79
- if (!pattern.regex.test(name)) {
80
- return `${baseDataId}${pattern.suffix}`
81
- }
82
- }
83
-
84
- return baseDataId
85
- }
1
+ import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
2
+ import type { API_UI_I_Error } from '~/lib/models/store/interfaces'
3
+ import type { UI_T_Project } from '~/lib/models/types'
4
+ import { UI_E_Kind } from '~/lib/models/enums'
5
+
6
+ export const checkValidityName = async ({
7
+ name,
8
+ wizard,
9
+ project,
10
+ sendMessage,
11
+ datacenterId,
12
+ }: {
13
+ name: string
14
+ wizard: Wizard
15
+ project: UI_T_Project
16
+ sendMessage: (message: string) => void
17
+ datacenterId?: string
18
+ }): Promise<void> => {
19
+ wizard.setLoader(true)
20
+ const url = buildValidationUrl(name, project, datacenterId)
21
+
22
+ const { error } = await useMyFetch<null, API_UI_I_Error>(url, {
23
+ method: 'GET',
24
+ })
25
+
26
+ wizard.setLoader(false)
27
+
28
+ if (error.value && error.value.data.error_code !== 0) {
29
+ const existError = error.value.data?.error_message || error.value.data
30
+ sendMessage(existError)
31
+ return
32
+ }
33
+ sendMessage('')
34
+ }
35
+
36
+ const buildValidationUrl = (
37
+ name: string,
38
+ project: UI_T_Project,
39
+ datacenterId?: string
40
+ ): string => {
41
+ if (project === 'procurator') {
42
+ const params = new URLSearchParams({ name })
43
+ return `/ui/ds/validate?${params.toString()}`
44
+ }
45
+
46
+ const params = new URLSearchParams()
47
+ params.set('name', name)
48
+ params.set('kind', String(UI_E_Kind.STORAGE_VALIDATION_NAME))
49
+ if (datacenterId) params.set('datacenter', datacenterId)
50
+
51
+ return `/ui/object/validate_name_datacenter?${params.toString()}`
52
+ }
53
+
54
+ export const validateNameAndGenerateDataId = (
55
+ name: string,
56
+ _errorMessage: string,
57
+ defaultDataId?: string
58
+ ): string => {
59
+ let baseDataId = defaultDataId || 'storage-name-alert-error'
60
+
61
+ const patterns = [
62
+ {
63
+ regex: /^[a-zA-Z0-9_\-\.]+$/,
64
+ error_message:
65
+ /invalid name, must only contain letters, numbers, and '_', '-' '.' symbols/,
66
+ suffix: '-invalid-name-symbols',
67
+ },
68
+ {
69
+ regex: /^.{3,64}$/,
70
+ error_message:
71
+ /invalid name length, must be between: \d+ and \d+ characters/,
72
+ suffix: '-invalid-name-length',
73
+ },
74
+ ]
75
+
76
+ // Проверка error_message на соответствие шаблонам
77
+
78
+ for (const pattern of patterns) {
79
+ if (!pattern.regex.test(name)) {
80
+ return `${baseDataId}${pattern.suffix}`
81
+ }
82
+ }
83
+
84
+ return baseDataId
85
+ }
@@ -1,43 +1,43 @@
1
- import type { UI_I_Localization } from '~/lib/models/interfaces'
2
- import type { UI_T_Project } from '~/lib/models/types'
3
- import type { 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
- return [
10
- {
11
- id: 'datastore-type-shared-storm',
12
- label: localization.common.stormSharedStorage,
13
- value: 2,
14
- disabled: false,
15
- description: localization.common.sharedStormDesc,
16
- isTooltip: false,
17
- tooltipContent: localization.common.stormSharedStorageHelpDesc,
18
- testId: 'datastore-type-shared-storm',
19
- },
20
- {
21
- id: 'datastore-type-nfs',
22
- label: localization.common.nfs,
23
- value: 4,
24
- disabled: false,
25
- description: localization.common.nfsDesc,
26
- isTooltip: false,
27
- tooltipContent: localization.common.nfsHelpDesc,
28
- testId: 'datastore-type-nfs',
29
- },
30
- ]
31
-
32
- // if (project === 'procurator') {
33
- // types.unshift({
34
- // label: localization.common.localStorage,
35
- // value: 1,
36
- // disabled: false,
37
- // description: localization.common.localDesc,
38
- // isTooltip: false,
39
- // tooltipContent: localization.common.localStorageHelpDesc,
40
- // testId: 'datastore-type-local',
41
- // })
42
- // }
43
- }
1
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import type { UI_T_Project } from '~/lib/models/types'
3
+ import type { 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
+ return [
10
+ {
11
+ id: 'datastore-type-shared-storm',
12
+ label: localization.common.stormSharedStorage,
13
+ value: 2,
14
+ disabled: false,
15
+ description: localization.common.sharedStormDesc,
16
+ isTooltip: false,
17
+ tooltipContent: localization.common.stormSharedStorageHelpDesc,
18
+ testId: 'datastore-type-shared-storm',
19
+ },
20
+ {
21
+ id: 'datastore-type-nfs',
22
+ label: localization.common.nfs,
23
+ value: 4,
24
+ disabled: false,
25
+ description: localization.common.nfsDesc,
26
+ isTooltip: false,
27
+ tooltipContent: localization.common.nfsHelpDesc,
28
+ testId: 'datastore-type-nfs',
29
+ },
30
+ ]
31
+
32
+ // if (project === 'procurator') {
33
+ // types.unshift({
34
+ // label: localization.common.localStorage,
35
+ // value: 1,
36
+ // disabled: false,
37
+ // description: localization.common.localDesc,
38
+ // isTooltip: false,
39
+ // tooltipContent: localization.common.localStorageHelpDesc,
40
+ // testId: 'datastore-type-local',
41
+ // })
42
+ // }
43
+ }
@@ -146,7 +146,7 @@ import {
146
146
  connectionSettingsInitial,
147
147
  portPropertiesInitial,
148
148
  ipFourSettingsInitial,
149
- targetDeviceInitial,
149
+ targetDeviceInitialFunc,
150
150
  addNetworkingZeroOrFirstSchemeDataFunc,
151
151
  addNetworkingSecondOrThirdSchemeDataFunc,
152
152
  addNetworkingFourthOrFifthSchemeDataFunc,
@@ -245,8 +245,19 @@ const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
245
245
 
246
246
  const readyCompleteFields = ref<UI_I_ReadyCompleteFields[]>([])
247
247
 
248
+ const globalPermissions = computed<any>(
249
+ () => $store.getters['globalPermissions/getPermissions']
250
+ )
251
+
248
252
  // Step's content data (connectionType)
249
- const connectionType = ref<string>('0')
253
+ const connectionType = ref<string>(
254
+ !globalPermissions.value['Networks.CreateSysx'] &&
255
+ !globalPermissions.value['Networks.CreatePortGroup']
256
+ ? '2'
257
+ : !globalPermissions.value['Networks.CreateSysx']
258
+ ? '1'
259
+ : '0'
260
+ )
250
261
 
251
262
  const connectionTypeLocal = computed<string>({
252
263
  get() {
@@ -278,7 +289,11 @@ const onChangeAdapterStatus = (adapterStatusNew: UI_I_AdapterStatus): void => {
278
289
  }
279
290
 
280
291
  // Step's content data and changers (targetDevice)
281
- const targetDevice = ref<UI_I_TargetDevice>(useDeepCopy(targetDeviceInitial))
292
+ const targetDevice = ref<UI_I_TargetDevice>(
293
+ useDeepCopy(
294
+ targetDeviceInitialFunc(globalPermissions.value['Networks.UpdateSwitch'])
295
+ )
296
+ )
282
297
  const mtuFromSwitch = ref<number>(1500)
283
298
 
284
299
  const onChangeTargetDevice = (newTargetDevice: UI_I_TargetDevice): void => {
@@ -369,7 +384,10 @@ watch(
369
384
  ? (targetDevice.value.selected = '1')
370
385
  : (targetDevice.value.selected = '0')
371
386
  newCT === '1' && (targetDevice.value.selected = '1')
372
- newCT === '2' && (targetDevice.value.selected = '2')
387
+ newCT === '2' &&
388
+ (globalPermissions.value['Networks.UpdateSwitch']
389
+ ? (targetDevice.value.selected = '2')
390
+ : (targetDevice.value.selected = '3'))
373
391
  }
374
392
  if (newCT === '0') {
375
393
  ;(newTD.selected === '0' || newTD.selected === '1') &&
@@ -496,7 +514,9 @@ watch(
496
514
  const reset = (): void => {
497
515
  wizard.reset()
498
516
  connectionTypeLocal.value = '0'
499
- targetDevice.value = useDeepCopy(targetDeviceInitial)
517
+ targetDevice.value = useDeepCopy(
518
+ targetDeviceInitialFunc(globalPermissions.value['Networks.UpdateSwitch'])
519
+ )
500
520
  connectionSettings.value = useDeepCopy(connectionSettingsInitial)
501
521
  portProperties.value = useDeepCopy(portPropertiesInitial)
502
522
  ipFourSettings.value = useDeepCopy(ipFourSettingsInitial)
@@ -18,7 +18,7 @@ export const {
18
18
  export const {
19
19
  servicesInitial,
20
20
  vlanIdSelectData,
21
- targetDeviceInitial,
21
+ targetDeviceInitialFunc,
22
22
  portPropertiesInitial,
23
23
  ipFourSettingsInitial,
24
24
  connectionSettingsInitial,
@@ -22,13 +22,15 @@ export const servicesInitial: UI_I_Services = {
22
22
  nVMeOverRDMA: false,
23
23
  }
24
24
 
25
- export const targetDeviceInitial: UI_I_TargetDevice = {
26
- selected: '1',
25
+ export const targetDeviceInitialFunc = (
26
+ updateSwitchPermission: boolean
27
+ ): UI_I_TargetDevice => ({
28
+ selected: updateSwitchPermission ? '1' : '3',
27
29
  network: '',
28
30
  switch: '',
29
31
  standardSwitch: '',
30
32
  mtu: 1500,
31
- }
33
+ })
32
34
 
33
35
  export const portPropertiesInitial: UI_I_PortProperties = {
34
36
  networkLabel: '',
@@ -27,5 +27,6 @@ export const selectConnectionTypeFunc = (
27
27
  value: '2',
28
28
  testId: 'physical-adapter-radio',
29
29
  id: 'physical-adapter',
30
+ permission: 'Networks.UpdateSwitch Networks.CreateSwitch',
30
31
  },
31
32
  ]
@@ -34,6 +34,7 @@
34
34
 
35
35
  <div
36
36
  v-show="props.connectionType === '2'"
37
+ v-permission="'Networks.UpdateSwitch'"
37
38
  :class="['radio-block', { selected: fieldsLocal.selected === '2' }]"
38
39
  @click="fieldsLocal.selected = '2'"
39
40
  >
@@ -46,8 +47,8 @@
46
47
  />
47
48
  </div>
48
49
 
49
- <!-- v-permission="'Networks.CreateSwitch'" -->
50
50
  <div
51
+ v-permission="'Networks.CreateSwitch'"
51
52
  :class="['radio-block', { selected: fieldsLocal.selected === '3' }]"
52
53
  @click="fieldsLocal.selected = '3'"
53
54
  >
@@ -135,7 +135,7 @@
135
135
  </div>
136
136
 
137
137
  <div v-show="props.connectionType === '2'">
138
- <div class="radio">
138
+ <div v-permission="'Networks.UpdateSwitch'" class="radio">
139
139
  <input
140
140
  id="existing-switch"
141
141
  v-model="fieldsLocal.selected"
@@ -149,6 +149,7 @@
149
149
  </label>
150
150
  </div>
151
151
  <fieldset
152
+ v-permission="'Networks.UpdateSwitch'"
152
153
  :class="{
153
154
  disabled: fieldsLocal.selected !== '2',
154
155
  }"
@@ -197,8 +198,7 @@
197
198
  </div>
198
199
 
199
200
  <div>
200
- <!-- v-permission="'Networks.CreateSwitch'"-->
201
- <div class="radio">
201
+ <div v-permission="'Networks.CreateSwitch'" class="radio">
202
202
  <input
203
203
  id="standard-switch"
204
204
  v-model="fieldsLocal.selected"
@@ -213,6 +213,7 @@
213
213
  </label>
214
214
  </div>
215
215
  <fieldset
216
+ v-permission="'Networks.CreateSwitch'"
216
217
  :class="{
217
218
  disabled: fieldsLocal.selected !== '3',
218
219
  }"
@@ -267,9 +268,7 @@ import type {
267
268
  UI_I_ArbitraryObject,
268
269
  UI_I_Localization,
269
270
  } from '~/lib/models/interfaces'
270
- import type {
271
- UI_I_TargetDevice,
272
- } from '~/components/common/wizards/network/add/lib/models/interfaces'
271
+ import type { UI_I_TargetDevice } from '~/components/common/wizards/network/add/lib/models/interfaces'
273
272
 
274
273
  const props = defineProps<{
275
274
  fields: UI_I_TargetDevice
@@ -288,6 +287,19 @@ const emits = defineEmits<{
288
287
 
289
288
  const localization = computed<UI_I_Localization>(() => useLocal())
290
289
 
290
+ const existingStandardSwitchPermission = computed<string>(() => {
291
+ switch (props.connectionType) {
292
+ case '0':
293
+ return 'Networks.CreateSysx'
294
+ case '1':
295
+ return 'Networks.CreatePortGroup'
296
+ case '2':
297
+ return 'Networks.UpdateSwitch'
298
+ default:
299
+ return ''
300
+ }
301
+ })
302
+
291
303
  const fieldsLocal = computed({
292
304
  get() {
293
305
  return props.fields
@@ -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 as string
6
-
7
- // const regexHasDot = /\./
8
- // const regexHasDotAndB = /\.\d*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 as string
6
+
7
+ // const regexHasDot = /\./
8
+ // const regexHasDotAndB = /\.\d*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,24 +1,24 @@
1
- import type { UI_I_Browse } from '~/lib/models/composables/useBrowse/interfaces'
2
-
3
- export const useBrowse = (): UI_I_Browse => {
4
- const browseInfo: UI_I_Browse = {
5
- version: '',
6
- type: '',
7
- }
8
- const userAgent = navigator.userAgent
9
- if (userAgent.match(/edg/i)) {
10
- browseInfo.version = userAgent.match(/Edg\/(\d+)/)?.[1] || ''
11
- browseInfo.type = 'edg'
12
- } else if (userAgent.match(/firefox|fxios/i)) {
13
- browseInfo.version = userAgent.match(/Firefox\/(\d+)/)?.[1] || ''
14
- browseInfo.type = 'firefox'
15
- } else if (userAgent.match(/chrome|chromium|crios/i)) {
16
- browseInfo.version = userAgent.match(/Chrome\/(\d+)/)?.[1] || ''
17
- browseInfo.type = 'chrome'
18
- } else if (userAgent.match(/safari/i)) {
19
- browseInfo.version = userAgent.match(/Safari\/(\d+)/)?.[1] || ''
20
- browseInfo.type = 'safari'
21
- }
22
-
23
- return browseInfo
24
- }
1
+ import type { UI_I_Browse } from '~/lib/models/composables/useBrowse/interfaces'
2
+
3
+ export const useBrowse = (): UI_I_Browse => {
4
+ const browseInfo: UI_I_Browse = {
5
+ version: '',
6
+ type: '',
7
+ }
8
+ const userAgent = navigator.userAgent
9
+ if (userAgent.match(/edg/i)) {
10
+ browseInfo.version = userAgent.match(/Edg\/(\d+)/)?.[1] || ''
11
+ browseInfo.type = 'edg'
12
+ } else if (userAgent.match(/firefox|fxios/i)) {
13
+ browseInfo.version = userAgent.match(/Firefox\/(\d+)/)?.[1] || ''
14
+ browseInfo.type = 'firefox'
15
+ } else if (userAgent.match(/chrome|chromium|crios/i)) {
16
+ browseInfo.version = userAgent.match(/Chrome\/(\d+)/)?.[1] || ''
17
+ browseInfo.type = 'chrome'
18
+ } else if (userAgent.match(/safari/i)) {
19
+ browseInfo.version = userAgent.match(/Safari\/(\d+)/)?.[1] || ''
20
+ browseInfo.type = 'safari'
21
+ }
22
+
23
+ return browseInfo
24
+ }
@@ -1,6 +1,6 @@
1
- import type { UI_I_Localization } from '~/lib/models/interfaces'
2
- import { useLocalCommon } from '~/composables/useLocalCommon'
3
-
4
- export const useLocal = (): UI_I_Localization => {
5
- return useLocalCommon()
6
- }
1
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import { useLocalCommon } from '~/composables/useLocalCommon'
3
+
4
+ export const useLocal = (): UI_I_Localization => {
5
+ return useLocalCommon()
6
+ }
@@ -1,39 +1,39 @@
1
- import type { UI_I_Localization } from '~/lib/models/interfaces'
2
- import localAr from '~/assets/scss/clarity/local_ar.json'
3
- import localRu from '~/assets/localization/local_ru.json'
4
- import localEn from '~/assets/localization/local_en.json'
5
- import localHy from '~/assets/localization/local_hy.json'
6
- import localZh from '~/assets/localization/local_zh.json'
7
- import localKk from '~/assets/localization/local_kk.json'
8
- import localBe from '~/assets/localization/local_be.json'
9
- import { productNameLocal } from '~/lib/utils/localizationMapper'
10
-
11
- const rawLocals: Record<string, any> = {
12
- ar: localAr,
13
- ru: localRu,
14
- en: localEn,
15
- hy: localHy,
16
- zh: localZh,
17
- kk: localKk,
18
- be: localBe,
19
- }
20
-
21
- // Кешируем уже обработанные локали
22
- const processedCache: Record<string, UI_I_Localization | undefined> = {}
23
-
24
- export const useLocalCommon = (): UI_I_Localization => {
25
- const config = useRuntimeConfig()
26
- let code = String(config?.public?.LOCALIZATION_CODE || 'ru').toLowerCase()
27
-
28
- if (code === 'ar' && !useLocalStorage('rtl')) code = 'ru'
29
-
30
- if (typeof document !== 'undefined') document.documentElement.lang = code
31
-
32
- // если в кеше нет — создаём и сохраняем
33
- if (!processedCache[code]) {
34
- const raw = rawLocals[code] || rawLocals['ru']
35
- processedCache[code] = productNameLocal(raw)
36
- }
37
-
38
- return processedCache[code] as UI_I_Localization
39
- }
1
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import localAr from '~/assets/scss/clarity/local_ar.json'
3
+ import localRu from '~/assets/localization/local_ru.json'
4
+ import localEn from '~/assets/localization/local_en.json'
5
+ import localHy from '~/assets/localization/local_hy.json'
6
+ import localZh from '~/assets/localization/local_zh.json'
7
+ import localKk from '~/assets/localization/local_kk.json'
8
+ import localBe from '~/assets/localization/local_be.json'
9
+ import { productNameLocal } from '~/lib/utils/localizationMapper'
10
+
11
+ const rawLocals: Record<string, any> = {
12
+ ar: localAr,
13
+ ru: localRu,
14
+ en: localEn,
15
+ hy: localHy,
16
+ zh: localZh,
17
+ kk: localKk,
18
+ be: localBe,
19
+ }
20
+
21
+ // Кешируем уже обработанные локали
22
+ const processedCache: Record<string, UI_I_Localization | undefined> = {}
23
+
24
+ export const useLocalCommon = (): UI_I_Localization => {
25
+ const config = useRuntimeConfig()
26
+ let code = String(config?.public?.LOCALIZATION_CODE || 'ru').toLowerCase()
27
+
28
+ if (code === 'ar' && !useLocalStorage('rtl')) code = 'ru'
29
+
30
+ if (typeof document !== 'undefined') document.documentElement.lang = code
31
+
32
+ // если в кеше нет — создаём и сохраняем
33
+ if (!processedCache[code]) {
34
+ const raw = rawLocals[code] || rawLocals['ru']
35
+ processedCache[code] = productNameLocal(raw)
36
+ }
37
+
38
+ return processedCache[code] as UI_I_Localization
39
+ }