bfg-common 1.3.216 → 1.3.217

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 (44) hide show
  1. package/assets/localization/local_en.json +3 -1
  2. package/components/atoms/alert/Alert.vue +95 -95
  3. package/components/atoms/alert/Notification.vue +170 -170
  4. package/components/atoms/switch/Switch.vue +111 -111
  5. package/components/atoms/table/compact/Compact.vue +526 -526
  6. package/components/atoms/tooltip/Signpost.vue +225 -225
  7. package/components/common/diagramMain/lib/models/interfaces.ts +5 -5
  8. package/components/common/diagramMain/modals/editSettings/tabs/Security.vue +6 -6
  9. package/components/common/diagramMain/modals/editSettings/tabs/TeamingFailover.vue +2 -9
  10. package/components/common/diagramMain/modals/editSettings/tabs/TrafficShaping.vue +4 -132
  11. package/components/common/diagramMain/modals/lib/config/index.ts +0 -2
  12. package/components/common/diagramMain/modals/lib/config/initial.ts +0 -62
  13. package/components/common/diagramMain/modals/lib/config/networkModal.ts +92 -165
  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/components/common/wizards/network/add/Add.vue +17 -1
  29. package/components/common/wizards/network/add/validations/physicalAdapter.ts +70 -0
  30. package/composables/productNameLocal.ts +22 -22
  31. package/composables/useAppVersion.ts +21 -21
  32. package/composables/useEnvLanguage.ts +20 -20
  33. package/lib/utils/sendTask.ts +72 -72
  34. package/minify.js +146 -146
  35. package/package.json +1 -1
  36. package/public/spice-console/application/codec.js +257 -257
  37. package/public/spice-console/lib/rasterEngine.js +907 -907
  38. package/public/spice-console/network/spicechannel.js +369 -369
  39. package/store/main/lib/interfaces.ts +9 -9
  40. package/store/tasks/actions.ts +133 -133
  41. package/store/tasks/getters.ts +25 -25
  42. package/store/tasks/lib/models/interfaces.ts +18 -18
  43. package/store/tasks/mutations.ts +58 -58
  44. package/store/tasks/state.ts +16 -16
