bfg-common 1.4.158 → 1.4.160

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 (48) hide show
  1. package/components/common/mainNavigationPanel/MainNavigationPanelNew.vue +307 -307
  2. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/Object.vue +1 -4
  3. package/components/common/select/input/lib/models/interfaces.ts +1 -0
  4. package/components/common/wizards/vm/common/computeResource/TreeView.vue +3 -6
  5. package/components/common/wizards/vm/common/tooltip/Tooltip.vue +5 -5
  6. package/components/common/wizards/vm/migrate/Migrate.vue +161 -188
  7. package/components/common/wizards/vm/migrate/lib/config/constructDataReady.ts +166 -53
  8. package/components/common/wizards/vm/migrate/lib/config/steps.ts +93 -0
  9. package/components/common/wizards/vm/migrate/lib/models/interfaces.ts +26 -19
  10. package/components/common/wizards/vm/migrate/lib/utils.ts +0 -80
  11. package/components/common/wizards/vm/migrate/lib/validations.ts +57 -0
  12. package/components/common/wizards/vm/migrate/select/computeResource/ComputeResource.vue +18 -52
  13. package/components/common/wizards/vm/migrate/select/computeResource/lib/config/tabsPannel.ts +1 -1
  14. package/components/common/wizards/vm/migrate/select/computeResource/lib/models/interfaces.ts +2 -1
  15. package/components/common/wizards/vm/migrate/select/computeResource/tableView/TableView.vue +9 -18
  16. package/components/common/wizards/vm/migrate/select/computeResource/tableView/lib/config/clusterTable.ts +1 -1
  17. package/components/common/wizards/vm/migrate/select/computeResource/tableView/lib/config/resourcePoolTable.ts +1 -1
  18. package/components/common/wizards/vm/migrate/select/computeResource/tableView/lib/config/vappsTable.ts +20 -18
  19. package/components/common/wizards/vm/migrate/select/network/Network.vue +16 -11
  20. package/components/common/wizards/vm/migrate/select/network/lib/models/interfaces.ts +4 -0
  21. package/components/common/wizards/vm/migrate/select/network/table/network/Network.vue +16 -17
  22. package/components/common/wizards/vm/migrate/select/priority/Priority.vue +2 -16
  23. package/components/common/wizards/vm/migrate/select/storage/Storage.vue +29 -61
  24. package/components/common/wizards/vm/migrate/select/storage/configure/batch/Batch.vue +28 -33
  25. package/components/common/wizards/vm/migrate/select/storage/configure/batch/config/virtualDiskFormat.ts +30 -0
  26. package/components/common/wizards/vm/migrate/select/storage/{table/datastore/Datastore.vue → configure/batch/table/Table.vue} +48 -34
  27. package/components/common/wizards/vm/migrate/select/storage/configure/batch/table/lib/config/datastoreTable.ts +177 -0
  28. package/components/common/wizards/vm/migrate/select/storage/{table/datastore → configure/batch/table}/lib/models/types.ts +2 -2
  29. package/components/common/wizards/vm/migrate/select/storage/configure/disk/Disk.vue +11 -30
  30. package/components/common/wizards/vm/migrate/select/storage/{table/disk/Disk.vue → configure/disk/table/Table.vue} +5 -17
  31. package/components/common/wizards/vm/migrate/select/storage/{table/disk/lib/config/config.ts → configure/disk/table/lib/config/diskTable.ts} +36 -23
  32. package/components/common/wizards/vm/migrate/select/storage/{table/disk → configure/disk/table}/lib/config/tableKeys.ts +1 -1
  33. package/components/common/wizards/vm/migrate/select/storage/{table/disk → configure/disk/table}/lib/models/interfaces.ts +5 -0
  34. package/components/common/wizards/vm/migrate/select/storage/lib/models/interfaces.ts +0 -14
  35. package/components/common/wizards/vm/migrate/select/storage/selectedPerDisk/SelectedPerDisk.vue +14 -22
  36. package/components/common/wizards/vm/migrate/select/targetServer/new/New.vue +111 -144
  37. package/components/common/wizards/vm/migrate/select/targetServer/new/lib/models/interfaces.ts +8 -10
  38. package/components/common/wizards/vm/migrate/select/targetServer/targetServer.vue +11 -1
  39. package/components/common/wizards/vm/migrate/select/type/Type.vue +8 -19
  40. package/package.json +1 -1
  41. package/components/common/wizards/vm/migrate/contentHeading/ContentHeading.vue +0 -106
  42. package/components/common/wizards/vm/migrate/contentHeading/lib/models/interfaces.ts +0 -7
  43. package/components/common/wizards/vm/migrate/select/storage/diskFormat/DiskFormat.vue +0 -69
  44. package/components/common/wizards/vm/migrate/select/storage/diskFormat/lib/config/formatOptions.ts +0 -26
  45. package/components/common/wizards/vm/migrate/select/storage/table/datastore/lib/config/config.ts +0 -179
  46. package/components/common/wizards/vm/migrate/select/targetServer/new/lib/config/defaultForm.ts +0 -36
  47. /package/components/common/wizards/vm/migrate/select/storage/{table/disk → configure/disk/table}/lib/models/types.ts +0 -0
  48. /package/components/common/wizards/vm/migrate/{lib → select/type/lib}/models/types.ts +0 -0
