bfg-common 1.5.635 → 1.5.636

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 (91) 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/components/atoms/TheIcon3.vue +50 -50
  7. package/components/atoms/collapse/CollapseNav.vue +170 -170
  8. package/components/atoms/perPage/PerPage.vue +58 -58
  9. package/components/atoms/table/dataGrid/DataGrid.vue +1718 -1718
  10. package/components/atoms/table/dataGrid/DataGridPagination.vue +97 -97
  11. package/components/atoms/table/dataGrid/lib/config/settingsTable.ts +94 -94
  12. package/components/atoms/table/dataGrid/lib/utils/export.ts +16 -16
  13. package/components/common/backup/storage/actions/add/lib/utils.ts +51 -51
  14. package/components/common/browse/blocks/contents/filesNew/Skeleton.vue +18 -18
  15. package/components/common/diagramMain/modals/lib/config/portModal.ts +251 -251
  16. package/components/common/diagramMain/modals/lib/config/vCenterModal.ts +48 -48
  17. package/components/common/diagramMain/port/Port.vue +580 -580
  18. package/components/common/layout/theHeader/helpMenu/About.vue +79 -79
  19. package/components/common/layout/theHeader/helpMenu/aboutOld/AboutOld.vue +79 -79
  20. package/components/common/pages/backups/DetailView.vue +52 -52
  21. package/components/common/pages/backups/lib/models/interfaces.ts +36 -36
  22. package/components/common/pages/backups/modals/Modals.vue +243 -243
  23. package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/config/options.ts +6 -6
  24. package/components/common/pages/backups/modals/createBackup/lib/config/readyToCompleteOptions.ts +69 -69
  25. package/components/common/pages/backups/modals/lib/config/restore.ts +115 -115
  26. package/components/common/pages/backups/modals/lib/models/interfaces.ts +186 -186
  27. package/components/common/pages/backups/modals/restore/name/lib/models/interfaces.ts +6 -6
  28. package/components/common/pages/home/lib/models/interfaces.ts +48 -48
  29. package/components/common/pages/home/widgets/hosts/Hosts.vue +27 -27
  30. package/components/common/pages/home/widgets/hosts/lib/config/items.ts +23 -23
  31. package/components/common/pages/home/widgets/vms/VmsOld.vue +35 -35
  32. package/components/common/pages/home/widgets/vms/lib/config/items.ts +19 -19
  33. package/components/common/pages/scheduledTasks/lib/utils/utils.ts +84 -84
  34. package/components/common/readyToComplete/ReadyToComplete.vue +17 -17
  35. package/components/common/select/radio/RadioGroup.vue +137 -137
  36. package/components/common/spiceConsole/Drawer.vue +420 -420
  37. package/components/common/spiceConsole/SpiceConsole.vue +184 -184
  38. package/components/common/spiceConsole/lib/models/interfaces.ts +5 -5
  39. package/components/common/tools/Actions.vue +207 -207
  40. package/components/common/treeView/TreeView.vue +52 -52
  41. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/lib/config/options.ts +28 -28
  42. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +283 -283
  43. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +2 -2
  44. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/New.vue +11 -11
  45. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Old.vue +11 -11
  46. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +156 -154
  47. package/components/common/vm/actions/common/select/compatibility/Old.vue +107 -107
  48. package/components/common/vm/actions/common/select/createType/lib/models/interfaces.ts +5 -5
  49. package/components/common/vm/actions/common/select/storage/Old.vue +125 -125
  50. package/components/common/vm/actions/common/select/storage/new/New.vue +311 -311
  51. package/components/common/vm/actions/common/select/storage/new/lib/models/interfaces.ts +5 -5
  52. package/components/common/vm/actions/common/select/storage/new/lib/utils/utils.ts +21 -21
  53. package/components/common/vm/actions/common/select/template/old/Old.vue +50 -50
  54. package/components/common/vm/actions/editSettings/new/Skeleton.vue +88 -88
  55. package/components/common/vm/actions/register/New.vue +1 -17
  56. package/components/common/vm/actions/register/Register.vue +313 -313
  57. package/components/common/vm/actions/register/lib/config/steps.ts +3 -11
  58. package/components/common/wizards/common/compatibility/Compatibility.vue +35 -35
  59. package/components/common/wizards/common/compatibility/New.vue +99 -99
  60. package/components/common/wizards/common/compatibility/Old.vue +53 -53
  61. package/components/common/wizards/common/steps/computeResource/New.vue +93 -93
  62. package/components/common/wizards/common/steps/name/Name.vue +178 -178
  63. package/components/common/wizards/common/steps/name/New.vue +221 -221
  64. package/components/common/wizards/common/steps/name/Old.vue +121 -121
  65. package/components/common/wizards/common/steps/name/lib/models/interfaces.ts +4 -4
  66. package/components/common/wizards/common/steps/name/location/New.vue +40 -40
  67. package/components/common/wizards/datastore/add/Add.vue +228 -228
  68. package/components/common/wizards/datastore/add/lib/utils.ts +85 -85
  69. package/components/common/wizards/datastore/add/steps/typeMode/lib/config/typeOptions.ts +43 -43
  70. package/composables/useAppVersion.ts +21 -21
  71. package/composables/useLocal.ts +6 -6
  72. package/composables/useLocalCommon.ts +39 -39
  73. package/package.json +2 -2
  74. package/plugins/console.ts +21 -21
  75. package/plugins/mouse.ts +21 -21
  76. package/plugins/panelStates.ts +70 -70
  77. package/plugins/text.ts +59 -59
  78. package/public/spice-console/application/clientgui.js +854 -854
  79. package/public/spice-console/application/packetfactory.js +211 -211
  80. package/public/spice-console/application/virtualmouse.js +147 -147
  81. package/public/spice-console/lib/images/bitmap.js +203 -203
  82. package/public/spice-console/network/spicechannel.js +440 -440
  83. package/public/spice-console/process/cursorprocess.js +128 -128
  84. package/public/spice-console/process/inputprocess.js +227 -227
  85. package/public/spice-console/process/mainprocess.js +212 -212
  86. package/public/spice-console/run.js +210 -210
  87. package/store/main/mutations.ts +7 -7
  88. package/store/main/state.ts +7 -7
  89. package/store/tasks/actions.ts +165 -165
  90. package/store/tasks/mappers/recentTasks.ts +123 -123
  91. package/store/tasks/mutations.ts +82 -82
