bfg-common 1.4.560 → 1.4.562

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 (144) hide show
  1. package/assets/img/icons/icons-sprite-dark-1.svg +407 -407
  2. package/assets/img/icons/icons-sprite-dark-2.svg +343 -343
  3. package/assets/img/icons/icons-sprite-dark-3.svg +227 -227
  4. package/assets/img/icons/icons-sprite-dark-4.svg +255 -255
  5. package/assets/img/icons/icons-sprite-dark-5.svg +488 -488
  6. package/assets/img/icons/icons-sprite-dark-6.svg +94 -94
  7. package/assets/img/icons/icons-sprite-light-1.svg +407 -407
  8. package/assets/img/icons/icons-sprite-light-2.svg +343 -343
  9. package/assets/img/icons/icons-sprite-light-3.svg +227 -227
  10. package/assets/img/icons/icons-sprite-light-4.svg +255 -255
  11. package/assets/img/icons/icons-sprite-light-5.svg +488 -488
  12. package/assets/img/icons/icons-sprite-light-6.svg +94 -94
  13. package/assets/localization/local_be.json +5 -1
  14. package/assets/localization/local_en.json +5 -1
  15. package/assets/localization/local_hy.json +5 -1
  16. package/assets/localization/local_kk.json +5 -1
  17. package/assets/localization/local_ru.json +5 -1
  18. package/assets/localization/local_zh.json +5 -1
  19. package/components/atoms/TheIcon3.vue +50 -50
  20. package/components/atoms/modal/bySteps/BySteps.vue +253 -253
  21. package/components/atoms/stack/StackBlock.vue +185 -185
  22. package/components/atoms/table/dataGrid/DataGrid.vue +1633 -1633
  23. package/components/atoms/table/dataGrid/DataGridColumnSwitch.vue +222 -222
  24. package/components/common/browse/BrowseNew.vue +237 -237
  25. package/components/common/browse/BrowseOld.vue +217 -217
  26. package/components/common/browse/blocks/contents/Files.vue +35 -35
  27. package/components/common/browse/blocks/contents/FilesOld.vue +70 -70
  28. package/components/common/browse/blocks/contents/filesNew/FilesNew.vue +92 -92
  29. package/components/common/browse/blocks/contents/filesNew/Skeleton.vue +18 -18
  30. package/components/common/browse/blocks/lib/models/types.ts +1 -1
  31. package/components/common/browse/lib/models/interfaces.ts +5 -5
  32. package/components/common/context/lib/models/interfaces.ts +30 -30
  33. package/components/common/context/recursion/Recursion.vue +86 -86
  34. package/components/common/context/recursion/RecursionNew.vue +199 -199
  35. package/components/common/context/recursion/RecursionOld.vue +213 -213
  36. package/components/common/diagramMain/Header.vue +211 -211
  37. package/components/common/diagramMain/adapter/AdapterItems.vue +61 -61
  38. package/components/common/diagramMain/lib/config/initial.ts +50 -50
  39. package/components/common/diagramMain/lib/models/enums.ts +44 -44
  40. package/components/common/diagramMain/lib/models/types.ts +21 -21
  41. package/components/common/diagramMain/lib/utils/utils.ts +331 -331
  42. package/components/common/diagramMain/modals/ManagePhysicalAdaptersModal.vue +330 -330
  43. package/components/common/diagramMain/modals/editSettings/ConfirmTeamingSettingsModal.vue +40 -40
  44. package/components/common/diagramMain/modals/editSettings/EditSettings.vue +497 -497
  45. package/components/common/diagramMain/modals/editSettings/EditSettingsModal.vue +812 -812
  46. package/components/common/diagramMain/modals/editSettings/tabs/NetworkProperties.vue +214 -214
  47. package/components/common/diagramMain/modals/editSettings/tabs/Security.vue +189 -189
  48. package/components/common/diagramMain/modals/editSettings/tabs/SwitchProperties.vue +163 -163
  49. package/components/common/diagramMain/modals/editSettings/tabs/TeamingFailover.vue +175 -175
  50. package/components/common/diagramMain/modals/editSettings/tabs/TrafficShaping.vue +398 -398
  51. package/components/common/diagramMain/modals/editSettings/tabs/port/IpvFourSettings.vue +346 -346
  52. package/components/common/diagramMain/modals/editSettings/tabs/port/PortProperties.vue +205 -205
  53. package/components/common/diagramMain/modals/lib/config/diagramConfig.ts +23 -23
  54. package/components/common/diagramMain/modals/lib/config/initial.ts +180 -180
  55. package/components/common/diagramMain/modals/lib/config/vmKernelAdapter.ts +90 -90
  56. package/components/common/diagramMain/modals/lib/mappers/mappers.ts +87 -87
  57. package/components/common/diagramMain/modals/lib/utils/index.ts +24 -24
  58. package/components/common/diagramMain/modals/migrateVmkernelAdapter/MigrateVmkernelAdapter.vue +537 -537
  59. package/components/common/diagramMain/modals/migrateVmkernelAdapter/lib/config/steps.ts +114 -114
  60. package/components/common/diagramMain/modals/migrateVmkernelAdapter/steps/ConnectionSettings.vue +169 -169
  61. package/components/common/diagramMain/modals/migrateVmkernelAdapter/steps/SelectVmkernelAdapter.vue +159 -159
  62. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/common.ts +14 -14
  63. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/connectionSettings.ts +137 -137
  64. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/selectVmkernelAdapter.ts +52 -52
  65. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/validations.ts +19 -19
  66. package/components/common/diagramMain/port/Ports.vue +47 -47
  67. package/components/common/layout/theHeader/helpMenu/About.vue +85 -85
  68. package/components/common/layout/theHeader/helpMenu/aboutNew/AboutNew.vue +103 -103
  69. package/components/common/mainNavigationPanel/MainNavigationPanel.vue +152 -152
  70. package/components/common/modals/confirmation/Confirmation.vue +74 -70
  71. package/components/common/modals/confirmation/ConfirmationNew.vue +10 -61
  72. package/components/common/modals/confirmation/ConfirmationOld.vue +10 -10
  73. package/components/common/spiceConsole/Drawer.vue +370 -370
  74. package/components/common/spiceConsole/lib/models/interfaces.ts +5 -5
  75. package/components/common/vm/actions/add/Add.vue +619 -619
  76. package/components/common/vm/actions/clone/lib/config/steps.ts +129 -129
  77. package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +270 -270
  78. package/components/common/vm/actions/common/customizeHardware/CustomizeHardwareNew.vue +266 -266
  79. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardwareNew.vue +1 -1
  80. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardwareOld.vue +1 -1
  81. package/components/common/vm/actions/common/customizeHardware/virtualHardware/bus/BusNew.vue +118 -118
  82. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDriveNew.vue +163 -163
  83. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/Media.vue +25 -25
  84. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/MediaNew.vue +55 -55
  85. package/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/config/dropdownItems.ts +147 -147
  86. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/mode/ModeOld.vue +55 -55
  87. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/sharing/SharingNew.vue +44 -44
  88. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetworkNew.vue +124 -124
  89. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/LocationOld.vue +134 -134
  90. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/new/New.vue +63 -63
  91. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/new/table/Table.vue +74 -74
  92. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/new/table/lib/config/config.ts +95 -95
  93. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddress.vue +119 -119
  94. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddressNew.vue +69 -69
  95. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddressOld.vue +83 -83
  96. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDeviceNew.vue +85 -85
  97. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDeviceOld.vue +91 -91
  98. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/DirectPathIoNew.vue +35 -35
  99. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/DynamicDirectPathIoNew.vue +48 -48
  100. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/Note.vue +15 -15
  101. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/NoteNew.vue +42 -42
  102. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/NoteOld.vue +30 -30
  103. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/nvidiaGrid/NvidiaGridNew.vue +30 -30
  104. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/typeSelection/TypeSelectionNew.vue +46 -46
  105. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbControllerNew.vue +56 -56
  106. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/Other.vue +16 -16
  107. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/OtherNew.vue +27 -27
  108. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/totalVideoMemory/TotalVideoMemoryNew.vue +54 -54
  109. package/components/common/vm/actions/common/customizeHardware/vmoptions/Vmoptions.vue +145 -145
  110. package/components/common/vm/actions/common/customizeHardware/vmoptions/VmoptionsNew.vue +102 -102
  111. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptionsNew.vue +75 -75
  112. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/delay/Delay.vue +26 -26
  113. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/Firmware.vue +57 -57
  114. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/FirmwareNew.vue +42 -42
  115. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/menu/MenuNew.vue +25 -25
  116. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +171 -171
  117. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/OrderNew.vue +50 -50
  118. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptionsNew.vue +141 -141
  119. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/New.vue +140 -140
  120. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/copyPaste/CopyPasteNew.vue +30 -30
  121. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/fileTransfer/FileTransferNew.vue +30 -30
  122. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/folderSharing/FolderSharingNew.vue +30 -30
  123. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +32 -32
  124. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/KeymapNew.vue +39 -39
  125. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/PasswordNew.vue +100 -100
  126. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirectionNew.vue +38 -38
  127. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirectionOld.vue +44 -44
  128. package/components/common/vm/actions/common/select/storage/Storage.vue +130 -130
  129. package/components/common/vm/actions/common/select/storage/StorageOld.vue +129 -129
  130. package/components/common/vm/actions/common/select/storage/new/New.vue +159 -159
  131. package/components/common/vm/actions/confirm/Confirm.vue +8 -15
  132. package/components/common/vm/actions/editSettings/EditSettings.vue +217 -217
  133. package/components/common/vm/actions/editSettings/EditSettingsOld.vue +184 -184
  134. package/components/common/vm/actions/editSettings/new/New.vue +178 -178
  135. package/components/common/vm/actions/editSettings/new/Skeleton.vue +87 -87
  136. package/components/common/wizards/network/add/lib/config/steps.ts +464 -464
  137. package/composables/productNameLocal.ts +30 -30
  138. package/package.json +2 -2
  139. package/plugins/date.ts +233 -233
  140. package/plugins/recursion.ts +311 -311
  141. package/public/spice-console/lib/images/bitmap.js +203 -203
  142. package/public/spice-console/network/spicechannel.js +383 -383
  143. package/store/main/mutations.ts +7 -7
  144. package/store/main/state.ts +7 -7