@@ -1,59 +1,43 @@
1
1
  import type { UI_I_Localization } from '~/lib/models/interfaces'
2
- import type { UI_T_VmMigrateType } from '~/components/common/wizards/vm/migrate/lib/models/types'
2
+ import type { UI_I_MigrateReadyBlockData } from '~/components/common/wizards/vm/migrate/lib/models/interfaces'
3
+ import type { UI_I_MigrateFormLocal } from '~/components/common/wizards/vm/migrate/lib/models/interfaces'
3
4
  import { UI_E_VmMigrationType } from '~/components/common/wizards/vm/migrate/lib/models/enums'
4
- import type {
5
- UI_I_CollectedDataFormLocal,
6
- UI_I_MigrateReadyBlockData,
7
- } from '~/components/common/wizards/vm/migrate/lib/models/interfaces'
8
5
  import { UI_E_SelectStorageDiskFormat } from '~/components/common/wizards/vm/migrate/select/storage/lib/models/enums'
9
- // import type { UI_I_SelectStorageReadyData } from '~/components/common/wizards/vm/migrate/select/storage/lib/models/interfaces'
10
- import { vmDiskFormatOptions } from '~/components/common/wizards/vm/migrate/select/storage/diskFormat/lib/config/formatOptions'
11
-
12
- const storageDetailsFunc = (
6
+ import { virtualDiskFormatOptionsFunc } from '~/components/common/wizards/vm/migrate/select/storage/configure/batch/config/virtualDiskFormat'
7
+ const migrateOnlyStorageDataView = (
13
8
  localization: UI_I_Localization,
14
- migrationType: string,
15
- name: string,
16
- event: UI_I_CollectedDataFormLocal
9
+ form: UI_I_MigrateFormLocal,
10
+ vmName: string
17
11
  ): UI_I_MigrateReadyBlockData[] => {
18
- const { selectStorage } = event
12
+ const { disk_format, configure, storage } = form
19
13
 
20
- const isActivePerDiskTab: boolean = selectStorage.tab === 'configure-disk'
14
+ const isActivePerDiskTab: boolean = configure.type === 'configure-disk'
21
15
 
22
- const diskFormat = vmDiskFormatOptions().find(
23
- (file) => file.value === selectStorage.vmDiskFormat
16
+ const diskFormat = virtualDiskFormatOptionsFunc().find(
17
+ (file) => file.value === disk_format
24
18
  )!
25
19
 
26
- let result: UI_I_MigrateReadyBlockData[] = [
27
- {
28
- label: localization.common.migrationType,
29
- value: migrationType,
30
- permissions: ['batch-configure', 'configure-disk'],
31
- },
32
- {
33
- label: localization.common.virtualMachine,
34
- value: name,
35
- permissions: ['batch-configure', 'configure-disk'],
36
- },
20
+ let storageResult: UI_I_MigrateReadyBlockData[] = [
37
21
  {
38
22
  label: localization.common.storage,
39
- value: selectStorage.storage?.name,
23
+ value: storage?.name,
40
24
  permissions: ['batch-configure'],
41
25
  },
42
26
  {
43
27
  label: localization.common.diskFormat,
44
- value: diskFormat.text,
28
+ value: diskFormat.label,
45
29
  permissions: ['batch-configure'],
46
30
  },
47
31
  {
48
- label: name,
32
+ label: vmName,
49
33
  value: '',
50
34
  permissions: ['configure-disk'],
51
35
  },
52
36
  ]
53
37
 
54
- if (isActivePerDiskTab && selectStorage.configureDisks) {
55
- const perDiskItems: UI_I_MigrateReadyBlockData[] =
56
- selectStorage.configureDisks.map((disk) => {
38
+ if (isActivePerDiskTab && configure.disks) {
39
+ const perDiskItems: UI_I_MigrateReadyBlockData[] = configure.disks.map(
40
+ (disk) => {
57
41
  const isConfigurationFile = disk.file === 'Configuration file'
58
42
  const diskFormat = UI_E_SelectStorageDiskFormat[disk.disk_format]
59
43
 
@@ -67,34 +51,163 @@ const storageDetailsFunc = (
67
51
  permissions: ['configure-disk'],
68
52
  isProperty: true,
69
53
  }
70
- })
71
- result = result.concat(perDiskItems)
54
+ }
55
+ )
56
+ storageResult = [...storageResult, ...perDiskItems]
72
57
  }
73
58
 
74
- return result.filter((option) =>
75
- option.permissions.includes(selectStorage.tab)
59
+ return storageResult.filter(
60
+ (option) =>
61
+ !option.permissions.length || option.permissions.includes(configure.type)
76
62
  )
77
63
  }
78
- export const constructDataReadyViewFunc = (
79
- type: UI_T_VmMigrateType,
64
+
65
+ const setSelectNetworkDataView = (
66
+ localization: UI_I_Localization,
67
+ from: UI_I_MigrateFormLocal
68
+ ): string => {
69
+ const {
70
+ noNetworkReassignments,
71
+ networkAdapterReassignedNewDestination,
72
+ networkAdapterWillBeReassignedTo,
73
+ } = localization.common
74
+
75
+ const { isBasicNetworkMode, data } = from.network
76
+ const { sourceNetwork, value } = data
77
+
78
+ if (sourceNetwork === value) {
79
+ return noNetworkReassignments
80
+ }
81
+
82
+ if (isBasicNetworkMode) {
83
+ type Replacements = {
84
+ lan: string
85
+ network: string
86
+ }
87
+
88
+ const replacements: Replacements = {
89
+ lan: sourceNetwork,
90
+ network: value,
91
+ }
92
+ return networkAdapterWillBeReassignedTo.replace(
93
+ /{(\w+)}/g,
94
+ (_, key: keyof Replacements) => replacements[key]
95
+ )
96
+ }
97
+
98
+ return networkAdapterReassignedNewDestination.replace('{number}', '1')
99
+ }
100
+
101
+ const storageDetailsFunc = (
102
+ localization: UI_I_Localization,
80
103
  name: string,
81
- data: UI_I_CollectedDataFormLocal
104
+ form: UI_I_MigrateFormLocal
82
105
  ): UI_I_MigrateReadyBlockData[] => {
83
- const localization: UI_I_Localization = useLocal()
106
+ const { migrate_type, vMotion_priority, resource } = form
84
107
 
85
- // const details = {
86
- // storage: storageDetailsFunc,
87
- // 'resource-storage': storageDetailsFunc, // временно чтобы не было ошибка при исползоване сфере
88
- // }
108
+ const migrationType = localization.common[UI_E_VmMigrationType[migrate_type]]
89
109
 
90
- const migrationType = localization.common[UI_E_VmMigrationType[type]]
110
+ let result: UI_I_MigrateReadyBlockData[] = [
111
+ {
112
+ label: localization.common.migrationType,
113
+ value: migrationType,
114
+ permissions: ['batch-configure', 'configure-disk'],
115
+ },
116
+ {
117
+ label: localization.common.virtualMachine,
118
+ value: name,
119
+ permissions: ['batch-configure', 'configure-disk'],
120
+ },
121
+ ]
122
+
123
+ if (migrate_type === 'resource') {
124
+ const resourceResult = [
125
+ {
126
+ label: localization.common.vMotionPriority,
127
+ value: localization.common[vMotion_priority],
128
+ permissions: [],
129
+ },
130
+ {
131
+ label: localization.common.networks,
132
+ value: setSelectNetworkDataView(localization, form),
133
+ permissions: [],
134
+ },
135
+ ]
136
+ Object.entries(resource).forEach(([key, value]) => {
137
+ if (value !== null) {
138
+ resourceResult.unshift({
139
+ label: localization.common[key],
140
+ value: value.name,
141
+ permissions: [],
142
+ })
143
+ }
144
+ })
145
+ result = [...result, ...resourceResult]
146
+ }
91
147
 
92
- return storageDetailsFunc(localization, migrationType, name, data)
148
+ if (migrate_type === 'storage') {
149
+ const storageData = migrateOnlyStorageDataView(localization, form, name)
150
+ result = [...result, ...storageData]
151
+ }
152
+
153
+ if (migrate_type === 'resource-storage') {
154
+ const resourceStorageResult = [
155
+ {
156
+ label: localization.common.host,
157
+ value: '', //selectedComputeResource.selectedNode.name,
158
+ permissions: [],
159
+ },
160
+ {
161
+ label: localization.common.vMotionPriority,
162
+ value: localization.common[vMotion_priority],
163
+ permissions: [],
164
+ },
165
+ {
166
+ label: localization.common.networks,
167
+ value: setSelectNetworkDataView(localization, form),
168
+ permissions: [],
169
+ },
170
+ ]
171
+ const storageResult = migrateOnlyStorageDataView(localization, form, name)
172
+
173
+ result = [...result, ...resourceStorageResult, ...storageResult]
174
+ }
175
+
176
+ if (migrate_type === 'server') {
177
+ const serverResult = [
178
+ {
179
+ label: localization.common.vMotionPriority,
180
+ value: localization.common[vMotion_priority],
181
+ permissions: [],
182
+ },
183
+ {
184
+ label: localization.common.networks,
185
+ value: setSelectNetworkDataView(localization, form),
186
+ permissions: [],
187
+ },
188
+ ]
189
+ Object.entries(resource).forEach(([key, value]) => {
190
+ if (value !== null) {
191
+ serverResult.unshift({
192
+ label: localization.common[key],
193
+ value: value.name,
194
+ permissions: [],
195
+ })
196
+ }
197
+ })
198
+
199
+ const storageResult = migrateOnlyStorageDataView(localization, form, name)
200
+
201
+ result = [...result, ...serverResult, ...storageResult]
202
+ }
203
+
204
+ return result
205
+ }
206
+ export const constructDataReadyViewFunc = (
207
+ name: string,
208
+ data: UI_I_MigrateFormLocal
209
+ ): UI_I_MigrateReadyBlockData[] => {
210
+ const localization: UI_I_Localization = useLocal()
93
211
 
94
- // return details[type as keyof typeof details](
95
- // localization,
96
- // migrationType,
97
- // name,
98
- // data
99
- // )
212
+ return storageDetailsFunc(localization, name, data)
100
213
  }
@@ -0,0 +1,93 @@
1
+ import { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import { UI_I_WizardStep } from '~/components/atoms/wizard/lib/models/interfaces'
3
+ import { UI_E_WIZARD_STATUS } from '~/components/atoms/wizard/lib/models/enums'
4
+
5
+ export const stepsFunc = (
6
+ localization: UI_I_Localization
7
+ ): UI_I_WizardStep[] => [
8
+ {
9
+ id: 0,
10
+ title: localization.common.selectMigrationType,
11
+ subTitle: localization.common.selectMigrationTypeDesc,
12
+ status: UI_E_WIZARD_STATUS.SELECTED,
13
+ fields: {},
14
+ isValid: true,
15
+ testId: 'migrate-vm-select-type',
16
+ },
17
+ {
18
+ id: 1,
19
+ title: localization.common.selectTargetVCenterSer,
20
+ subTitle: localization.common.selectComputeResourceDesc,
21
+ status: UI_E_WIZARD_STATUS.INACTIVE,
22
+ fields: {
23
+ sign_in: {
24
+ field: '',
25
+ alert: '',
26
+ },
27
+ },
28
+ isValid: true,
29
+ testId: 'migrate-vm-select-target-server',
30
+ },
31
+ {
32
+ id: 2,
33
+ title: localization.common.selectComputeResource,
34
+ subTitle: localization.common.selectComputeResourceDesc,
35
+ status: UI_E_WIZARD_STATUS.INACTIVE,
36
+ fields: {
37
+ resource: {
38
+ field: '',
39
+ alert: '',
40
+ },
41
+ },
42
+ isValid: true,
43
+ testId: 'migrate-vm-select-compute-resource',
44
+ },
45
+ {
46
+ id: 3,
47
+ title: localization.common.selectStorage,
48
+ subTitle: localization.common.selectStorageDesc,
49
+ status: UI_E_WIZARD_STATUS.INACTIVE,
50
+ fields: {
51
+ name: {
52
+ alert: '',
53
+ field: '',
54
+ },
55
+ },
56
+ isValid: true,
57
+ testId: 'migrate-vm-select-storage',
58
+ },
59
+ {
60
+ id: 4,
61
+ title: localization.common.selectNetworks,
62
+ subTitle: localization.common.selectNetworksDesc,
63
+ status: UI_E_WIZARD_STATUS.INACTIVE,
64
+ fields: {},
65
+ isValid: true,
66
+ testId: 'migrate-vm-select-networks',
67
+ },
68
+ {
69
+ id: 5,
70
+ title: localization.common.selectVMotionPriority,
71
+ subTitle: localization.common.selectVMotionPriorityDesc,
72
+ status: UI_E_WIZARD_STATUS.INACTIVE,
73
+ fields: {},
74
+ isValid: true,
75
+ testId: 'migrate-vm-select-vMotion-priority',
76
+ },
77
+ {
78
+ id: 6,
79
+ title: localization.common.readyComplete,
80
+ subTitle: '',
81
+ status: UI_E_WIZARD_STATUS.INACTIVE,
82
+ fields: {},
83
+ isValid: true,
84
+ testId: 'migrate-vm-ready-complete',
85
+ },
86
+ ]
87
+
88
+ export const stepsSchemeInitial: number[][] = [
89
+ [0, 3, 6], // Procurator and Sphere Scheme for "Change storage only" type
90
+ [0, 2, 4, 5, 6], // Sphere Scheme for "Change compute resource only" type
91
+ [0, 2, 3, 4, 5, 6], // Sphere Scheme for "Change both compute resource and storage" type
92
+ [0, 1, 2, 3, 4, 5, 6], // Sphere Scheme for "Cross Sphere Zone export" type
93
+ ]
@@ -1,28 +1,35 @@
1
- import type { UI_I_VerticalStepItem } from '~/components/atoms/lib/models/interfaces'
2
1
  import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
3
- import type { UI_T_VmMigrateType } from '~/components/common/wizards/vm/migrate/lib/models/types'
4
2
  import type { UI_T_VmMigrateSelectStorageTab } from '~/components/common/wizards/vm/migrate/select/storage/lib/models/types'
5
- import type { UI_I_SelectStorageReadyData } from '~/components/common/wizards/vm/migrate/select/storage/lib/models/interfaces'
3
+ import type { UI_T_VmMigrateType } from '~/components/common/wizards/vm/migrate/select/type/lib/models/types'
4
+ import type { UI_I_StorageConfigurePerDiskItem } from '~/components/common/wizards/vm/migrate/select/storage/configure/disk/table/lib/models/interfaces'
6
5
  import type { UI_T_SelectVMotionPriority } from '~/components/common/wizards/vm/migrate/select/priority/lib/models/types'
7
- import type { UI_T_Project } from '~/lib/models/types'
8
- import type { UI_I_ComputeResourceDataLocal } from '~/components/common/wizards/vm/migrate/select/computeResource/lib/models/interfaces'
9
- export interface UI_I_MigrateVerticalStepItem extends UI_I_VerticalStepItem {
10
- id: string
11
- project: UI_T_Project[]
6
+ import type { UI_I_ConnectEsxiServerForm } from '~/components/common/wizards/vm/migrate/select/targetServer/new/lib/models/interfaces'
7
+ import type { UI_I_SelectNetworksFormLocal } from '~/components/common/wizards/vm/migrate/select/network/lib/models/interfaces'
8
+ import type { UI_I_ComputeResourceFormLocal } from '~/components/common/wizards/vm/migrate/select/computeResource/lib/models/interfaces'
12
9
 
13
- permissions?: UI_T_VmMigrateType[]
14
- }
10
+ export interface UI_I_MigrateFormLocal {
11
+ migrate_type: UI_T_VmMigrateType
12
+ disk_format: number
13
+ storage: any
15
14
 
16
- export interface UI_I_MigrateReadyBlockData extends UI_I_TableInfoItem {
17
- permissions: UI_T_VmMigrateSelectStorageTab[]
15
+ configure: {
16
+ type: UI_T_VmMigrateSelectStorageTab
17
+ disks: UI_I_StorageConfigurePerDiskItem[]
18
+ }
19
+ target_server: UI_I_ConnectEsxiServerForm
20
+
21
+ network: UI_I_SelectNetworksFormLocal
22
+ resource: UI_I_ComputeResourceFormLocal
23
+
24
+ vMotion_priority: UI_T_SelectVMotionPriority
18
25
  }
19
26
 
20
- export interface UI_I_CollectedDataFormLocal {
21
- selectedComputeResource: UI_I_ComputeResourceDataLocal
22
- selectStorage: UI_I_SelectStorageReadyData
23
- selectNetwork: {
24
- isShowNetworkBasic: boolean
25
- data: any // добавить интерфае потом
27
+ export interface UI_I_ChangeStepsSchemes {
28
+ [key: string]: {
29
+ [key in UI_T_VmMigrateType]?: number
26
30
  }
27
- selectedVMotionPriority: UI_T_SelectVMotionPriority
31
+ }
32
+
33
+ export interface UI_I_MigrateReadyBlockData extends UI_I_TableInfoItem {
34
+ permissions: UI_T_VmMigrateSelectStorageTab[]
28
35
  }
@@ -1,80 +0,0 @@
1
- import type { UI_I_Localization } from '~/lib/models/interfaces'
2
- import type { UI_T_VmMigrateType } from '~/components/common/wizards/vm/migrate/lib/models/types'
3
- import type { UI_T_Project } from '~/lib/models/types'
4
- import type { UI_I_MigrateVerticalStepItem } from '~/components/common/wizards/vm/migrate/lib/models/interfaces'
5
-
6
- export const stepItemsFunc = (
7
- localization: UI_I_Localization,
8
- type: UI_T_VmMigrateType,
9
- project: UI_T_Project
10
- ): UI_I_MigrateVerticalStepItem[] => {
11
- const stepItems: UI_I_MigrateVerticalStepItem[] = [
12
- {
13
- text: localization.common.selectMigrationType,
14
- disabled: false,
15
- complete: false,
16
- description: localization.common.selectMigrationTypeDesc,
17
- project: ['sphere', 'procurator'],
18
- id: 'select-migration-type',
19
- },
20
- {
21
- text: localization.common.selectTargetVCenterSer,
22
- disabled: true,
23
- complete: false,
24
- description: localization.common.selectComputeResourceDesc,
25
- project: ['sphere'],
26
- permissions: ['server'],
27
- id: 'select-target-center',
28
- },
29
- {
30
- text: localization.common.selectComputeResource,
31
- disabled: true,
32
- complete: false,
33
- description: localization.common.selectComputeResourceDesc,
34
- project: ['sphere'],
35
- permissions: ['resource', 'resource-storage', 'server'],
36
- id: 'select-compute-resource',
37
- },
38
- {
39
- text: localization.common.selectStorage,
40
- disabled: true,
41
- complete: false,
42
- description: localization.common.selectStorageDesc,
43
- project: ['sphere', 'procurator'],
44
- permissions: ['storage', 'resource-storage', 'server'],
45
- id: 'select-storage',
46
- },
47
- {
48
- text: localization.common.selectNetworks,
49
- disabled: true,
50
- complete: false,
51
- description: localization.common.selectNetworksDesc,
52
- project: ['sphere'],
53
- permissions: ['resource', 'resource-storage', 'server'],
54
- id: 'select-networks',
55
- },
56
- {
57
- text: localization.common.selectVMotionPriority,
58
- disabled: true,
59
- complete: false,
60
- description: localization.common.selectVMotionPriorityDesc,
61
- project: ['sphere'],
62
- permissions: ['resource', 'resource-storage', 'server'],
63
- id: 'select-motion-priority',
64
- },
65
- {
66
- text: localization.common.readyComplete,
67
- disabled: true,
68
- complete: false,
69
- project: ['sphere', 'procurator'],
70
- id: 'ready-complete',
71
- },
72
- ]
73
-
74
- return stepItems
75
- .filter((item) => item.project.includes(project)) // фильтрация по значению project
76
- .filter((item) => {
77
- // Если свойства permissions нет, возвращаем элемент
78
- return !item.permissions || item.permissions.includes(type)
79
- })
80
- }
@@ -0,0 +1,57 @@
1
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import type {
3
+ UI_I_ValidationReturn,
4
+ UI_I_WizardStep,
5
+ } from '~/components/atoms/wizard/lib/models/interfaces'
6
+ import type Wizard from '~/components/atoms/wizard/lib/utils/utils'
7
+ import type { UI_I_ComputeResourceFormLocal } from '~/components/common/wizards/vm/migrate/select/computeResource/lib/models/interfaces'
8
+
9
+ export const checkSelectedDatastoreSync = (
10
+ localization: UI_I_Localization,
11
+ name: string,
12
+ wizard: Wizard,
13
+ value: UI_I_WizardStep[]
14
+ ): UI_I_ValidationReturn => {
15
+ let stepHasError = false
16
+
17
+ if (!name) {
18
+ stepHasError = wizard.setValidation(3, 'name', {
19
+ fieldMessage: '',
20
+ alertMessage: localization.common.selectValidDestinationStorage,
21
+ })
22
+ } else if (wizard.hasMessage(3, 'name')) {
23
+ value = wizard.removeValidation(3, 'name', value)
24
+ }
25
+
26
+ return {
27
+ newValue: value,
28
+ stepHasError,
29
+ }
30
+ }
31
+
32
+ export const checkSelectedResourceSync = (
33
+ localization: UI_I_Localization,
34
+ resource: UI_I_ComputeResourceFormLocal,
35
+ wizard: Wizard,
36
+ value: UI_I_WizardStep[]
37
+ ): UI_I_ValidationReturn => {
38
+ let stepHasError = false
39
+
40
+ const hasSelectedData = Object.values(resource).some(
41
+ (value) => value !== null
42
+ )
43
+
44
+ if (!hasSelectedData) {
45
+ stepHasError = wizard.setValidation(2, 'resource', {
46
+ fieldMessage: '',
47
+ alertMessage: localization.common.selectValidDestinationComputeResource,
48
+ })
49
+ } else if (wizard.hasMessage(2, 'resource')) {
50
+ value = wizard.removeValidation(2, 'resource', value)
51
+ }
52
+
53
+ return {
54
+ newValue: value,
55
+ stepHasError,
56
+ }
57
+ }