@@ -1,575 +1,575 @@
1
- <template>
2
- <div class="add-vm">
3
- <atoms-wizard
4
- show
5
- :steps="wizard.steps"
6
- :selected-scheme="selectedScheme"
7
- :is-loading="wizard.wizardLoader.status"
8
- :loader-messages="wizard.wizardLoader.messages"
9
- :title="localization.newVirtualMachine2"
10
- :was-completed="wasCompleted"
11
- :localization="localization"
12
- @change-steps="onChangeSteps"
13
- @hide="onHideModal"
14
- @submit="onFinish"
15
- >
16
- <template #modalBody="{ selectedStep }">
17
- <div class="add-vm-content">
18
- <common-vm-actions-common-select-create-type
19
- v-show="selectedStep.id === 0"
20
- :import-from-v-m-warev-sphere="props.importFromVMWarevSphere"
21
- />
22
- <common-vm-actions-common-select-name
23
- v-show="selectedStep.id === 1 || selectedStep.id === 2"
24
- :show="selectedStep.id === 1 || selectedStep.id === 2"
25
- :name-form-submit="nameFormSubmit"
26
- :project="props.project"
27
- :data-center="props.dataCenter"
28
- @submit="onChangeName(...$event)"
29
- @check-name="emits('check-name', $event)"
30
- />
31
- <common-vm-actions-common-select-compute-resource
32
- v-if="isSphere"
33
- v-show="selectedStep.id === 3"
34
- v-model="vmForm.computeResource"
35
- :compute-resource-submit="computeResourceSubmit"
36
- :data-center="vmForm.dataCenter"
37
- :compute-resource="props.computeResource"
38
- :compute-resource-tree="props.computeResourceTree"
39
- @submit="onChangeComputeResource"
40
- @select-compute-resource-tree="onSelectComputeResourceTree"
41
- @get-compute-resource-tree="
42
- emits('get-compute-resource-tree', $event)
43
- "
44
- @show-compute-resource-tree="
45
- emits('show-compute-resource-tree', $event)
46
- "
47
- @clear-compute-resource-tree="
48
- emits('clear-compute-resource-tree', $event)
49
- "
50
- />
51
- <common-vm-actions-common-select-storage
52
- v-show="selectedStep.id === 4"
53
- :storage-submit="storageSubmit"
54
- :datastore="props.datastore"
55
- :get-datastore-table-func="props.getDatastoreTableFunc"
56
- @submit="onChangeStorage"
57
- />
58
- <common-vm-actions-common-select-compatibility
59
- v-show="selectedStep.id === 5"
60
- :options="compatibility"
61
- :error-validation-fields="props.errorValidationFields"
62
- @change="onChangeCompatibility"
63
- @remove-error-by-title="emits('remove-error-by-title', $event)"
64
- />
65
- <common-vm-actions-common-select-os
66
- v-show="selectedStep.id === 6 || selectedStep.id === 7"
67
- :families-options="guestOsFamilies"
68
- :versions-options="guestOsVersions"
69
- :machine-types-options="machineTypes"
70
- :error-validation-fields="props.errorValidationFields"
71
- @change="onChangeOs"
72
- @remove-error-by-title="emits('remove-error-by-title', $event)"
73
- />
74
- <common-vm-actions-common-customize-hardware
75
- v-show="selectedStep.id === 8"
76
- :vm-name="vmForm.name"
77
- :guest-machine-type="vmForm.guestMachineType"
78
- :guest-os-family="vmForm.guestOsFamily"
79
- :guest-os-version="vmForm.guestOsVersion"
80
- :storage="vmForm.storage"
81
- :hard-disks-for-boot-options="virtualHardwareHardDisksLocal"
82
- :cd-dvd-drives-for-boot-options="virtualHardwareCdDvdDrivesLocal"
83
- :networks-for-boot-options="virtualHardwareNetworksLocal"
84
- :cd-dvd-drives="virtualHardwareCdDvdDrivesLocal"
85
- :customize-hardware-submit="customizeHardwareSubmit"
86
- :max-cpus="maxCpus"
87
- :max-memory="maxMemory"
88
- :cpu-models="cpuModels"
89
- :selected-nav-item="selectedNavItem"
90
- :nodes="props.nodes"
91
- :files="props.files"
92
- :networks-table="props.networksTable"
93
- :error-validation-fields="props.errorValidationFields"
94
- :get-datastore-table-func="props.getDatastoreTableFunc"
95
- :datastore="props.datastore"
96
- :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
97
- :passthrough-devices="props.passthroughDevices"
98
- @change-boot-order="onChangeBootOrder"
99
- @send-data="onChangeCustomizeHardware"
100
- @get-storage="emits('get-storage', $event)"
101
- @get-folders-or-files="emits('get-folders-or-files', $event)"
102
- @get-active-device-child="emits('get-active-device-child', $event)"
103
- @show-datastore-child="emits('show-datastore-child', $event)"
104
- @remove-error-by-title="emits('remove-error-by-title', $event)"
105
- @get-networks-table="emits('get-networks-table', $event)"
106
- @get-pci-devices="emits('get-pci-devices')"
107
- />
108
- <common-vm-actions-common-ready-to-complete
109
- v-if="selectedStep.id === 9"
110
- :ready-complete-table-info="props.readyCompleteTableInfo"
111
- />
112
- <span v-if="selectedStep.id > 5" class="vm-hardware-version">{{
113
- compatibilityInfo
114
- }}</span>
115
- </div>
116
- </template>
117
-
118
- <template #modalFooterContent>
119
- <div v-if="isShowPowerOn" class="power-on-by-default-wrap">
120
- <input
121
- id="power-on-by-default"
122
- v-model="isPowerOnByDefault"
123
- type="checkbox"
124
- />
125
- <label for="power-on-by-default" class="label-text-normal">{{
126
- localization.powerOnByDefault
127
- }}</label>
128
- </div>
129
- </template>
130
- </atoms-wizard>
131
- </div>
132
- </template>
133
-
134
- <script setup lang="ts">
135
- import type {
136
- UI_I_Localization,
137
- UI_I_ArbitraryObject,
138
- } from '~/lib/models/interfaces'
139
- import type { UI_T_Project } from '~/lib/models/types'
140
- import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
141
- import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
142
- import type {
143
- UI_I_DatastoreTableItem,
144
- UI_I_FolderOrFileTreePayload,
145
- } from '~/lib/models/store/storage/interfaces'
146
- import type {
147
- API_UI_I_Error,
148
- UI_I_ErrorValidationField,
149
- } from '~/lib/models/store/interfaces'
150
- import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
151
- import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
152
- import type {
153
- UI_T_AddVmFinishFunc,
154
- UI_T_SelectedNavItem,
155
- } from '~/components/common/vm/actions/common/lib/models/types'
156
- import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
157
- import type {
158
- UI_I_ValidationReturn,
159
- UI_I_WizardStep,
160
- } from '~/components/atoms/wizard/lib/models/interfaces'
161
- import type {
162
- UI_I_VmForm,
163
- UI_I_VmFormCash,
164
- } from '~/components/common/vm/actions/common/lib/models/interfaces'
165
- import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
166
- import type { UI_I_OsChange } from '~/components/common/vm/actions/common/select/lib/models/interfaces'
167
- import type {
168
- UI_I_SendDataCpu,
169
- UI_I_SendDataMemory,
170
- UI_I_SendDataNewCdDvdDrive,
171
- UI_I_SendDataNewHardDisk,
172
- UI_I_SendDataNewNetwork,
173
- } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
174
- import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
175
- import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/models/types'
176
- import type { UI_I_PciDevice } from '~/lib/models/store/vm/interfaces'
177
- import { capabilities } from '~/components/common/vm/actions/common/lib/config/capabilities'
178
- import {
179
- stepsSchemeInitial,
180
- stepsFunc,
181
- } from '~/components/common/vm/actions/add/lib/config/steps'
182
- import Wizard from '~/components/atoms/wizard/lib/utils/utils'
183
-
184
- const props = defineProps<{
185
- project: UI_T_Project
186
- nodes: UI_I_FileTreeNode[]
187
- files: UI_I_FileTreeNode[]
188
- networksTable: UI_I_NetworkTableItem[]
189
- datastore: UI_I_DatastoreTableItem[]
190
- errorValidationFields: UI_I_ErrorValidationField[]
191
- readyCompleteTableInfo: UI_I_TableInfoItem[]
192
- vmCpuHelpTextSecond: string
193
- importFromVMWarevSphere: string
194
- finishFunc: UI_T_AddVmFinishFunc
195
- getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
196
- validateSendDataFunc: UI_T_AddVmFinishFunc<
197
- [UI_T_SelectedNavItem, null | number] | null
198
- >
199
- passthroughDevices: UI_I_PciDevice[]
200
- vmNameInWizard: string
201
- dataCenter?: UI_I_TreeNode // для сферы
202
- computeResource?: UI_I_TreeNode // для сферы
203
- computeResourceTree?: UI_I_TreeNode[] // для сферы
204
- }>()
205
-
206
- const emits = defineEmits<{
207
- (event: 'check-name', value: [string, (error: API_UI_I_Error) => void]): void
208
- (event: 'get-storage', value: UI_I_TablePayload): void
209
- (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
210
- (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
211
- (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
212
- (event: 'remove-error-by-title', value: string): void
213
- (event: 'get-networks-table', value: UI_I_TablePayload): void
214
- (event: 'get-pci-devices'): void
215
- (event: 'get-pci-devices'): void
216
- (event: 'hide'): void
217
- (
218
- event: 'get-compute-resource-tree',
219
- value: { id: string | number; cb: () => void }
220
- ): void // для сферы
221
- (event: 'show-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
222
- (event: 'select-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
223
- (event: 'clear-compute-resource-tree'): void // для сферы
224
- }>()
225
-
226
- const isSphere = computed<boolean>(() => props.project === 'sphere')
227
-
228
- const { $recursion } = useNuxtApp()
229
-
230
- const localization = computed<UI_I_Localization>(() => useLocal())
231
-
232
- const wizard: Wizard = new Wizard(
233
- stepsFunc(localization.value),
234
- stepsSchemeInitial
235
- )
236
- if (isSphere.value) wizard.changeScheme(1)
237
- const wasCompleted = computed<boolean>(() => wizard.wasCompleted())
238
- const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
239
- const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
240
-
241
- const isShowPowerOn = computed<boolean>(() => wizard.selectedStepId > 8)
242
-
243
- const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
244
- wizard.changeSteps(value, validationFunc, validateSendData)
245
- }
246
- const validationFunc = async (
247
- value: UI_I_WizardStep[],
248
- currentStep: UI_I_WizardStep,
249
- nextStep: UI_I_WizardStep
250
- ): Promise<UI_I_ValidationReturn> => {
251
- let stepHasError = false
252
- let stepShouldStop = {
253
- ifOnCurrentStep: false,
254
- ifFromAnyStep: false,
255
- stoppageStepId: -1,
256
- }
257
-
258
- wizard.setLoader(true)
259
- if (
260
- wizard.isValidateForStep(
261
- isSphere.value ? 2 : 1,
262
- currentStep.id,
263
- nextStep.id
264
- )
265
- ) {
266
- const nameValidation = await checkName(value)
267
-
268
- value = nameValidation.newValue
269
- stepHasError = stepHasError || nameValidation.stepHasError
270
- } else if (wizard.isValidateForStep(4, currentStep.id, nextStep.id)) {
271
- const storageValidation = await checkStorage(value)
272
-
273
- value = storageValidation.newValue
274
-
275
- stepHasError = stepHasError || storageValidation.stepHasError
276
- } else if (wizard.isValidateForStep(8, currentStep.id, nextStep.id)) {
277
- const storageValidation = await checkCustomizeHardware(value)
278
-
279
- value = storageValidation.newValue
280
-
281
- stepHasError = stepHasError || storageValidation.stepHasError
282
- }
283
- wizard.setLoader(false)
284
-
285
- return {
286
- newValue: value,
287
- stepHasError,
288
- stepShouldStop,
289
- }
290
- }
291
- const checkName = async (
292
- value: UI_I_WizardStep[]
293
- ): Promise<UI_I_ValidationReturn> => {
294
- let stepHasError = false
295
-
296
- return new Promise((resolve) => {
297
- const step = isSphere.value ? 2 : 1
298
- nameFormSubmit.value = (isValid: boolean) => {
299
- if (!isValid) {
300
- stepHasError = wizard.setValidation(step, 'name', {
301
- fieldMessage: 'aaa',
302
- alertMessage: 'aaa',
303
- })
304
- } else if (wizard.hasMessage(step, 'name')) {
305
- value = wizard.removeValidation(step, 'name', value)
306
- }
307
-
308
- resolve({
309
- stepHasError,
310
- newValue: value,
311
- })
312
- nameFormSubmit.value = null
313
- }
314
- })
315
- }
316
- const checkStorage = async (
317
- value: UI_I_WizardStep[]
318
- ): Promise<UI_I_ValidationReturn> => {
319
- let stepHasError = false
320
-
321
- return new Promise((resolve) => {
322
- storageSubmit.value = (isValid: boolean) => {
323
- if (!isValid) {
324
- stepHasError = wizard.setValidation(4, 'storage', {
325
- fieldMessage: 'aaa',
326
- alertMessage: 'aaa',
327
- })
328
- } else if (wizard.hasMessage(4, 'storage')) {
329
- value = wizard.removeValidation(4, 'storage', value)
330
- }
331
-
332
- resolve({
333
- stepHasError,
334
- newValue: value,
335
- })
336
- storageSubmit.value = null
337
- }
338
- })
339
- }
340
- const checkCustomizeHardware = async (
341
- value: UI_I_WizardStep[]
342
- ): Promise<UI_I_ValidationReturn> => {
343
- let stepHasError = false
344
-
345
- return new Promise((resolve) => {
346
- customizeHardwareSubmit.value = (isValid: boolean) => {
347
- if (!isValid) {
348
- stepHasError = wizard.setValidation(8, 'customizeHardware', {
349
- fieldMessage: 'aaa',
350
- alertMessage: 'aaa',
351
- })
352
- } else if (wizard.hasMessage(8, 'customizeHardware')) {
353
- value = wizard.removeValidation(8, 'customizeHardware', value)
354
- }
355
-
356
- resolve({
357
- stepHasError,
358
- newValue: value,
359
- })
360
- storageSubmit.value = null
361
- }
362
- })
363
- }
364
-
365
- const storageIdCash = ref<string | null>(null)
366
- const vmForm = ref<UI_I_VmForm>({
367
- name: '',
368
- compatibility: '',
369
- guestMachineType: null,
370
- guestOsFamily: null,
371
- guestOsVersion: null,
372
- computeResource: null,
373
- storage: null,
374
- locationPath: '',
375
- dataCenter: null,
376
- })
377
- const vmFormCash = ref<UI_I_VmFormCash>({
378
- dataCenterId: null,
379
- computeResourceTypeAndId: null,
380
- })
381
-
382
- const onChangeName = (name: string, node: UI_I_TreeNode): void => {
383
- vmForm.value.name = name
384
- if (isSphere.value) {
385
- vmForm.value.locationPath = $recursion.createAbsolutePathRecursion(
386
- node,
387
- 'id',
388
- 'parent'
389
- )
390
- vmForm.value.dataCenter = $recursion.findParentByValue(
391
- node,
392
- 'datacenter',
393
- 'type',
394
- 'parent'
395
- )
396
- vmFormCash.value.dataCenterId = vmForm.value.dataCenter?.id || null
397
- }
398
- }
399
- // // Для сферы
400
- const computeResourcePath = ref<string>('')
401
- const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
402
- emits('select-compute-resource-tree', node)
403
- computeResourcePath.value = $recursion.createAbsolutePathRecursion(
404
- node,
405
- 'id',
406
- 'parent'
407
- )
408
- }
409
- const onChangeComputeResource = (node: UI_I_TreeNode): void => {
410
- vmForm.value.computeResource = node
411
- // const type = node.type.toUpperCase()
412
- // schedRequirementsTemplate.value = `sched_requirements="(${type}_ID=${node.id})"\\`
413
- vmFormCash.value.computeResourceTypeAndId = `${node.type}${node.id}` || null
414
- }
415
- const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
416
- if (!storage) return
417
-
418
- vmForm.value.storage = storage
419
- storageIdCash.value = storage.id
420
- }
421
- const compatibilityInfo = ref<string>('')
422
- const onChangeCompatibility = (compatibility: UI_I_OptionItem): void => {
423
- vmForm.value.compatibility = compatibility.value
424
-
425
- const version = compatibility.value.split('-')[1]
426
- compatibilityInfo.value = `${localization.value.compatibility}: ${compatibility.text} (${localization.value.vmVersion} ${version})`
427
- }
428
- const onChangeOs = (data: UI_I_OsChange): void => {
429
- vmForm.value.guestMachineType = data.selectedMachineType
430
- vmForm.value.guestOsFamily = data.selectedOS
431
- vmForm.value.guestOsVersion = data.selectedVersion
432
- }
433
- const customizeHardware = ref<UI_I_SendDataCustomizeHardware | null>(null)
434
- const onChangeCustomizeHardware = (
435
- data: UI_I_SendDataCustomizeHardware
436
- ): void => {
437
- customizeHardware.value = data
438
- }
439
-
440
- const virtualHardwareHardDisksLocal = computed<
441
- UI_I_SendDataNewHardDisk[] | null
442
- >(() => customizeHardware.value?.virtualHardware?.hardDisks || null)
443
- const virtualHardwareNetworksLocal = computed<UI_I_SendDataNewNetwork[] | null>(
444
- () => customizeHardware.value?.virtualHardware?.networks || null
445
- )
446
- const virtualHardwareCdDvdDrivesLocal = computed<
447
- UI_I_SendDataNewCdDvdDrive[] | null
448
- >(() => customizeHardware.value?.virtualHardware?.cdDvdDrives || null)
449
-
450
- const virtualHardwareCpu = computed<UI_I_SendDataCpu | null>(
451
- () => customizeHardware.value?.virtualHardware?.cpu || null
452
- )
453
- const virtualHardwareMemory = computed<UI_I_SendDataMemory | null>(
454
- () => customizeHardware.value?.virtualHardware?.memory || null
455
- )
456
- const virtualHardwareHardDisks = ref<UI_I_SendDataNewHardDisk[] | null>(null)
457
- const virtualHardwareCdDvdDrives = ref<UI_I_SendDataNewCdDvdDrive[] | null>(
458
- null
459
- )
460
- const virtualHardwareNetworks = ref<UI_I_SendDataNewNetwork[] | null>(null)
461
- const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
462
- virtualHardwareHardDisks.value = data[0]
463
- virtualHardwareCdDvdDrives.value = data[1]
464
- virtualHardwareNetworks.value = data[2]
465
- }
466
-
467
- const isPowerOnByDefault = ref<boolean>(true)
468
-
469
- watch(
470
- () => props.vmNameInWizard,
471
- (newValue) => {
472
- vmForm.value.name = newValue
473
- }
474
- )
475
-
476
- const validateSendData = async (
477
- value: UI_I_WizardStep[]
478
- ): Promise<UI_I_ValidationReturn> => {
479
- wizard.setLoader(true)
480
- let stepHasError = false
481
-
482
- const data = await props.validateSendDataFunc(
483
- vmForm.value,
484
- virtualHardwareCpu.value,
485
- virtualHardwareMemory.value,
486
- customizeHardware.value,
487
- virtualHardwareNetworks.value,
488
- virtualHardwareHardDisks.value,
489
- virtualHardwareCdDvdDrives.value,
490
- isPowerOnByDefault.value,
491
- localization.value,
492
- vmForm.value.locationPath, // для сферы
493
- computeResourcePath.value // для сферы
494
- )
495
-
496
- wizard.setLoader(false)
497
- if (data) {
498
- stepHasError = true
499
- selectedNavItem.value = data[0]
500
- // data[1] !== null && (stepPosition.value = data[1])
501
- }
502
-
503
- return {
504
- stepHasError,
505
- newValue: value,
506
- }
507
- }
508
- const onFinish = (): void => {
509
- wizard.setLoader(false)
510
- props
511
- .finishFunc(
512
- vmForm.value,
513
- virtualHardwareCpu.value,
514
- virtualHardwareMemory.value,
515
- customizeHardware.value,
516
- virtualHardwareNetworks.value,
517
- virtualHardwareHardDisks.value,
518
- virtualHardwareCdDvdDrives.value,
519
- isPowerOnByDefault.value,
520
- localization.value,
521
- vmForm.value.locationPath, // для сферы
522
- computeResourcePath.value, // для сферы
523
- false
524
- )
525
- .then(() => {
526
- onHideModal()
527
- wizard.setLoader(false)
528
- })
529
- }
530
-
531
- const selectedNavItem = ref<UI_T_SelectedNavItem>(0)
532
-
533
- const nameFormSubmit = ref<null | Function>(null)
534
- const computeResourceSubmit = ref<null | Function>(null)
535
- const storageSubmit = ref<null | Function>(null)
536
- const customizeHardwareSubmit = ref<null | Function>(null)
537
- const compatibility = ref<UI_I_OptionItem[]>(capabilities.compatibility)
538
- const guestOsFamilies = ref<UI_I_OptionItem[]>(capabilities.guestOsFamilies)
539
- const guestOsVersions = ref<UI_I_ArbitraryObject<UI_I_OptionItem[]>>(
540
- capabilities.guestOsVersions
541
- )
542
- const machineTypes = ref<UI_I_OptionItem[]>(capabilities.machineTypes)
543
- const cpuModels = ref<UI_I_OptionItem[]>(capabilities.cpuModels)
544
- const maxCpus = ref<number>(capabilities.maxCpus)
545
- const maxMemory = ref<number>(capabilities.maxMemory)
546
-
547
- const onHideModal = (): void => {
548
- emits('hide')
549
- }
550
- </script>
551
-
552
- <style scoped lang="scss">
553
- :deep(.modal-body) {
554
- display: flex;
555
- flex-direction: column;
556
- }
557
- .add-vm-content {
558
- display: flex;
559
- flex-direction: column;
560
- flex: 1;
561
- }
562
- .vm-hardware-version {
563
- align-self: flex-end;
564
- margin-top: auto;
565
- }
566
- .power-on-by-default-wrap {
567
- display: flex;
568
- align-items: center;
569
- margin-right: auto;
570
-
571
- input {
572
- margin-right: 6px;
573
- }
574
- }
575
- </style>
1
+ <template>
2
+ <div class="add-vm">
3
+ <atoms-wizard
4
+ show
5
+ :steps="wizard.steps"
6
+ :selected-scheme="selectedScheme"
7
+ :is-loading="wizard.wizardLoader.status"
8
+ :loader-messages="wizard.wizardLoader.messages"
9
+ :title="localization.newVirtualMachine2"
10
+ :was-completed="wasCompleted"
11
+ :localization="localization"
12
+ @change-steps="onChangeSteps"
13
+ @hide="onHideModal"
14
+ @submit="onFinish"
15
+ >
16
+ <template #modalBody="{ selectedStep }">
17
+ <div class="add-vm-content">
18
+ <common-vm-actions-common-select-create-type
19
+ v-show="selectedStep.id === 0"
20
+ :import-from-v-m-warev-sphere="props.importFromVMWarevSphere"
21
+ />
22
+ <common-vm-actions-common-select-name
23
+ v-show="selectedStep.id === 1 || selectedStep.id === 2"
24
+ :show="selectedStep.id === 1 || selectedStep.id === 2"
25
+ :name-form-submit="nameFormSubmit"
26
+ :project="props.project"
27
+ :data-center="props.dataCenter"
28
+ @submit="onChangeName(...$event)"
29
+ @check-name="emits('check-name', $event)"
30
+ />
31
+ <common-vm-actions-common-select-compute-resource
32
+ v-if="isSphere"
33
+ v-show="selectedStep.id === 3"
34
+ v-model="vmForm.computeResource"
35
+ :compute-resource-submit="computeResourceSubmit"
36
+ :data-center="vmForm.dataCenter"
37
+ :compute-resource="props.computeResource"
38
+ :compute-resource-tree="props.computeResourceTree"
39
+ @submit="onChangeComputeResource"
40
+ @select-compute-resource-tree="onSelectComputeResourceTree"
41
+ @get-compute-resource-tree="
42
+ emits('get-compute-resource-tree', $event)
43
+ "
44
+ @show-compute-resource-tree="
45
+ emits('show-compute-resource-tree', $event)
46
+ "
47
+ @clear-compute-resource-tree="
48
+ emits('clear-compute-resource-tree', $event)
49
+ "
50
+ />
51
+ <common-vm-actions-common-select-storage
52
+ v-show="selectedStep.id === 4"
53
+ :storage-submit="storageSubmit"
54
+ :datastore="props.datastore"
55
+ :get-datastore-table-func="props.getDatastoreTableFunc"
56
+ @submit="onChangeStorage"
57
+ />
58
+ <common-vm-actions-common-select-compatibility
59
+ v-show="selectedStep.id === 5"
60
+ :options="compatibility"
61
+ :error-validation-fields="props.errorValidationFields"
62
+ @change="onChangeCompatibility"
63
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
64
+ />
65
+ <common-vm-actions-common-select-os
66
+ v-show="selectedStep.id === 6 || selectedStep.id === 7"
67
+ :families-options="guestOsFamilies"
68
+ :versions-options="guestOsVersions"
69
+ :machine-types-options="machineTypes"
70
+ :error-validation-fields="props.errorValidationFields"
71
+ @change="onChangeOs"
72
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
73
+ />
74
+ <common-vm-actions-common-customize-hardware
75
+ v-show="selectedStep.id === 8"
76
+ :vm-name="vmForm.name"
77
+ :guest-machine-type="vmForm.guestMachineType"
78
+ :guest-os-family="vmForm.guestOsFamily"
79
+ :guest-os-version="vmForm.guestOsVersion"
80
+ :storage="vmForm.storage"
81
+ :hard-disks-for-boot-options="virtualHardwareHardDisksLocal"
82
+ :cd-dvd-drives-for-boot-options="virtualHardwareCdDvdDrivesLocal"
83
+ :networks-for-boot-options="virtualHardwareNetworksLocal"
84
+ :cd-dvd-drives="virtualHardwareCdDvdDrivesLocal"
85
+ :customize-hardware-submit="customizeHardwareSubmit"
86
+ :max-cpus="maxCpus"
87
+ :max-memory="maxMemory"
88
+ :cpu-models="cpuModels"
89
+ :selected-nav-item="selectedNavItem"
90
+ :nodes="props.nodes"
91
+ :files="props.files"
92
+ :networks-table="props.networksTable"
93
+ :error-validation-fields="props.errorValidationFields"
94
+ :get-datastore-table-func="props.getDatastoreTableFunc"
95
+ :datastore="props.datastore"
96
+ :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
97
+ :passthrough-devices="props.passthroughDevices"
98
+ @change-boot-order="onChangeBootOrder"
99
+ @send-data="onChangeCustomizeHardware"
100
+ @get-storage="emits('get-storage', $event)"
101
+ @get-folders-or-files="emits('get-folders-or-files', $event)"
102
+ @get-active-device-child="emits('get-active-device-child', $event)"
103
+ @show-datastore-child="emits('show-datastore-child', $event)"
104
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
105
+ @get-networks-table="emits('get-networks-table', $event)"
106
+ @get-pci-devices="emits('get-pci-devices')"
107
+ />
108
+ <common-vm-actions-common-ready-to-complete
109
+ v-if="selectedStep.id === 9"
110
+ :ready-complete-table-info="props.readyCompleteTableInfo"
111
+ />
112
+ <span v-if="selectedStep.id > 5" class="vm-hardware-version">{{
113
+ compatibilityInfo
114
+ }}</span>
115
+ </div>
116
+ </template>
117
+
118
+ <template #modalFooterContent>
119
+ <div v-if="isShowPowerOn" class="power-on-by-default-wrap">
120
+ <input
121
+ id="power-on-by-default"
122
+ v-model="isPowerOnByDefault"
123
+ type="checkbox"
124
+ />
125
+ <label for="power-on-by-default" class="label-text-normal">{{
126
+ localization.powerOnByDefault
127
+ }}</label>
128
+ </div>
129
+ </template>
130
+ </atoms-wizard>
131
+ </div>
132
+ </template>
133
+
134
+ <script setup lang="ts">
135
+ import type {
136
+ UI_I_Localization,
137
+ UI_I_ArbitraryObject,
138
+ } from '~/lib/models/interfaces'
139
+ import type { UI_T_Project } from '~/lib/models/types'
140
+ import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
141
+ import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
142
+ import type {
143
+ UI_I_DatastoreTableItem,
144
+ UI_I_FolderOrFileTreePayload,
145
+ } from '~/lib/models/store/storage/interfaces'
146
+ import type {
147
+ API_UI_I_Error,
148
+ UI_I_ErrorValidationField,
149
+ } from '~/lib/models/store/interfaces'
150
+ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
151
+ import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
152
+ import type {
153
+ UI_T_AddVmFinishFunc,
154
+ UI_T_SelectedNavItem,
155
+ } from '~/components/common/vm/actions/common/lib/models/types'
156
+ import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
157
+ import type {
158
+ UI_I_ValidationReturn,
159
+ UI_I_WizardStep,
160
+ } from '~/components/atoms/wizard/lib/models/interfaces'
161
+ import type {
162
+ UI_I_VmForm,
163
+ UI_I_VmFormCash,
164
+ } from '~/components/common/vm/actions/common/lib/models/interfaces'
165
+ import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
166
+ import type { UI_I_OsChange } from '~/components/common/vm/actions/common/select/lib/models/interfaces'
167
+ import type {
168
+ UI_I_SendDataCpu,
169
+ UI_I_SendDataMemory,
170
+ UI_I_SendDataNewCdDvdDrive,
171
+ UI_I_SendDataNewHardDisk,
172
+ UI_I_SendDataNewNetwork,
173
+ } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
174
+ import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
175
+ import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/models/types'
176
+ import type { UI_I_PciDevice } from '~/lib/models/store/vm/interfaces'
177
+ import { capabilities } from '~/components/common/vm/actions/common/lib/config/capabilities'
178
+ import {
179
+ stepsSchemeInitial,
180
+ stepsFunc,
181
+ } from '~/components/common/vm/actions/add/lib/config/steps'
182
+ import Wizard from '~/components/atoms/wizard/lib/utils/utils'
183
+
184
+ const props = defineProps<{
185
+ project: UI_T_Project
186
+ nodes: UI_I_FileTreeNode[]
187
+ files: UI_I_FileTreeNode[]
188
+ networksTable: UI_I_NetworkTableItem[]
189
+ datastore: UI_I_DatastoreTableItem[]
190
+ errorValidationFields: UI_I_ErrorValidationField[]
191
+ readyCompleteTableInfo: UI_I_TableInfoItem[]
192
+ vmCpuHelpTextSecond: string
193
+ importFromVMWarevSphere: string
194
+ finishFunc: UI_T_AddVmFinishFunc
195
+ getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
196
+ validateSendDataFunc: UI_T_AddVmFinishFunc<
197
+ [UI_T_SelectedNavItem, null | number] | null
198
+ >
199
+ passthroughDevices: UI_I_PciDevice[]
200
+ vmNameInWizard: string
201
+ dataCenter?: UI_I_TreeNode // для сферы
202
+ computeResource?: UI_I_TreeNode // для сферы
203
+ computeResourceTree?: UI_I_TreeNode[] // для сферы
204
+ }>()
205
+
206
+ const emits = defineEmits<{
207
+ (event: 'check-name', value: [string, (error: API_UI_I_Error) => void]): void
208
+ (event: 'get-storage', value: UI_I_TablePayload): void
209
+ (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
210
+ (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
211
+ (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
212
+ (event: 'remove-error-by-title', value: string): void
213
+ (event: 'get-networks-table', value: UI_I_TablePayload): void
214
+ (event: 'get-pci-devices'): void
215
+ (event: 'get-pci-devices'): void
216
+ (event: 'hide'): void
217
+ (
218
+ event: 'get-compute-resource-tree',
219
+ value: { id: string | number; cb: () => void }
220
+ ): void // для сферы
221
+ (event: 'show-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
222
+ (event: 'select-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
223
+ (event: 'clear-compute-resource-tree'): void // для сферы
224
+ }>()
225
+
226
+ const isSphere = computed<boolean>(() => props.project === 'sphere')
227
+
228
+ const { $recursion } = useNuxtApp()
229
+
230
+ const localization = computed<UI_I_Localization>(() => useLocal())
231
+
232
+ const wizard: Wizard = new Wizard(
233
+ stepsFunc(localization.value),
234
+ stepsSchemeInitial
235
+ )
236
+ if (isSphere.value) wizard.changeScheme(1)
237
+ const wasCompleted = computed<boolean>(() => wizard.wasCompleted())
238
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
239
+ const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
240
+
241
+ const isShowPowerOn = computed<boolean>(() => wizard.selectedStepId > 8)
242
+
243
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
244
+ wizard.changeSteps(value, validationFunc, validateSendData)
245
+ }
246
+ const validationFunc = async (
247
+ value: UI_I_WizardStep[],
248
+ currentStep: UI_I_WizardStep,
249
+ nextStep: UI_I_WizardStep
250
+ ): Promise<UI_I_ValidationReturn> => {
251
+ let stepHasError = false
252
+ let stepShouldStop = {
253
+ ifOnCurrentStep: false,
254
+ ifFromAnyStep: false,
255
+ stoppageStepId: -1,
256
+ }
257
+
258
+ wizard.setLoader(true)
259
+ if (
260
+ wizard.isValidateForStep(
261
+ isSphere.value ? 2 : 1,
262
+ currentStep.id,
263
+ nextStep.id
264
+ )
265
+ ) {
266
+ const nameValidation = await checkName(value)
267
+
268
+ value = nameValidation.newValue
269
+ stepHasError = stepHasError || nameValidation.stepHasError
270
+ } else if (wizard.isValidateForStep(4, currentStep.id, nextStep.id)) {
271
+ const storageValidation = await checkStorage(value)
272
+
273
+ value = storageValidation.newValue
274
+
275
+ stepHasError = stepHasError || storageValidation.stepHasError
276
+ } else if (wizard.isValidateForStep(8, currentStep.id, nextStep.id)) {
277
+ const storageValidation = await checkCustomizeHardware(value)
278
+
279
+ value = storageValidation.newValue
280
+
281
+ stepHasError = stepHasError || storageValidation.stepHasError
282
+ }
283
+ wizard.setLoader(false)
284
+
285
+ return {
286
+ newValue: value,
287
+ stepHasError,
288
+ stepShouldStop,
289
+ }
290
+ }
291
+ const checkName = async (
292
+ value: UI_I_WizardStep[]
293
+ ): Promise<UI_I_ValidationReturn> => {
294
+ let stepHasError = false
295
+
296
+ return new Promise((resolve) => {
297
+ const step = isSphere.value ? 2 : 1
298
+ nameFormSubmit.value = (isValid: boolean) => {
299
+ if (!isValid) {
300
+ stepHasError = wizard.setValidation(step, 'name', {
301
+ fieldMessage: 'aaa',
302
+ alertMessage: 'aaa',
303
+ })
304
+ } else if (wizard.hasMessage(step, 'name')) {
305
+ value = wizard.removeValidation(step, 'name', value)
306
+ }
307
+
308
+ resolve({
309
+ stepHasError,
310
+ newValue: value,
311
+ })
312
+ nameFormSubmit.value = null
313
+ }
314
+ })
315
+ }
316
+ const checkStorage = async (
317
+ value: UI_I_WizardStep[]
318
+ ): Promise<UI_I_ValidationReturn> => {
319
+ let stepHasError = false
320
+
321
+ return new Promise((resolve) => {
322
+ storageSubmit.value = (isValid: boolean) => {
323
+ if (!isValid) {
324
+ stepHasError = wizard.setValidation(4, 'storage', {
325
+ fieldMessage: 'aaa',
326
+ alertMessage: 'aaa',
327
+ })
328
+ } else if (wizard.hasMessage(4, 'storage')) {
329
+ value = wizard.removeValidation(4, 'storage', value)
330
+ }
331
+
332
+ resolve({
333
+ stepHasError,
334
+ newValue: value,
335
+ })
336
+ storageSubmit.value = null
337
+ }
338
+ })
339
+ }
340
+ const checkCustomizeHardware = async (
341
+ value: UI_I_WizardStep[]
342
+ ): Promise<UI_I_ValidationReturn> => {
343
+ let stepHasError = false
344
+
345
+ return new Promise((resolve) => {
346
+ customizeHardwareSubmit.value = (isValid: boolean) => {
347
+ if (!isValid) {
348
+ stepHasError = wizard.setValidation(8, 'customizeHardware', {
349
+ fieldMessage: 'aaa',
350
+ alertMessage: 'aaa',
351
+ })
352
+ } else if (wizard.hasMessage(8, 'customizeHardware')) {
353
+ value = wizard.removeValidation(8, 'customizeHardware', value)
354
+ }
355
+
356
+ resolve({
357
+ stepHasError,
358
+ newValue: value,
359
+ })
360
+ storageSubmit.value = null
361
+ }
362
+ })
363
+ }
364
+
365
+ const storageIdCash = ref<string | null>(null)
366
+ const vmForm = ref<UI_I_VmForm>({
367
+ name: '',
368
+ compatibility: '',
369
+ guestMachineType: null,
370
+ guestOsFamily: null,
371
+ guestOsVersion: null,
372
+ computeResource: null,
373
+ storage: null,
374
+ locationPath: '',
375
+ dataCenter: null,
376
+ })
377
+ const vmFormCash = ref<UI_I_VmFormCash>({
378
+ dataCenterId: null,
379
+ computeResourceTypeAndId: null,
380
+ })
381
+
382
+ const onChangeName = (name: string, node: UI_I_TreeNode): void => {
383
+ vmForm.value.name = name
384
+ if (isSphere.value) {
385
+ vmForm.value.locationPath = $recursion.createAbsolutePathRecursion(
386
+ node,
387
+ 'id',
388
+ 'parent'
389
+ )
390
+ vmForm.value.dataCenter = $recursion.findParentByValue(
391
+ node,
392
+ 'datacenter',
393
+ 'type',
394
+ 'parent'
395
+ )
396
+ vmFormCash.value.dataCenterId = vmForm.value.dataCenter?.id || null
397
+ }
398
+ }
399
+ // // Для сферы
400
+ const computeResourcePath = ref<string>('')
401
+ const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
402
+ emits('select-compute-resource-tree', node)
403
+ computeResourcePath.value = $recursion.createAbsolutePathRecursion(
404
+ node,
405
+ 'id',
406
+ 'parent'
407
+ )
408
+ }
409
+ const onChangeComputeResource = (node: UI_I_TreeNode): void => {
410
+ vmForm.value.computeResource = node
411
+ // const type = node.type.toUpperCase()
412
+ // schedRequirementsTemplate.value = `sched_requirements="(${type}_ID=${node.id})"\\`
413
+ vmFormCash.value.computeResourceTypeAndId = `${node.type}${node.id}` || null
414
+ }
415
+ const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
416
+ if (!storage) return
417
+
418
+ vmForm.value.storage = storage
419
+ storageIdCash.value = storage.id
420
+ }
421
+ const compatibilityInfo = ref<string>('')
422
+ const onChangeCompatibility = (compatibility: UI_I_OptionItem): void => {
423
+ vmForm.value.compatibility = compatibility.value
424
+
425
+ const version = compatibility.value.split('-')[1]
426
+ compatibilityInfo.value = `${localization.value.compatibility}: ${compatibility.text} (${localization.value.vmVersion} ${version})`
427
+ }
428
+ const onChangeOs = (data: UI_I_OsChange): void => {
429
+ vmForm.value.guestMachineType = data.selectedMachineType
430
+ vmForm.value.guestOsFamily = data.selectedOS
431
+ vmForm.value.guestOsVersion = data.selectedVersion
432
+ }
433
+ const customizeHardware = ref<UI_I_SendDataCustomizeHardware | null>(null)
434
+ const onChangeCustomizeHardware = (
435
+ data: UI_I_SendDataCustomizeHardware
436
+ ): void => {
437
+ customizeHardware.value = data
438
+ }
439
+
440
+ const virtualHardwareHardDisksLocal = computed<
441
+ UI_I_SendDataNewHardDisk[] | null
442
+ >(() => customizeHardware.value?.virtualHardware?.hardDisks || null)
443
+ const virtualHardwareNetworksLocal = computed<UI_I_SendDataNewNetwork[] | null>(
444
+ () => customizeHardware.value?.virtualHardware?.networks || null
445
+ )
446
+ const virtualHardwareCdDvdDrivesLocal = computed<
447
+ UI_I_SendDataNewCdDvdDrive[] | null
448
+ >(() => customizeHardware.value?.virtualHardware?.cdDvdDrives || null)
449
+
450
+ const virtualHardwareCpu = computed<UI_I_SendDataCpu | null>(
451
+ () => customizeHardware.value?.virtualHardware?.cpu || null
452
+ )
453
+ const virtualHardwareMemory = computed<UI_I_SendDataMemory | null>(
454
+ () => customizeHardware.value?.virtualHardware?.memory || null
455
+ )
456
+ const virtualHardwareHardDisks = ref<UI_I_SendDataNewHardDisk[] | null>(null)
457
+ const virtualHardwareCdDvdDrives = ref<UI_I_SendDataNewCdDvdDrive[] | null>(
458
+ null
459
+ )
460
+ const virtualHardwareNetworks = ref<UI_I_SendDataNewNetwork[] | null>(null)
461
+ const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
462
+ virtualHardwareHardDisks.value = data[0]
463
+ virtualHardwareCdDvdDrives.value = data[1]
464
+ virtualHardwareNetworks.value = data[2]
465
+ }
466
+
467
+ const isPowerOnByDefault = ref<boolean>(true)
468
+
469
+ watch(
470
+ () => props.vmNameInWizard,
471
+ (newValue) => {
472
+ vmForm.value.name = newValue
473
+ }
474
+ )
475
+
476
+ const validateSendData = async (
477
+ value: UI_I_WizardStep[]
478
+ ): Promise<UI_I_ValidationReturn> => {
479
+ wizard.setLoader(true)
480
+ let stepHasError = false
481
+
482
+ const data = await props.validateSendDataFunc(
483
+ vmForm.value,
484
+ virtualHardwareCpu.value,
485
+ virtualHardwareMemory.value,
486
+ customizeHardware.value,
487
+ virtualHardwareNetworks.value,
488
+ virtualHardwareHardDisks.value,
489
+ virtualHardwareCdDvdDrives.value,
490
+ isPowerOnByDefault.value,
491
+ localization.value,
492
+ vmForm.value.locationPath, // для сферы
493
+ computeResourcePath.value // для сферы
494
+ )
495
+
496
+ wizard.setLoader(false)
497
+ if (data) {
498
+ stepHasError = true
499
+ selectedNavItem.value = data[0]
500
+ // data[1] !== null && (stepPosition.value = data[1])
501
+ }
502
+
503
+ return {
504
+ stepHasError,
505
+ newValue: value,
506
+ }
507
+ }
508
+ const onFinish = (): void => {
509
+ wizard.setLoader(false)
510
+ props
511
+ .finishFunc(
512
+ vmForm.value,
513
+ virtualHardwareCpu.value,
514
+ virtualHardwareMemory.value,
515
+ customizeHardware.value,
516
+ virtualHardwareNetworks.value,
517
+ virtualHardwareHardDisks.value,
518
+ virtualHardwareCdDvdDrives.value,
519
+ isPowerOnByDefault.value,
520
+ localization.value,
521
+ vmForm.value.locationPath, // для сферы
522
+ computeResourcePath.value, // для сферы
523
+ false
524
+ )
525
+ .then(() => {
526
+ onHideModal()
527
+ wizard.setLoader(false)
528
+ })
529
+ }
530
+
531
+ const selectedNavItem = ref<UI_T_SelectedNavItem>(0)
532
+
533
+ const nameFormSubmit = ref<null | Function>(null)
534
+ const computeResourceSubmit = ref<null | Function>(null)
535
+ const storageSubmit = ref<null | Function>(null)
536
+ const customizeHardwareSubmit = ref<null | Function>(null)
537
+ const compatibility = ref<UI_I_OptionItem[]>(capabilities.compatibility)
538
+ const guestOsFamilies = ref<UI_I_OptionItem[]>(capabilities.guestOsFamilies)
539
+ const guestOsVersions = ref<UI_I_ArbitraryObject<UI_I_OptionItem[]>>(
540
+ capabilities.guestOsVersions
541
+ )
542
+ const machineTypes = ref<UI_I_OptionItem[]>(capabilities.machineTypes)
543
+ const cpuModels = ref<UI_I_OptionItem[]>(capabilities.cpuModels)
544
+ const maxCpus = ref<number>(capabilities.maxCpus)
545
+ const maxMemory = ref<number>(capabilities.maxMemory)
546
+
547
+ const onHideModal = (): void => {
548
+ emits('hide')
549
+ }
550
+ </script>
551
+
552
+ <style scoped lang="scss">
553
+ :deep(.modal-body) {
554
+ display: flex;
555
+ flex-direction: column;
556
+ }
557
+ .add-vm-content {
558
+ display: flex;
559
+ flex-direction: column;
560
+ flex: 1;
561
+ }
562
+ .vm-hardware-version {
563
+ align-self: flex-end;
564
+ margin-top: auto;
565
+ }
566
+ .power-on-by-default-wrap {
567
+ display: flex;
568
+ align-items: center;
569
+ margin-right: auto;
570
+
571
+ input {
572
+ margin-right: 6px;
573
+ }
574
+ }
575
+ </style>