@@ -1,313 +1,313 @@
1
- <template>
2
- <component
3
- :is="currentComponent"
4
- v-model="vmForm"
5
- v-model:location="location"
6
- :project="props.project"
7
- :ready-complete-table-info="props.readyCompleteTableInfo"
8
- :name-request-url="props.nameRequestUrl"
9
- :wizard="wizard"
10
- :selected-scheme="selectedScheme"
11
- :dynamic-steps="dynamicSteps"
12
- :name-form-submit="nameFormSubmit"
13
- :name-test-ids="nameTestIds"
14
- :allowed-location-kinds="allowedLocationKinds"
15
- :location-description="locationDescription"
16
- :is-sphere="isSphere"
17
- :compute-resource-tree-local="computeResourceTreeLocal"
18
- :compatibility-text="compatibilityText"
19
- :is-loading-compute-tree="isLoadingComputeTree"
20
- :compute-resource-alert="computeResourceAlert"
21
- :location-nodes="props.locationNodes"
22
- @finish="emits('finish')"
23
- @hide="emits('hide')"
24
- @change-steps="onChangeSteps"
25
- @change-name="onChangeName(...$event)"
26
- />
27
- </template>
28
-
29
- <script setup lang="ts">
30
- import type { UI_I_WizardStep } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
31
- import type { UI_I_ValidationReturn } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
32
- import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
33
- import type { UI_I_Localization } from '~/lib/models/interfaces'
34
- import type { UI_T_Project } from '~/lib/models/types'
35
- import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
36
- import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
37
- import type { UI_I_NameTestIds } from '~/components/common/wizards/common/steps/name/lib/models/interfaces'
38
- import type { UI_T_CompatibilityStatus } from '~/components/common/wizards/common/compatibility/lib/models/types'
39
- import {
40
- dynamicSteps,
41
- stepsFunc,
42
- stepsSchemeInitial,
43
- } from '~/components/common/vm/actions/register/lib/config/steps'
44
- import { allowedLocationKinds } from '~/components/common/vm/actions/register/lib/config'
45
-
46
- const vmForm = defineModel<any>({ required: true })
47
-
48
- const props = withDefaults(
49
- defineProps<{
50
- project: UI_T_Project
51
- readyCompleteTableInfo: UI_I_TableInfoItem[]
52
- nameRequestUrl: string
53
- isLoadingComputeTree?: boolean // для сферы
54
- computeResourceAlert?: string[] // для сферы
55
- dataCenter?: UI_I_TreeNode | null // для сферы
56
- computeResourceTree?: UI_I_TreeNode[] // для сферы
57
- locationNodes?: UI_I_TreeNode[] // для сферы
58
- }>(),
59
- {
60
- isLoadingComputeTree: false,
61
- computeResourceAlert: () => [],
62
- dataCenter: null,
63
- computeResourceTree: undefined,
64
- locationNodes: () => [],
65
- }
66
- )
67
-
68
- const emits = defineEmits<{
69
- (event: 'finish'): void
70
- (event: 'hide'): void
71
- (event: 'select-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
72
- (
73
- event: 'get-compute-resource-tree',
74
- value: { id: string | number; cb: () => void }
75
- ): void // для сферы
76
- }>()
77
-
78
- const { $store, $recursion }: any = useNuxtApp()
79
-
80
- const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
81
-
82
- const currentComponent = computed(() =>
83
- isNewView.value
84
- ? defineAsyncComponent(() => import('./New.vue'))
85
- : defineAsyncComponent(() => import('./Old.vue'))
86
- )
87
-
88
- const localization = computed<UI_I_Localization>(() => useLocal())
89
- const isSphere = computed<boolean>(() => props.project === 'sphere')
90
-
91
- const location = ref<UI_I_TreeNode | null>(props.dataCenter) // для сферы
92
-
93
- const wizard: Wizard = new Wizard(
94
- stepsFunc(localization.value, props.project),
95
- stepsSchemeInitial
96
- )
97
- if (isSphere.value) {
98
- wizard.changeScheme(1)
99
- // wizard.selectStepHard(1)
100
- }
101
-
102
- const locationDescription = computed<string>(
103
- () => localization.value.common.selectLocationVirtualMachine
104
- )
105
-
106
- const nameTestIds: UI_I_NameTestIds = {
107
- name: 'virtual-machine-name',
108
- helpIcon: 'show-vm-name-help-icon',
109
- }
110
-
111
- const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
112
- const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
113
- wizard.changeSteps(value, validationFunc)
114
- }
115
- const validationFunc = async (
116
- value: UI_I_WizardStep[],
117
- currentStep: UI_I_WizardStep,
118
- nextStep: UI_I_WizardStep
119
- ): Promise<UI_I_ValidationReturn> => {
120
- let stepHasError = false
121
- let stepShouldStop = {
122
- ifOnCurrentStep: false,
123
- ifFromAnyStep: false,
124
- stoppageStepId: -1,
125
- }
126
-
127
- wizard.setLoader(true)
128
- if (
129
- wizard.isValidateForStep(
130
- isSphere.value ? dynamicSteps.selectNameFolder : dynamicSteps.selectName,
131
- currentStep.id,
132
- nextStep.id
133
- )
134
- ) {
135
- const nameValidation = await onCheckName(value)
136
-
137
- value = nameValidation.newValue
138
- stepHasError = stepHasError || nameValidation.stepHasError
139
- } else if (
140
- isSphere.value &&
141
- wizard.isValidateForStep(
142
- dynamicSteps.selectComputeResource,
143
- currentStep.id,
144
- nextStep.id
145
- )
146
- ) {
147
- const computeResourceValidation = await checkComputeResource(value)
148
-
149
- value = computeResourceValidation.newValue
150
- stepHasError = stepHasError || computeResourceValidation.stepHasError
151
- }
152
- wizard.setLoader(false)
153
-
154
- return {
155
- newValue: value,
156
- stepHasError,
157
- stepShouldStop,
158
- }
159
- }
160
-
161
- const nameFormSubmit = ref<null | Function>(null)
162
- const onCheckName = async (
163
- value: UI_I_WizardStep[]
164
- ): Promise<UI_I_ValidationReturn> => {
165
- let stepHasError = false
166
-
167
- return new Promise((resolve) => {
168
- const step = isSphere.value
169
- ? dynamicSteps.selectNameFolder
170
- : dynamicSteps.selectName
171
- nameFormSubmit.value = (isValid: boolean) => {
172
- if (!isValid) {
173
- stepHasError = wizard.setValidation(step, 'name', {
174
- fieldMessage: 'aaa',
175
- alertMessage: 'aaa',
176
- })
177
- } else if (wizard.hasMessage(step, 'name')) {
178
- value = wizard.removeValidation(step, 'name', value)
179
- }
180
-
181
- resolve({
182
- stepHasError,
183
- newValue: value,
184
- })
185
- nameFormSubmit.value = null
186
- }
187
- })
188
- }
189
- const compatibilityText = computed<[UI_T_CompatibilityStatus, string]>(() => {
190
- const { computeResource } = vmForm.value
191
-
192
- if (!computeResource)
193
- return [
194
- 'none',
195
- localization.value.vmWizard.noDestinationComputeResourceSelected,
196
- ]
197
-
198
- let res: [UI_T_CompatibilityStatus, string] = [
199
- 'success',
200
- localization.value.common.compatibilityChecksSucceeded,
201
- ]
202
-
203
- if (!['cluster', 'host', 'resource_pool'].includes(computeResource?.type)) {
204
- res = [
205
- 'error',
206
- localization.value.common.selectValidClusterOrHostDestination,
207
- ]
208
- }
209
- if (computeResource?.type === 'cluster') {
210
- const hasHost = !!computeResource.nodes.length
211
- if (!hasHost) {
212
- res = ['error', localization.value.common.clusterNotContainAnyHosts]
213
- }
214
- }
215
-
216
- if (computeResource?.type === 'host') {
217
- if (computeResource.state === 'Error') {
218
- // TODO check Maintenance Mode
219
- res = [
220
- 'error',
221
- localization.value.common.selectedHostDisconnectedMaintenanceMode,
222
- ]
223
- }
224
- }
225
-
226
- return res
227
- })
228
- const computeResourceAlert = ref<string[]>([])
229
- const checkComputeResource = (
230
- value: UI_I_WizardStep[]
231
- ): UI_I_ValidationReturn => {
232
- let stepHasError = false
233
-
234
- const { computeResource } = vmForm.value
235
-
236
- if (
237
- !computeResource ||
238
- // compatibilityText.value[0] !== 1 ||
239
- computeResource.type === 'datacenter' ||
240
- computeResource.type === 'folder' ||
241
- (computeResource.type === 'cluster' && !computeResource.nodes.length)
242
- ) {
243
- computeResourceAlert.value = [
244
- localization.value.common.specifyValidClusterOrHostDestination,
245
- ]
246
- stepHasError = wizard.setValidation(
247
- dynamicSteps.selectComputeResource,
248
- 'computeResource',
249
- {
250
- fieldMessage: 'aaa',
251
- alertMessage: 'aaa',
252
- }
253
- )
254
- } else {
255
- computeResourceAlert.value = []
256
- if (
257
- wizard.hasMessage(dynamicSteps.selectComputeResource, 'computeResource')
258
- ) {
259
- value = wizard.removeValidation(
260
- dynamicSteps.selectComputeResource,
261
- 'computeResource',
262
- value
263
- )
264
- }
265
- }
266
-
267
- return {
268
- stepHasError,
269
- newValue: value,
270
- }
271
- }
272
-
273
- const isLoadingComputeTree = ref<boolean>(false)
274
- const onChangeName = (name: string, node: UI_I_TreeNode | null): void => {
275
- vmForm.value.name = name
276
- if (isSphere.value) {
277
- vmForm.value.locationPath = node.id
278
- vmForm.value.dataCenter = $recursion.findParentByValue(
279
- node,
280
- 'datacenter',
281
- 'type',
282
- 'parent'
283
- )
284
- isLoadingComputeTree.value = true
285
- emits('get-compute-resource-tree', {
286
- id: node.id,
287
- cb: () => {
288
- isLoadingComputeTree.value = false
289
- },
290
- })
291
- }
292
- }
293
-
294
- watch(
295
- () => vmForm.value.computeResource,
296
- (newValue, oldValue) => {
297
- if (newValue && newValue.id !== oldValue?.id) {
298
- onSelectComputeResourceTree(newValue)
299
- }
300
- },
301
- { deep: true }
302
- )
303
- const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
304
- emits('select-compute-resource-tree', node)
305
- }
306
-
307
- const computeResourceTreeLocal = computed<UI_I_TreeNode[]>(() => {
308
- // для сферы
309
- return props.computeResourceTree || []
310
- })
311
- </script>
312
-
313
- <style scoped lang="scss"></style>
1
+ <template>
2
+ <component
3
+ :is="currentComponent"
4
+ v-model="vmForm"
5
+ v-model:location="location"
6
+ :project="props.project"
7
+ :ready-complete-table-info="props.readyCompleteTableInfo"
8
+ :name-request-url="props.nameRequestUrl"
9
+ :wizard="wizard"
10
+ :selected-scheme="selectedScheme"
11
+ :dynamic-steps="dynamicSteps"
12
+ :name-form-submit="nameFormSubmit"
13
+ :name-test-ids="nameTestIds"
14
+ :allowed-location-kinds="allowedLocationKinds"
15
+ :location-description="locationDescription"
16
+ :is-sphere="isSphere"
17
+ :compute-resource-tree-local="computeResourceTreeLocal"
18
+ :compatibility-text="compatibilityText"
19
+ :is-loading-compute-tree="isLoadingComputeTree"
20
+ :compute-resource-alert="computeResourceAlert"
21
+ :location-nodes="props.locationNodes"
22
+ @finish="emits('finish')"
23
+ @hide="emits('hide')"
24
+ @change-steps="onChangeSteps"
25
+ @change-name="onChangeName(...$event)"
26
+ />
27
+ </template>
28
+
29
+ <script setup lang="ts">
30
+ import type { UI_I_WizardStep } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
31
+ import type { UI_I_ValidationReturn } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
32
+ import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
33
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
34
+ import type { UI_T_Project } from '~/lib/models/types'
35
+ import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
36
+ import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
37
+ import type { UI_I_NameTestIds } from '~/components/common/wizards/common/steps/name/lib/models/interfaces'
38
+ import type { UI_T_CompatibilityStatus } from '~/components/common/wizards/common/compatibility/lib/models/types'
39
+ import {
40
+ dynamicSteps,
41
+ stepsFunc,
42
+ stepsSchemeInitial,
43
+ } from '~/components/common/vm/actions/register/lib/config/steps'
44
+ import { allowedLocationKinds } from '~/components/common/vm/actions/register/lib/config'
45
+
46
+ const vmForm = defineModel<any>({ required: true })
47
+
48
+ const props = withDefaults(
49
+ defineProps<{
50
+ project: UI_T_Project
51
+ readyCompleteTableInfo: UI_I_TableInfoItem[]
52
+ nameRequestUrl: string
53
+ isLoadingComputeTree?: boolean // для сферы
54
+ computeResourceAlert?: string[] // для сферы
55
+ dataCenter?: UI_I_TreeNode | null // для сферы
56
+ computeResourceTree?: UI_I_TreeNode[] // для сферы
57
+ locationNodes?: UI_I_TreeNode[] // для сферы
58
+ }>(),
59
+ {
60
+ isLoadingComputeTree: false,
61
+ computeResourceAlert: () => [],
62
+ dataCenter: null,
63
+ computeResourceTree: undefined,
64
+ locationNodes: () => [],
65
+ }
66
+ )
67
+
68
+ const emits = defineEmits<{
69
+ (event: 'finish'): void
70
+ (event: 'hide'): void
71
+ (event: 'select-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
72
+ (
73
+ event: 'get-compute-resource-tree',
74
+ value: { id: string | number; cb: () => void }
75
+ ): void // для сферы
76
+ }>()
77
+
78
+ const { $store, $recursion }: any = useNuxtApp()
79
+
80
+ const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
81
+
82
+ const currentComponent = computed(() =>
83
+ isNewView.value
84
+ ? defineAsyncComponent(() => import('./New.vue'))
85
+ : defineAsyncComponent(() => import('./Old.vue'))
86
+ )
87
+
88
+ const localization = computed<UI_I_Localization>(() => useLocal())
89
+ const isSphere = computed<boolean>(() => props.project === 'sphere')
90
+
91
+ const location = ref<UI_I_TreeNode | null>(props.dataCenter) // для сферы
92
+
93
+ const wizard: Wizard = new Wizard(
94
+ stepsFunc(localization.value),
95
+ stepsSchemeInitial
96
+ )
97
+ if (isSphere.value) {
98
+ wizard.changeScheme(1)
99
+ wizard.selectStepHard(1)
100
+ }
101
+
102
+ const locationDescription = computed<string>(
103
+ () => localization.value.common.selectLocationVirtualMachine
104
+ )
105
+
106
+ const nameTestIds: UI_I_NameTestIds = {
107
+ name: 'virtual-machine-name',
108
+ helpIcon: 'show-vm-name-help-icon',
109
+ }
110
+
111
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
112
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
113
+ wizard.changeSteps(value, validationFunc)
114
+ }
115
+ const validationFunc = async (
116
+ value: UI_I_WizardStep[],
117
+ currentStep: UI_I_WizardStep,
118
+ nextStep: UI_I_WizardStep
119
+ ): Promise<UI_I_ValidationReturn> => {
120
+ let stepHasError = false
121
+ let stepShouldStop = {
122
+ ifOnCurrentStep: false,
123
+ ifFromAnyStep: false,
124
+ stoppageStepId: -1,
125
+ }
126
+
127
+ wizard.setLoader(true)
128
+ if (
129
+ wizard.isValidateForStep(
130
+ isSphere.value ? dynamicSteps.selectNameFolder : dynamicSteps.selectName,
131
+ currentStep.id,
132
+ nextStep.id
133
+ )
134
+ ) {
135
+ const nameValidation = await onCheckName(value)
136
+
137
+ value = nameValidation.newValue
138
+ stepHasError = stepHasError || nameValidation.stepHasError
139
+ } else if (
140
+ isSphere.value &&
141
+ wizard.isValidateForStep(
142
+ dynamicSteps.selectComputeResource,
143
+ currentStep.id,
144
+ nextStep.id
145
+ )
146
+ ) {
147
+ const computeResourceValidation = await checkComputeResource(value)
148
+
149
+ value = computeResourceValidation.newValue
150
+ stepHasError = stepHasError || computeResourceValidation.stepHasError
151
+ }
152
+ wizard.setLoader(false)
153
+
154
+ return {
155
+ newValue: value,
156
+ stepHasError,
157
+ stepShouldStop,
158
+ }
159
+ }
160
+
161
+ const nameFormSubmit = ref<null | Function>(null)
162
+ const onCheckName = async (
163
+ value: UI_I_WizardStep[]
164
+ ): Promise<UI_I_ValidationReturn> => {
165
+ let stepHasError = false
166
+
167
+ return new Promise((resolve) => {
168
+ const step = isSphere.value
169
+ ? dynamicSteps.selectNameFolder
170
+ : dynamicSteps.selectName
171
+ nameFormSubmit.value = (isValid: boolean) => {
172
+ if (!isValid) {
173
+ stepHasError = wizard.setValidation(step, 'name', {
174
+ fieldMessage: 'aaa',
175
+ alertMessage: 'aaa',
176
+ })
177
+ } else if (wizard.hasMessage(step, 'name')) {
178
+ value = wizard.removeValidation(step, 'name', value)
179
+ }
180
+
181
+ resolve({
182
+ stepHasError,
183
+ newValue: value,
184
+ })
185
+ nameFormSubmit.value = null
186
+ }
187
+ })
188
+ }
189
+ const compatibilityText = computed<[UI_T_CompatibilityStatus, string]>(() => {
190
+ const { computeResource } = vmForm.value
191
+
192
+ if (!computeResource)
193
+ return [
194
+ 'none',
195
+ localization.value.vmWizard.noDestinationComputeResourceSelected,
196
+ ]
197
+
198
+ let res: [UI_T_CompatibilityStatus, string] = [
199
+ 'success',
200
+ localization.value.common.compatibilityChecksSucceeded,
201
+ ]
202
+
203
+ if (!['cluster', 'host', 'resource_pool'].includes(computeResource?.type)) {
204
+ res = [
205
+ 'error',
206
+ localization.value.common.selectValidClusterOrHostDestination,
207
+ ]
208
+ }
209
+ if (computeResource?.type === 'cluster') {
210
+ const hasHost = !!computeResource.nodes.length
211
+ if (!hasHost) {
212
+ res = ['error', localization.value.common.clusterNotContainAnyHosts]
213
+ }
214
+ }
215
+
216
+ if (computeResource?.type === 'host') {
217
+ if (computeResource.state === 'Error') {
218
+ // TODO check Maintenance Mode
219
+ res = [
220
+ 'error',
221
+ localization.value.common.selectedHostDisconnectedMaintenanceMode,
222
+ ]
223
+ }
224
+ }
225
+
226
+ return res
227
+ })
228
+ const computeResourceAlert = ref<string[]>([])
229
+ const checkComputeResource = (
230
+ value: UI_I_WizardStep[]
231
+ ): UI_I_ValidationReturn => {
232
+ let stepHasError = false
233
+
234
+ const { computeResource } = vmForm.value
235
+
236
+ if (
237
+ !computeResource ||
238
+ // compatibilityText.value[0] !== 1 ||
239
+ computeResource.type === 'datacenter' ||
240
+ computeResource.type === 'folder' ||
241
+ (computeResource.type === 'cluster' && !computeResource.nodes.length)
242
+ ) {
243
+ computeResourceAlert.value = [
244
+ localization.value.common.specifyValidClusterOrHostDestination,
245
+ ]
246
+ stepHasError = wizard.setValidation(
247
+ dynamicSteps.selectComputeResource,
248
+ 'computeResource',
249
+ {
250
+ fieldMessage: 'aaa',
251
+ alertMessage: 'aaa',
252
+ }
253
+ )
254
+ } else {
255
+ computeResourceAlert.value = []
256
+ if (
257
+ wizard.hasMessage(dynamicSteps.selectComputeResource, 'computeResource')
258
+ ) {
259
+ value = wizard.removeValidation(
260
+ dynamicSteps.selectComputeResource,
261
+ 'computeResource',
262
+ value
263
+ )
264
+ }
265
+ }
266
+
267
+ return {
268
+ stepHasError,
269
+ newValue: value,
270
+ }
271
+ }
272
+
273
+ const isLoadingComputeTree = ref<boolean>(false)
274
+ const onChangeName = (name: string, node: UI_I_TreeNode | null): void => {
275
+ vmForm.value.name = name
276
+ if (isSphere.value) {
277
+ vmForm.value.locationPath = node.id
278
+ vmForm.value.dataCenter = $recursion.findParentByValue(
279
+ node,
280
+ 'datacenter',
281
+ 'type',
282
+ 'parent'
283
+ )
284
+ isLoadingComputeTree.value = true
285
+ emits('get-compute-resource-tree', {
286
+ id: node.id,
287
+ cb: () => {
288
+ isLoadingComputeTree.value = false
289
+ },
290
+ })
291
+ }
292
+ }
293
+
294
+ watch(
295
+ () => vmForm.value.computeResource,
296
+ (newValue, oldValue) => {
297
+ if (newValue && newValue.id !== oldValue?.id) {
298
+ onSelectComputeResourceTree(newValue)
299
+ }
300
+ },
301
+ { deep: true }
302
+ )
303
+ const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
304
+ emits('select-compute-resource-tree', node)
305
+ }
306
+
307
+ const computeResourceTreeLocal = computed<UI_I_TreeNode[]>(() => {
308
+ // для сферы
309
+ return props.computeResourceTree || []
310
+ })
311
+ </script>
312
+
313
+ <style scoped lang="scss"></style>
@@ -1,7 +1,6 @@
1
1
  import type { UI_I_WizardStep } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