@@ -1,619 +1,619 @@
1
- <template>
2
- <div class="add-vm">
3
- <atoms-wizard
4
- show
5
- :wizard="wizard"
6
- :selected-scheme="selectedScheme"
7
- :title="localization.common.newVirtualMachine2"
8
- :localization="localization"
9
- test-id="new-virtual-machine-wizard"
10
- @change-steps="onChangeSteps"
11
- @hide="onHideModal"
12
- @submit="onFinish"
13
- >
14
- <template #modalBody="{ selectedStep }">
15
- <div class="add-vm-content">
16
- <common-vm-actions-common-select-create-type
17
- v-show="selectedStep.id === 0"
18
- :import-from-v-m-warev-sphere="props.importFromVMWarevSphere"
19
- />
20
- <common-vm-actions-common-select-name
21
- v-show="selectedStep.id === 1 || selectedStep.id === 2"
22
- :show="selectedStep.id === 1 || selectedStep.id === 2"
23
- :name-form-submit="nameFormSubmit"
24
- :project="props.project"
25
- :data-center="props.dataCenter"
26
- @submit="onChangeName(...$event)"
27
- @check-name="emits('check-name', $event)"
28
- />
29
- <common-vm-actions-common-select-compute-resource
30
- v-if="isSphere"
31
- v-show="selectedStep.id === 3"
32
- v-model="vmForm.computeResource"
33
- :compute-resource-submit="computeResourceSubmit"
34
- :data-center="vmForm.dataCenter"
35
- :compute-resource="props.computeResource"
36
- :compute-resource-tree="props.computeResourceTree"
37
- @submit="onChangeComputeResource"
38
- @select-compute-resource-tree="onSelectComputeResourceTree"
39
- @get-compute-resource-tree="
40
- emits('get-compute-resource-tree', $event)
41
- "
42
- @show-compute-resource-tree="
43
- emits('show-compute-resource-tree', $event)
44
- "
45
- @clear-compute-resource-tree="
46
- emits('clear-compute-resource-tree', $event)
47
- "
48
- />
49
- <common-vm-actions-common-select-storage
50
- v-show="selectedStep.id === 4"
51
- :storage-submit="storageSubmit"
52
- :datastore="props.datastore"
53
- :get-datastore-table-func="props.getDatastoreTableFunc"
54
- @submit="onChangeStorage"
55
- />
56
- <common-vm-actions-common-select-compatibility
57
- v-show="selectedStep.id === 5"
58
- :options="compatibility"
59
- :error-validation-fields="props.errorValidationFields"
60
- @change="onChangeCompatibility"
61
- @remove-error-by-title="emits('remove-error-by-title', $event)"
62
- />
63
- <common-vm-actions-common-select-os
64
- v-show="selectedStep.id === 6 || selectedStep.id === 7"
65
- :families-options="guestOsFamilies"
66
- :versions-options="guestOsVersions"
67
- :machine-types-options="machineTypes"
68
- :error-validation-fields="props.errorValidationFields"
69
- @change="onChangeOs"
70
- @remove-error-by-title="emits('remove-error-by-title', $event)"
71
- />
72
- <common-vm-actions-common-customize-hardware
73
- v-show="selectedStep.id === 8"
74
- :project="props.project"
75
- :vm-name="vmForm.name"
76
- :guest-machine-type="vmForm.guestMachineType"
77
- :guest-os-family="vmForm.guestOsFamily"
78
- :guest-os-version="vmForm.guestOsVersion"
79
- :storage="vmForm.storage"
80
- :hard-disks-for-boot-options="virtualHardwareHardDisksLocal"
81
- :cd-dvd-drives-for-boot-options="virtualHardwareCdDvdDrivesLocal"
82
- :networks-for-boot-options="virtualHardwareNetworksLocal"
83
- :cd-dvd-drives="virtualHardwareCdDvdDrivesLocal"
84
- :customize-hardware-submit="customizeHardwareSubmit"
85
- :max-cpus="maxCpus"
86
- :max-memory="maxMemory"
87
- :cpu-models="cpuModels"
88
- :selected-nav-item="selectedNavItem"
89
- :nodes="props.nodes"
90
- :files="props.files"
91
- :networks-table="props.networksTable"
92
- :error-validation-fields="props.errorValidationFields"
93
- :get-datastore-table-func="props.getDatastoreTableFunc"
94
- :datastore="props.datastore"
95
- :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
96
- :passthrough-devices="props.passthroughDevices"
97
- :files-loading="props.filesLoading"
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-ready-to-complete
109
- v-if="selectedStep.id === 9"
110
- :data="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
- data-id="power-on-by-default"
124
- type="checkbox"
125
- />
126
- <label for="power-on-by-default" class="label-text-normal">{{
127
- localization.common.powerOnByDefault
128
- }}</label>
129
- </div>
130
- </template>
131
- </atoms-wizard>
132
- </div>
133
- </template>
134
-
135
- <script setup lang="ts">
136
- import type {
137
- UI_I_Localization,
138
- UI_I_ArbitraryObject,
139
- } from '~/lib/models/interfaces'
140
- import type { UI_T_Project } from '~/lib/models/types'
141
- import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
142
- import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
143
- import type {
144
- UI_I_DatastoreTableItem,
145
- UI_I_FolderOrFileTreePayload,
146
- } from '~/lib/models/store/storage/interfaces'
147
- import type {
148
- API_UI_I_Error,
149
- UI_I_ErrorValidationField,
150
- } from '~/lib/models/store/interfaces'
151
- import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
152
- import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
153
- import type {
154
- UI_T_AddVmFinishFunc,
155
- UI_T_SelectedNavItem,
156
- } from '~/components/common/vm/actions/common/lib/models/types'
157
- import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
158
- import type {
159
- UI_I_ValidationReturn,
160
- UI_I_WizardStep,
161
- } from '~/components/atoms/wizard/lib/models/interfaces'
162
- import type {
163
- UI_I_Capabilities,
164
- UI_I_VmForm,
165
- UI_I_VmFormCash,
166
- } from '~/components/common/vm/actions/common/lib/models/interfaces'
167
- import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
168
- import type { UI_I_OsChange } from '~/components/common/vm/actions/common/select/lib/models/interfaces'
169
- import type {
170
- UI_I_SendDataCpu,
171
- UI_I_SendDataMemory,
172
- UI_I_SendDataNewCdDvdDrive,
173
- UI_I_SendDataNewHardDisk,
174
- UI_I_SendDataNewNetwork,
175
- } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
176
- import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
177
- import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/models/types'
178
- import type { UI_I_PciDevice } from '~/lib/models/store/vm/interfaces'
179
- import { capabilities } from '~/components/common/vm/actions/common/lib/config/capabilities'
180
- import {
181
- stepsSchemeInitial,
182
- stepsFunc,
183
- } from '~/components/common/vm/actions/add/lib/config/steps'
184
- import Wizard from '~/components/atoms/wizard/lib/utils/utils'
185
- import { mapCapabilities } from '~/components/common/vm/actions/common/lib/utils/capabilities'
186
-
187
- const props = defineProps<{
188
- project: UI_T_Project
189
- nodes: UI_I_FileTreeNode[]
190
- files: UI_I_FileTreeNode[]
191
- networksTable: UI_I_NetworkTableItem[]
192
- datastore: UI_I_DatastoreTableItem[]
193
- errorValidationFields: UI_I_ErrorValidationField[]
194
- readyCompleteTableInfo: UI_I_TableInfoItem[]
195
- vmCpuHelpTextSecond: string
196
- importFromVMWarevSphere: string
197
- finishFunc: UI_T_AddVmFinishFunc
198
- getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
199
- validateSendDataFunc: UI_T_AddVmFinishFunc<
200
- [UI_T_SelectedNavItem, null | number] | null
201
- >
202
- passthroughDevices: UI_I_PciDevice[]
203
- vmNameInWizard: string
204
- filesLoading: boolean
205
- capabilities?: UI_I_Capabilities
206
- dataCenter?: UI_I_TreeNode // для сферы
207
- computeResource?: UI_I_TreeNode // для сферы
208
- computeResourceTree?: UI_I_TreeNode[] // для сферы
209
- }>()
210
-
211
- const emits = defineEmits<{
212
- (event: 'check-name', value: [string, (error: API_UI_I_Error) => void]): void
213
- (event: 'get-storage', value: UI_I_TablePayload): void
214
- (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
215
- (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
216
- (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
217
- (event: 'remove-error-by-title', value: string): void
218
- (event: 'get-networks-table', value: UI_I_TablePayload): void
219
- (event: 'get-pci-devices'): void
220
- (event: 'get-pci-devices'): void
221
- (event: 'hide'): void
222
- (
223
- event: 'get-compute-resource-tree',
224
- value: { id: string | number; cb: () => void }
225
- ): void // для сферы
226
- (event: 'show-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
227
- (event: 'select-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
228
- (event: 'clear-compute-resource-tree'): void // для сферы
229
- }>()
230
-
231
- const isSphere = computed<boolean>(() => props.project === 'sphere')
232
-
233
- const { $recursion } = useNuxtApp()
234
-
235
- const localization = computed<UI_I_Localization>(() => useLocal())
236
-
237
- watch(
238
- () => props.capabilities,
239
- () => {
240
- if (props.capabilities) mapCapabilities(props.capabilities)
241
- },
242
- { deep: true, immediate: true }
243
- )
244
-
245
- const wizard: Wizard = new Wizard(
246
- stepsFunc(localization.value),
247
- stepsSchemeInitial
248
- )
249
- if (isSphere.value) wizard.changeScheme(1)
250
- const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
251
- // const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
252
-
253
- const isShowPowerOn = computed<boolean>(() => wizard.selectedStepId > 8)
254
-
255
- const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
256
- wizard.changeSteps(value, validationFunc, validateSendData)
257
- }
258
- const validationFunc = async (
259
- value: UI_I_WizardStep[],
260
- currentStep: UI_I_WizardStep,
261
- nextStep: UI_I_WizardStep
262
- ): Promise<UI_I_ValidationReturn> => {
263
- let stepHasError = false
264
- let stepShouldStop = {
265
- ifOnCurrentStep: false,
266
- ifFromAnyStep: false,
267
- stoppageStepId: -1,
268
- }
269
-
270
- wizard.setLoader(true)
271
- if (
272
- wizard.isValidateForStep(
273
- isSphere.value ? 2 : 1,
274
- currentStep.id,
275
- nextStep.id
276
- )
277
- ) {
278
- const nameValidation = await checkName(value)
279
-
280
- value = nameValidation.newValue
281
- stepHasError = stepHasError || nameValidation.stepHasError
282
- } else if (
283
- isSphere.value &&
284
- wizard.isValidateForStep(3, currentStep.id, nextStep.id)
285
- ) {
286
- const computeResourceValidation = await checkComputeResource(value)
287
-
288
- value = computeResourceValidation.newValue
289
- stepHasError = stepHasError || computeResourceValidation.stepHasError
290
- } else if (wizard.isValidateForStep(4, currentStep.id, nextStep.id)) {
291
- const storageValidation = await checkStorage(value)
292
-
293
- value = storageValidation.newValue
294
-
295
- stepHasError = stepHasError || storageValidation.stepHasError
296
- } else if (wizard.isValidateForStep(8, currentStep.id, nextStep.id)) {
297
- const storageValidation = await checkCustomizeHardware(value)
298
-
299
- value = storageValidation.newValue
300
-
301
- stepHasError = stepHasError || storageValidation.stepHasError
302
- }
303
- wizard.setLoader(false)
304
-
305
- return {
306
- newValue: value,
307
- stepHasError,
308
- stepShouldStop,
309
- }
310
- }
311
- const checkName = async (
312
- value: UI_I_WizardStep[]
313
- ): Promise<UI_I_ValidationReturn> => {
314
- let stepHasError = false
315
-
316
- return new Promise((resolve) => {
317
- const step = isSphere.value ? 2 : 1
318
- nameFormSubmit.value = (isValid: boolean) => {
319
- if (!isValid) {
320
- stepHasError = wizard.setValidation(step, 'name', {
321
- fieldMessage: 'aaa',
322
- alertMessage: 'aaa',
323
- })
324
- } else if (wizard.hasMessage(step, 'name')) {
325
- value = wizard.removeValidation(step, 'name', value)
326
- }
327
-
328
- resolve({
329
- stepHasError,
330
- newValue: value,
331
- })
332
- nameFormSubmit.value = null
333
- }
334
- })
335
- }
336
- const checkComputeResource = async (
337
- value: UI_I_WizardStep[]
338
- ): Promise<UI_I_ValidationReturn> => {
339
- let stepHasError = false
340
-
341
- return new Promise((resolve) => {
342
- computeResourceSubmit.value = (isValid: boolean) => {
343
- if (!isValid) {
344
- stepHasError = wizard.setValidation(3, 'computeResource', {
345
- fieldMessage: 'aaa',
346
- alertMessage: 'aaa',
347
- })
348
- } else if (wizard.hasMessage(3, 'computeResource')) {
349
- value = wizard.removeValidation(3, 'computeResource', value)
350
- }
351
-
352
- resolve({
353
- stepHasError,
354
- newValue: value,
355
- })
356
- computeResourceSubmit.value = null
357
- }
358
- })
359
- }
360
- const checkStorage = async (
361
- value: UI_I_WizardStep[]
362
- ): Promise<UI_I_ValidationReturn> => {
363
- let stepHasError = false
364
-
365
- return new Promise((resolve) => {
366
- storageSubmit.value = (isValid: boolean) => {
367
- if (!isValid) {
368
- stepHasError = wizard.setValidation(4, 'storage', {
369
- fieldMessage: 'aaa',
370
- alertMessage: 'aaa',
371
- })
372
- } else if (wizard.hasMessage(4, 'storage')) {
373
- value = wizard.removeValidation(4, 'storage', value)
374
- }
375
-
376
- resolve({
377
- stepHasError,
378
- newValue: value,
379
- })
380
- storageSubmit.value = null
381
- }
382
- })
383
- }
384
- const checkCustomizeHardware = async (
385
- value: UI_I_WizardStep[]
386
- ): Promise<UI_I_ValidationReturn> => {
387
- let stepHasError = false
388
-
389
- return new Promise((resolve) => {
390
- customizeHardwareSubmit.value = (isValid: boolean) => {
391
- if (!isValid) {
392
- stepHasError = wizard.setValidation(8, 'customizeHardware', {
393
- fieldMessage: 'aaa',
394
- alertMessage: 'aaa',
395
- })
396
- } else if (wizard.hasMessage(8, 'customizeHardware')) {
397
- value = wizard.removeValidation(8, 'customizeHardware', value)
398
- }
399
-
400
- resolve({
401
- stepHasError,
402
- newValue: value,
403
- })
404
- storageSubmit.value = null
405
- }
406
- })
407
- }
408
-
409
- const storageIdCash = ref<string | null>(null)
410
- const vmForm = ref<UI_I_VmForm>({
411
- name: '',
412
- compatibility: '',
413
- guestMachineType: null,
414
- guestOsFamily: null,
415
- guestOsVersion: null,
416
- computeResource: null,
417
- storage: null,
418
- locationPath: '',
419
- dataCenter: null,
420
- })
421
- const vmFormCash = ref<UI_I_VmFormCash>({
422
- dataCenterId: null,
423
- computeResourceTypeAndId: null,
424
- })
425
-
426
- const onChangeName = (name: string, node: UI_I_TreeNode): void => {
427
- vmForm.value.name = name
428
- if (isSphere.value) {
429
- vmForm.value.locationPath = node.id
430
- vmForm.value.dataCenter = $recursion.findParentByValue(
431
- node,
432
- 'datacenter',
433
- 'type',
434
- 'parent'
435
- )
436
- vmFormCash.value.dataCenterId = vmForm.value.dataCenter?.id || null
437
- }
438
- }
439
- // // Для сферы
440
- const computeResourcePath = ref<string>('')
441
- const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
442
- emits('select-compute-resource-tree', node)
443
- computeResourcePath.value = node.id
444
- }
445
- const onChangeComputeResource = (node: UI_I_TreeNode): void => {
446
- vmForm.value.computeResource = node
447
- // const type = node.type.toUpperCase()
448
- // schedRequirementsTemplate.value = `sched_requirements="(${type}_ID=${node.id})"\\`
449
- vmFormCash.value.computeResourceTypeAndId = `${node.type}${node.id}` || null
450
- }
451
- const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
452
- if (!storage) return
453
-
454
- vmForm.value.storage = storage
455
- storageIdCash.value = storage.id
456
- }
457
- const compatibilityInfo = ref<string>('')
458
- const onChangeCompatibility = (compatibility: UI_I_OptionItem): void => {
459
- vmForm.value.compatibility = compatibility.value
460
-
461
- const version = compatibility.value.split('-')[1]
462
- compatibilityInfo.value = `${localization.value.common.compatibility}: ${compatibility.text} (${localization.value.common.vmVersion} ${version})`
463
- }
464
- const onChangeOs = (data: UI_I_OsChange): void => {
465
- vmForm.value.guestMachineType = data.selectedMachineType
466
- vmForm.value.guestOsFamily = data.selectedOS
467
- vmForm.value.guestOsVersion = data.selectedVersion
468
- }
469
- const customizeHardware = ref<UI_I_SendDataCustomizeHardware | null>(null)
470
- const onChangeCustomizeHardware = (
471
- data: UI_I_SendDataCustomizeHardware
472
- ): void => {
473
- customizeHardware.value = data
474
- }
475
-
476
- const virtualHardwareHardDisksLocal = computed<
477
- UI_I_SendDataNewHardDisk[] | null
478
- >(() => customizeHardware.value?.virtualHardware?.hardDisks || null)
479
- const virtualHardwareNetworksLocal = computed<UI_I_SendDataNewNetwork[] | null>(
480
- () => customizeHardware.value?.virtualHardware?.networks || null
481
- )
482
- const virtualHardwareCdDvdDrivesLocal = computed<
483
- UI_I_SendDataNewCdDvdDrive[] | null
484
- >(() => customizeHardware.value?.virtualHardware?.cdDvdDrives || null)
485
-
486
- const virtualHardwareCpu = computed<UI_I_SendDataCpu | null>(
487
- () => customizeHardware.value?.virtualHardware?.cpu || null
488
- )
489
- const virtualHardwareMemory = computed<UI_I_SendDataMemory | null>(
490
- () => customizeHardware.value?.virtualHardware?.memory || null
491
- )
492
- const virtualHardwareHardDisks = ref<UI_I_SendDataNewHardDisk[] | null>(null)
493
- const virtualHardwareCdDvdDrives = ref<UI_I_SendDataNewCdDvdDrive[] | null>(
494
- null
495
- )
496
- const virtualHardwareNetworks = ref<UI_I_SendDataNewNetwork[] | null>(null)
497
- const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
498
- virtualHardwareHardDisks.value = data[0]
499
- virtualHardwareCdDvdDrives.value = data[1]
500
- virtualHardwareNetworks.value = data[2]
501
- }
502
-
503
- const isPowerOnByDefault = ref<boolean>(true)
504
-
505
- watch(
506
- () => props.vmNameInWizard,
507
- (newValue) => {
508
- vmForm.value.name = newValue
509
- }
510
- )
511
-
512
- const validateSendData = async (
513
- value: UI_I_WizardStep[]
514
- ): Promise<UI_I_ValidationReturn> => {
515
- wizard.setLoader(true)
516
- let stepHasError = false
517
-
518
- const data = await props.validateSendDataFunc(
519
- vmForm.value,
520
- virtualHardwareCpu.value,
521
- virtualHardwareMemory.value,
522
- customizeHardware.value,
523
- virtualHardwareNetworks.value,
524
- virtualHardwareHardDisks.value,
525
- virtualHardwareCdDvdDrives.value,
526
- isPowerOnByDefault.value,
527
- localization.value,
528
- vmForm.value.locationPath, // для сферы
529
- computeResourcePath.value // для сферы
530
- )
531
-
532
- wizard.setLoader(false)
533
- if (data) {
534
- stepHasError = true
535
- selectedNavItem.value = data[0]
536
- data[1] !== null && wizard.selectStepHard(data[1])
537
- }
538
-
539
- return {
540
- stepHasError,
541
- newValue: value,
542
- }
543
- }
544
- const onFinish = (): void => {
545
- wizard.setLoader(false)
546
- props
547
- .finishFunc(
548
- vmForm.value,
549
- virtualHardwareCpu.value,
550
- virtualHardwareMemory.value,
551
- customizeHardware.value,
552
- virtualHardwareNetworks.value,
553
- virtualHardwareHardDisks.value,
554
- virtualHardwareCdDvdDrives.value,
555
- isPowerOnByDefault.value,
556
- localization.value,
557
- vmForm.value.locationPath, // для сферы
558
- computeResourcePath.value, // для сферы
559
- false
560
- )
561
- .then(() => {
562
- onHideModal()
563
- wizard.setLoader(false)
564
- })
565
- }
566
-
567
- const selectedNavItem = ref<UI_T_SelectedNavItem>(0)
568
-
569
- const { isDev } = useAppVersion()
570
-
571
- const nameFormSubmit = ref<null | Function>(null)
572
- const computeResourceSubmit = ref<null | Function>(null)
573
- const storageSubmit = ref<null | Function>(null)
574
- const customizeHardwareSubmit = ref<null | Function>(null)
575
- const compatibility = ref<UI_I_OptionItem[]>(
576
- capabilities.compatibility.filter((camp) => {
577
- let result = true
578
- if (isDev && camp.value === 'pvm-2') result = false
579
- return result
580
- })
581
- )
582
- const guestOsFamilies = ref<UI_I_OptionItem[]>(capabilities.guestOsFamilies)
583
- const guestOsVersions = ref<UI_I_ArbitraryObject<UI_I_OptionItem[]>>(
584
- capabilities.guestOsVersions
585
- )
586
- const machineTypes = ref<UI_I_OptionItem[]>(capabilities.machineTypes)
587
- const cpuModels = ref<UI_I_OptionItem[]>(capabilities.cpuModels)
588
- const maxCpus = ref<number>(capabilities.maxCpus)
589
- const maxMemory = ref<number>(capabilities.maxMemory)
590
-
591
- const onHideModal = (): void => {
592
- emits('hide')
593
- }
594
- </script>
595
-
596
- <style scoped lang="scss">
597
- :deep(.modal-body) {
598
- display: flex;
599
- flex-direction: column;
600
- }
601
- .add-vm-content {
602
- display: flex;
603
- flex-direction: column;
604
- flex: 1;
605
- }
606
- .vm-hardware-version {
607
- align-self: flex-end;
608
- margin-top: auto;
609
- }
610
- .power-on-by-default-wrap {
611
- display: flex;
612
- align-items: center;
613
- margin-right: auto;
614
-
615
- input {
616
- margin-right: 6px;
617
- }
618
- }
619
- </style>
1
+ <template>
2
+ <div class="add-vm">
3
+ <atoms-wizard
4
+ show
5
+ :wizard="wizard"
6
+ :selected-scheme="selectedScheme"
7
+ :title="localization.common.newVirtualMachine2"
8
+ :localization="localization"
9
+ test-id="new-virtual-machine-wizard"
10
+ @change-steps="onChangeSteps"
11
+ @hide="onHideModal"
12
+ @submit="onFinish"
13
+ >
14
+ <template #modalBody="{ selectedStep }">
15
+ <div class="add-vm-content">
16
+ <common-vm-actions-common-select-create-type
17
+ v-show="selectedStep.id === 0"
18
+ :import-from-v-m-warev-sphere="props.importFromVMWarevSphere"
19
+ />
20
+ <common-vm-actions-common-select-name
21
+ v-show="selectedStep.id === 1 || selectedStep.id === 2"
22
+ :show="selectedStep.id === 1 || selectedStep.id === 2"
23
+ :name-form-submit="nameFormSubmit"
24
+ :project="props.project"
25
+ :data-center="props.dataCenter"
26
+ @submit="onChangeName(...$event)"
27
+ @check-name="emits('check-name', $event)"
28
+ />
29
+ <common-vm-actions-common-select-compute-resource
30
+ v-if="isSphere"
31
+ v-show="selectedStep.id === 3"
32
+ v-model="vmForm.computeResource"
33
+ :compute-resource-submit="computeResourceSubmit"
34
+ :data-center="vmForm.dataCenter"
35
+ :compute-resource="props.computeResource"
36
+ :compute-resource-tree="props.computeResourceTree"
37
+ @submit="onChangeComputeResource"
38
+ @select-compute-resource-tree="onSelectComputeResourceTree"
39
+ @get-compute-resource-tree="
40
+ emits('get-compute-resource-tree', $event)
41
+ "
42
+ @show-compute-resource-tree="
43
+ emits('show-compute-resource-tree', $event)
44
+ "
45
+ @clear-compute-resource-tree="
46
+ emits('clear-compute-resource-tree', $event)
47
+ "
48
+ />
49
+ <common-vm-actions-common-select-storage
50
+ v-show="selectedStep.id === 4"
51
+ :storage-submit="storageSubmit"
52
+ :datastore="props.datastore"
53
+ :get-datastore-table-func="props.getDatastoreTableFunc"
54
+ @submit="onChangeStorage"
55
+ />
56
+ <common-vm-actions-common-select-compatibility
57
+ v-show="selectedStep.id === 5"
58
+ :options="compatibility"
59
+ :error-validation-fields="props.errorValidationFields"
60
+ @change="onChangeCompatibility"
61
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
62
+ />
63
+ <common-vm-actions-common-select-os
64
+ v-show="selectedStep.id === 6 || selectedStep.id === 7"
65
+ :families-options="guestOsFamilies"
66
+ :versions-options="guestOsVersions"
67
+ :machine-types-options="machineTypes"
68
+ :error-validation-fields="props.errorValidationFields"
69
+ @change="onChangeOs"
70
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
71
+ />
72
+ <common-vm-actions-common-customize-hardware
73
+ v-show="selectedStep.id === 8"
74
+ :project="props.project"
75
+ :vm-name="vmForm.name"
76
+ :guest-machine-type="vmForm.guestMachineType"
77
+ :guest-os-family="vmForm.guestOsFamily"
78
+ :guest-os-version="vmForm.guestOsVersion"
79
+ :storage="vmForm.storage"
80
+ :hard-disks-for-boot-options="virtualHardwareHardDisksLocal"
81
+ :cd-dvd-drives-for-boot-options="virtualHardwareCdDvdDrivesLocal"
82
+ :networks-for-boot-options="virtualHardwareNetworksLocal"
83
+ :cd-dvd-drives="virtualHardwareCdDvdDrivesLocal"
84
+ :customize-hardware-submit="customizeHardwareSubmit"
85
+ :max-cpus="maxCpus"
86
+ :max-memory="maxMemory"
87
+ :cpu-models="cpuModels"
88
+ :selected-nav-item="selectedNavItem"
89
+ :nodes="props.nodes"
90
+ :files="props.files"
91
+ :networks-table="props.networksTable"
92
+ :error-validation-fields="props.errorValidationFields"
93
+ :get-datastore-table-func="props.getDatastoreTableFunc"
94
+ :datastore="props.datastore"
95
+ :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
96
+ :passthrough-devices="props.passthroughDevices"
97
+ :files-loading="props.filesLoading"
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-ready-to-complete
109
+ v-if="selectedStep.id === 9"
110
+ :data="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
+ data-id="power-on-by-default"
124
+ type="checkbox"
125
+ />
126
+ <label for="power-on-by-default" class="label-text-normal">{{
127
+ localization.common.powerOnByDefault
128
+ }}</label>
129
+ </div>
130
+ </template>
131
+ </atoms-wizard>
132
+ </div>
133
+ </template>
134
+
135
+ <script setup lang="ts">
136
+ import type {
137
+ UI_I_Localization,
138
+ UI_I_ArbitraryObject,
139
+ } from '~/lib/models/interfaces'
140
+ import type { UI_T_Project } from '~/lib/models/types'
141
+ import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
142
+ import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
143
+ import type {
144
+ UI_I_DatastoreTableItem,
145
+ UI_I_FolderOrFileTreePayload,
146
+ } from '~/lib/models/store/storage/interfaces'
147
+ import type {
148
+ API_UI_I_Error,
149
+ UI_I_ErrorValidationField,
150
+ } from '~/lib/models/store/interfaces'
151
+ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
152
+ import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
153
+ import type {
154
+ UI_T_AddVmFinishFunc,
155
+ UI_T_SelectedNavItem,
156
+ } from '~/components/common/vm/actions/common/lib/models/types'
157
+ import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
158
+ import type {
159
+ UI_I_ValidationReturn,
160
+ UI_I_WizardStep,
161
+ } from '~/components/atoms/wizard/lib/models/interfaces'
162
+ import type {
163
+ UI_I_Capabilities,
164
+ UI_I_VmForm,
165
+ UI_I_VmFormCash,
166
+ } from '~/components/common/vm/actions/common/lib/models/interfaces'
167
+ import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
168
+ import type { UI_I_OsChange } from '~/components/common/vm/actions/common/select/lib/models/interfaces'
169
+ import type {
170
+ UI_I_SendDataCpu,
171
+ UI_I_SendDataMemory,
172
+ UI_I_SendDataNewCdDvdDrive,
173
+ UI_I_SendDataNewHardDisk,
174
+ UI_I_SendDataNewNetwork,
175
+ } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
176
+ import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
177
+ import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/models/types'
178
+ import type { UI_I_PciDevice } from '~/lib/models/store/vm/interfaces'
179
+ import { capabilities } from '~/components/common/vm/actions/common/lib/config/capabilities'
180
+ import {
181
+ stepsSchemeInitial,
182
+ stepsFunc,
183
+ } from '~/components/common/vm/actions/add/lib/config/steps'
184
+ import Wizard from '~/components/atoms/wizard/lib/utils/utils'
185
+ import { mapCapabilities } from '~/components/common/vm/actions/common/lib/utils/capabilities'
186
+
187
+ const props = defineProps<{
188
+ project: UI_T_Project
189
+ nodes: UI_I_FileTreeNode[]
190
+ files: UI_I_FileTreeNode[]
191
+ networksTable: UI_I_NetworkTableItem[]
192
+ datastore: UI_I_DatastoreTableItem[]
193
+ errorValidationFields: UI_I_ErrorValidationField[]
194
+ readyCompleteTableInfo: UI_I_TableInfoItem[]
195
+ vmCpuHelpTextSecond: string
196
+ importFromVMWarevSphere: string
197
+ finishFunc: UI_T_AddVmFinishFunc
198
+ getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
199
+ validateSendDataFunc: UI_T_AddVmFinishFunc<
200
+ [UI_T_SelectedNavItem, null | number] | null
201
+ >
202
+ passthroughDevices: UI_I_PciDevice[]
203
+ vmNameInWizard: string
204
+ filesLoading: boolean
205
+ capabilities?: UI_I_Capabilities
206
+ dataCenter?: UI_I_TreeNode // для сферы
207
+ computeResource?: UI_I_TreeNode // для сферы
208
+ computeResourceTree?: UI_I_TreeNode[] // для сферы
209
+ }>()
210
+
211
+ const emits = defineEmits<{
212
+ (event: 'check-name', value: [string, (error: API_UI_I_Error) => void]): void
213
+ (event: 'get-storage', value: UI_I_TablePayload): void
214
+ (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
215
+ (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
216
+ (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
217
+ (event: 'remove-error-by-title', value: string): void
218
+ (event: 'get-networks-table', value: UI_I_TablePayload): void
219
+ (event: 'get-pci-devices'): void
220
+ (event: 'get-pci-devices'): void
221
+ (event: 'hide'): void
222
+ (
223
+ event: 'get-compute-resource-tree',
224
+ value: { id: string | number; cb: () => void }
225
+ ): void // для сферы
226
+ (event: 'show-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
227
+ (event: 'select-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
228
+ (event: 'clear-compute-resource-tree'): void // для сферы
229
+ }>()
230
+
231
+ const isSphere = computed<boolean>(() => props.project === 'sphere')
232
+
233
+ const { $recursion } = useNuxtApp()
234
+
235
+ const localization = computed<UI_I_Localization>(() => useLocal())
236
+
237
+ watch(
238
+ () => props.capabilities,
239
+ () => {
240
+ if (props.capabilities) mapCapabilities(props.capabilities)
241
+ },
242
+ { deep: true, immediate: true }
243
+ )
244
+
245
+ const wizard: Wizard = new Wizard(
246
+ stepsFunc(localization.value),
247
+ stepsSchemeInitial
248
+ )
249
+ if (isSphere.value) wizard.changeScheme(1)
250
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
251
+ // const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
252
+
253
+ const isShowPowerOn = computed<boolean>(() => wizard.selectedStepId > 8)
254
+
255
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
256
+ wizard.changeSteps(value, validationFunc, validateSendData)
257
+ }
258
+ const validationFunc = async (
259
+ value: UI_I_WizardStep[],
260
+ currentStep: UI_I_WizardStep,
261
+ nextStep: UI_I_WizardStep
262
+ ): Promise<UI_I_ValidationReturn> => {
263
+ let stepHasError = false
264
+ let stepShouldStop = {
265
+ ifOnCurrentStep: false,
266
+ ifFromAnyStep: false,
267
+ stoppageStepId: -1,
268
+ }
269
+
270
+ wizard.setLoader(true)
271
+ if (
272
+ wizard.isValidateForStep(
273
+ isSphere.value ? 2 : 1,
274
+ currentStep.id,
275
+ nextStep.id
276
+ )
277
+ ) {
278
+ const nameValidation = await checkName(value)
279
+
280
+ value = nameValidation.newValue
281
+ stepHasError = stepHasError || nameValidation.stepHasError
282
+ } else if (
283
+ isSphere.value &&
284
+ wizard.isValidateForStep(3, currentStep.id, nextStep.id)
285
+ ) {
286
+ const computeResourceValidation = await checkComputeResource(value)
287
+
288
+ value = computeResourceValidation.newValue
289
+ stepHasError = stepHasError || computeResourceValidation.stepHasError
290
+ } else if (wizard.isValidateForStep(4, currentStep.id, nextStep.id)) {
291
+ const storageValidation = await checkStorage(value)
292
+
293
+ value = storageValidation.newValue
294
+
295
+ stepHasError = stepHasError || storageValidation.stepHasError
296
+ } else if (wizard.isValidateForStep(8, currentStep.id, nextStep.id)) {
297
+ const storageValidation = await checkCustomizeHardware(value)
298
+
299
+ value = storageValidation.newValue
300
+
301
+ stepHasError = stepHasError || storageValidation.stepHasError
302
+ }
303
+ wizard.setLoader(false)
304
+
305
+ return {
306
+ newValue: value,
307
+ stepHasError,
308
+ stepShouldStop,
309
+ }
310
+ }
311
+ const checkName = async (
312
+ value: UI_I_WizardStep[]
313
+ ): Promise<UI_I_ValidationReturn> => {
314
+ let stepHasError = false
315
+
316
+ return new Promise((resolve) => {
317
+ const step = isSphere.value ? 2 : 1
318
+ nameFormSubmit.value = (isValid: boolean) => {
319
+ if (!isValid) {
320
+ stepHasError = wizard.setValidation(step, 'name', {
321
+ fieldMessage: 'aaa',
322
+ alertMessage: 'aaa',
323
+ })
324
+ } else if (wizard.hasMessage(step, 'name')) {
325
+ value = wizard.removeValidation(step, 'name', value)
326
+ }
327
+
328
+ resolve({
329
+ stepHasError,
330
+ newValue: value,
331
+ })
332
+ nameFormSubmit.value = null
333
+ }
334
+ })
335
+ }
336
+ const checkComputeResource = async (
337
+ value: UI_I_WizardStep[]
338
+ ): Promise<UI_I_ValidationReturn> => {
339
+ let stepHasError = false
340
+
341
+ return new Promise((resolve) => {
342
+ computeResourceSubmit.value = (isValid: boolean) => {
343
+ if (!isValid) {
344
+ stepHasError = wizard.setValidation(3, 'computeResource', {
345
+ fieldMessage: 'aaa',
346
+ alertMessage: 'aaa',
347
+ })
348
+ } else if (wizard.hasMessage(3, 'computeResource')) {
349
+ value = wizard.removeValidation(3, 'computeResource', value)
350
+ }
351
+
352
+ resolve({
353
+ stepHasError,
354
+ newValue: value,
355
+ })
356
+ computeResourceSubmit.value = null
357
+ }
358
+ })
359
+ }
360
+ const checkStorage = async (
361
+ value: UI_I_WizardStep[]
362
+ ): Promise<UI_I_ValidationReturn> => {
363
+ let stepHasError = false
364
+
365
+ return new Promise((resolve) => {
366
+ storageSubmit.value = (isValid: boolean) => {
367
+ if (!isValid) {
368
+ stepHasError = wizard.setValidation(4, 'storage', {
369
+ fieldMessage: 'aaa',
370
+ alertMessage: 'aaa',
371
+ })
372
+ } else if (wizard.hasMessage(4, 'storage')) {
373
+ value = wizard.removeValidation(4, 'storage', value)
374
+ }
375
+
376
+ resolve({
377
+ stepHasError,
378
+ newValue: value,
379
+ })
380
+ storageSubmit.value = null
381
+ }
382
+ })
383
+ }
384
+ const checkCustomizeHardware = async (
385
+ value: UI_I_WizardStep[]
386
+ ): Promise<UI_I_ValidationReturn> => {
387
+ let stepHasError = false
388
+
389
+ return new Promise((resolve) => {
390
+ customizeHardwareSubmit.value = (isValid: boolean) => {
391
+ if (!isValid) {
392
+ stepHasError = wizard.setValidation(8, 'customizeHardware', {
393
+ fieldMessage: 'aaa',
394
+ alertMessage: 'aaa',
395
+ })
396
+ } else if (wizard.hasMessage(8, 'customizeHardware')) {
397
+ value = wizard.removeValidation(8, 'customizeHardware', value)
398
+ }
399
+
400
+ resolve({
401
+ stepHasError,
402
+ newValue: value,
403
+ })
404
+ storageSubmit.value = null
405
+ }
406
+ })
407
+ }
408
+
409
+ const storageIdCash = ref<string | null>(null)
410
+ const vmForm = ref<UI_I_VmForm>({
411
+ name: '',
412
+ compatibility: '',
413
+ guestMachineType: null,
414
+ guestOsFamily: null,
415
+ guestOsVersion: null,
416
+ computeResource: null,
417
+ storage: null,
418
+ locationPath: '',
419
+ dataCenter: null,
420
+ })
421
+ const vmFormCash = ref<UI_I_VmFormCash>({
422
+ dataCenterId: null,
423
+ computeResourceTypeAndId: null,
424
+ })
425
+
426
+ const onChangeName = (name: string, node: UI_I_TreeNode): void => {
427
+ vmForm.value.name = name
428
+ if (isSphere.value) {
429
+ vmForm.value.locationPath = node.id
430
+ vmForm.value.dataCenter = $recursion.findParentByValue(
431
+ node,
432
+ 'datacenter',
433
+ 'type',
434
+ 'parent'
435
+ )
436
+ vmFormCash.value.dataCenterId = vmForm.value.dataCenter?.id || null
437
+ }
438
+ }
439
+ // // Для сферы
440
+ const computeResourcePath = ref<string>('')
441
+ const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
442
+ emits('select-compute-resource-tree', node)
443
+ computeResourcePath.value = node.id
444
+ }
445
+ const onChangeComputeResource = (node: UI_I_TreeNode): void => {
446
+ vmForm.value.computeResource = node
447
+ // const type = node.type.toUpperCase()
448
+ // schedRequirementsTemplate.value = `sched_requirements="(${type}_ID=${node.id})"\\`
449
+ vmFormCash.value.computeResourceTypeAndId = `${node.type}${node.id}` || null
450
+ }
451
+ const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
452
+ if (!storage) return
453
+
454
+ vmForm.value.storage = storage
455
+ storageIdCash.value = storage.id
456
+ }
457
+ const compatibilityInfo = ref<string>('')
458
+ const onChangeCompatibility = (compatibility: UI_I_OptionItem): void => {
459
+ vmForm.value.compatibility = compatibility.value
460
+
461
+ const version = compatibility.value.split('-')[1]
462
+ compatibilityInfo.value = `${localization.value.common.compatibility}: ${compatibility.text} (${localization.value.common.vmVersion} ${version})`
463
+ }
464
+ const onChangeOs = (data: UI_I_OsChange): void => {
465
+ vmForm.value.guestMachineType = data.selectedMachineType
466
+ vmForm.value.guestOsFamily = data.selectedOS
467
+ vmForm.value.guestOsVersion = data.selectedVersion
468
+ }
469
+ const customizeHardware = ref<UI_I_SendDataCustomizeHardware | null>(null)
470
+ const onChangeCustomizeHardware = (
471
+ data: UI_I_SendDataCustomizeHardware
472
+ ): void => {
473
+ customizeHardware.value = data
474
+ }
475
+
476
+ const virtualHardwareHardDisksLocal = computed<
477
+ UI_I_SendDataNewHardDisk[] | null
478
+ >(() => customizeHardware.value?.virtualHardware?.hardDisks || null)
479
+ const virtualHardwareNetworksLocal = computed<UI_I_SendDataNewNetwork[] | null>(
480
+ () => customizeHardware.value?.virtualHardware?.networks || null
481
+ )
482
+ const virtualHardwareCdDvdDrivesLocal = computed<
483
+ UI_I_SendDataNewCdDvdDrive[] | null
484
+ >(() => customizeHardware.value?.virtualHardware?.cdDvdDrives || null)
485
+
486
+ const virtualHardwareCpu = computed<UI_I_SendDataCpu | null>(
487
+ () => customizeHardware.value?.virtualHardware?.cpu || null
488
+ )
489
+ const virtualHardwareMemory = computed<UI_I_SendDataMemory | null>(
490
+ () => customizeHardware.value?.virtualHardware?.memory || null
491
+ )
492
+ const virtualHardwareHardDisks = ref<UI_I_SendDataNewHardDisk[] | null>(null)
493
+ const virtualHardwareCdDvdDrives = ref<UI_I_SendDataNewCdDvdDrive[] | null>(
494
+ null
495
+ )
496
+ const virtualHardwareNetworks = ref<UI_I_SendDataNewNetwork[] | null>(null)
497
+ const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
498
+ virtualHardwareHardDisks.value = data[0]
499
+ virtualHardwareCdDvdDrives.value = data[1]
500
+ virtualHardwareNetworks.value = data[2]
501
+ }
502
+
503
+ const isPowerOnByDefault = ref<boolean>(true)
504
+
505
+ watch(
506
+ () => props.vmNameInWizard,
507
+ (newValue) => {
508
+ vmForm.value.name = newValue
509
+ }
510
+ )
511
+
512
+ const validateSendData = async (
513
+ value: UI_I_WizardStep[]
514
+ ): Promise<UI_I_ValidationReturn> => {
515
+ wizard.setLoader(true)
516
+ let stepHasError = false
517
+
518
+ const data = await props.validateSendDataFunc(
519
+ vmForm.value,
520
+ virtualHardwareCpu.value,
521
+ virtualHardwareMemory.value,
522
+ customizeHardware.value,
523
+ virtualHardwareNetworks.value,
524
+ virtualHardwareHardDisks.value,
525
+ virtualHardwareCdDvdDrives.value,
526
+ isPowerOnByDefault.value,
527
+ localization.value,
528
+ vmForm.value.locationPath, // для сферы
529
+ computeResourcePath.value // для сферы
530
+ )
531
+
532
+ wizard.setLoader(false)
533
+ if (data) {
534
+ stepHasError = true
535
+ selectedNavItem.value = data[0]
536
+ data[1] !== null && wizard.selectStepHard(data[1])
537
+ }
538
+
539
+ return {
540
+ stepHasError,
541
+ newValue: value,
542
+ }
543
+ }
544
+ const onFinish = (): void => {
545
+ wizard.setLoader(false)
546
+ props
547
+ .finishFunc(
548
+ vmForm.value,
549
+ virtualHardwareCpu.value,
550
+ virtualHardwareMemory.value,
551
+ customizeHardware.value,
552
+ virtualHardwareNetworks.value,
553
+ virtualHardwareHardDisks.value,
554
+ virtualHardwareCdDvdDrives.value,
555
+ isPowerOnByDefault.value,
556
+ localization.value,
557
+ vmForm.value.locationPath, // для сферы
558
+ computeResourcePath.value, // для сферы
559
+ false
560
+ )
561
+ .then(() => {
562
+ onHideModal()
563
+ wizard.setLoader(false)
564
+ })
565
+ }
566
+
567
+ const selectedNavItem = ref<UI_T_SelectedNavItem>(0)
568
+
569
+ const { isDev } = useAppVersion()
570
+
571
+ const nameFormSubmit = ref<null | Function>(null)
572
+ const computeResourceSubmit = ref<null | Function>(null)
573
+ const storageSubmit = ref<null | Function>(null)
574
+ const customizeHardwareSubmit = ref<null | Function>(null)
575
+ const compatibility = ref<UI_I_OptionItem[]>(
576
+ capabilities.compatibility.filter((camp) => {
577
+ let result = true
578
+ if (isDev && camp.value === 'pvm-2') result = false
579
+ return result
580
+ })
581
+ )
582
+ const guestOsFamilies = ref<UI_I_OptionItem[]>(capabilities.guestOsFamilies)
583
+ const guestOsVersions = ref<UI_I_ArbitraryObject<UI_I_OptionItem[]>>(
584
+ capabilities.guestOsVersions
585
+ )
586
+ const machineTypes = ref<UI_I_OptionItem[]>(capabilities.machineTypes)
587
+ const cpuModels = ref<UI_I_OptionItem[]>(capabilities.cpuModels)
588
+ const maxCpus = ref<number>(capabilities.maxCpus)
589
+ const maxMemory = ref<number>(capabilities.maxMemory)
590
+
591
+ const onHideModal = (): void => {
592
+ emits('hide')
593
+ }
594
+ </script>
595
+
596
+ <style scoped lang="scss">
597
+ :deep(.modal-body) {
598
+ display: flex;
599
+ flex-direction: column;
600
+ }
601
+ .add-vm-content {
602
+ display: flex;
603
+ flex-direction: column;
604
+ flex: 1;
605
+ }
606
+ .vm-hardware-version {
607
+ align-self: flex-end;
608
+ margin-top: auto;
609
+ }
610
+ .power-on-by-default-wrap {
611
+ display: flex;
612
+ align-items: center;
613
+ margin-right: auto;
614
+
615
+ input {
616
+ margin-right: 6px;
617
+ }
618
+ }
619
+ </style>