2
2
  import { UI_E_WIZARD_STATUS } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/enums'
3
3
  import type { UI_I_Localization } from '~/lib/models/interfaces'
4
- import type { UI_T_Project } from '~/lib/models/types'
5
4
 
6
5
  export const dynamicSteps = {
7
6
  selectName: 0,
@@ -11,8 +10,7 @@ export const dynamicSteps = {
11
10
  }
12
11
 
13
12
  export const stepsFunc = (
14
- localization: UI_I_Localization,
15
- project: UI_T_Project
13
+ localization: UI_I_Localization
16
14
  ): UI_I_WizardStep[] => {
17
15
  return [
18
16
  // Procurator
@@ -21,10 +19,7 @@ export const stepsFunc = (
21
19
  stepName: '',
22
20
  title: localization.common.selectName,
23
21
  subTitle: localization.common.specifyUniqueName,
24
- status:
25
- project === 'procurator'
26
- ? UI_E_WIZARD_STATUS.SELECTED
27
- : UI_E_WIZARD_STATUS.INACTIVE,
22
+ status: UI_E_WIZARD_STATUS.SELECTED,
28
23
  isValid: true,
29
24
  testId: 'vm-select-name',
30
25
  fields: {
@@ -40,10 +35,7 @@ export const stepsFunc = (
40
35
  stepName: '',
41
36
  title: localization.vmWizard.selectNameFolder,
42
37
  subTitle: localization.common.specifyUniqueNameTargetLocation,
43
- status:
44
- project === 'procurator'
45
- ? UI_E_WIZARD_STATUS.INACTIVE
46
- : UI_E_WIZARD_STATUS.SELECTED,
38
+ status: UI_E_WIZARD_STATUS.INACTIVE,
47
39
  isValid: true,
48
40
  testId: 'vm-select-name-folder',
49
41
  fields: {