bfg-common 1.5.37 → 1.5.38

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 (191) hide show
  1. package/CODE_STYLE.md +109 -109
  2. package/assets/img/icons/icons-sprite-dark-3.svg +227 -227
  3. package/assets/img/icons/icons-sprite-dark-5.svg +488 -488
  4. package/assets/img/icons/icons-sprite-light-3.svg +227 -227
  5. package/assets/img/icons/icons-sprite-light-5.svg +488 -488
  6. package/assets/scss/common/normalize.scss +339 -339
  7. package/components/atoms/TheIcon3.vue +50 -50
  8. package/components/atoms/collapse/CollapseNav.vue +165 -165
  9. package/components/atoms/dropdown/dropdown/Dropdown.vue +168 -168
  10. package/components/atoms/modal/bySteps/BySteps.vue +253 -253
  11. package/components/atoms/perPage/PerPage.vue +58 -58
  12. package/components/atoms/stack/StackBlock.vue +185 -185
  13. package/components/atoms/table/dataGrid/DataGridColumnSwitch.vue +222 -222
  14. package/components/atoms/table/dataGrid/lib/config/settingsTable.ts +94 -94
  15. package/components/atoms/table/dataGrid/lib/utils/export.ts +16 -16
  16. package/components/atoms/tabs/VerticalTabs.vue +105 -105
  17. package/components/atoms/tooltip/Signpost.vue +227 -227
  18. package/components/common/accordion/Recursion.vue +222 -222
  19. package/components/common/browse/BrowseNew.vue +237 -237
  20. package/components/common/browse/BrowseOld.vue +217 -217
  21. package/components/common/browse/blocks/contents/Files.vue +37 -37
  22. package/components/common/browse/blocks/contents/FilesOld.vue +72 -72
  23. package/components/common/browse/blocks/contents/filesNew/FilesNew.vue +96 -96
  24. package/components/common/browse/blocks/contents/filesNew/Skeleton.vue +18 -18
  25. package/components/common/browse/blocks/lib/models/types.ts +1 -1
  26. package/components/common/browse/lib/models/interfaces.ts +5 -5
  27. package/components/common/context/Context.vue +111 -111
  28. package/components/common/context/lib/models/interfaces.ts +31 -31
  29. package/components/common/context/recursion/Recursion.vue +87 -87
  30. package/components/common/context/recursion/RecursionNew.vue +238 -238
  31. package/components/common/context/recursion/RecursionOld.vue +228 -228
  32. package/components/common/details/DetailsItem.vue +109 -109
  33. package/components/common/diagramMain/DiagramMain.vue +897 -897
  34. package/components/common/diagramMain/Header.vue +214 -214
  35. package/components/common/diagramMain/adapter/AdapterItems.vue +61 -61
  36. package/components/common/diagramMain/lib/config/initial.ts +50 -50
  37. package/components/common/diagramMain/lib/models/types.ts +21 -21
  38. package/components/common/diagramMain/lib/utils/utils.ts +331 -331
  39. package/components/common/diagramMain/modals/editSettings/ConfirmTeamingSettingsModal.vue +40 -40
  40. package/components/common/diagramMain/modals/editSettings/tabs/NetworkProperties.vue +214 -214
  41. package/components/common/diagramMain/modals/editSettings/tabs/Security.vue +189 -189
  42. package/components/common/diagramMain/modals/editSettings/tabs/SwitchProperties.vue +163 -163
  43. package/components/common/diagramMain/modals/editSettings/tabs/TeamingFailover.vue +175 -175
  44. package/components/common/diagramMain/modals/editSettings/tabs/port/IpvFourSettings.vue +346 -346
  45. package/components/common/diagramMain/modals/editSettings/tabs/port/PortProperties.vue +205 -205
  46. package/components/common/diagramMain/modals/lib/config/initial.ts +180 -180
  47. package/components/common/diagramMain/modals/lib/config/vmKernelAdapter.ts +90 -90
  48. package/components/common/diagramMain/modals/lib/mappers/mappers.ts +87 -87
  49. package/components/common/diagramMain/modals/lib/utils/index.ts +24 -24
  50. package/components/common/diagramMain/modals/migrateVmkernelAdapter/lib/config/steps.ts +114 -114
  51. package/components/common/diagramMain/modals/migrateVmkernelAdapter/steps/ConnectionSettings.vue +169 -169
  52. package/components/common/diagramMain/modals/migrateVmkernelAdapter/steps/SelectVmkernelAdapter.vue +159 -159
  53. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/common.ts +14 -14
  54. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/connectionSettings.ts +137 -137
  55. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/selectVmkernelAdapter.ts +52 -52
  56. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/validations.ts +19 -19
  57. package/components/common/diagramMain/port/Ports.vue +47 -47
  58. package/components/common/layout/theHeader/helpMenu/About.vue +82 -82
  59. package/components/common/layout/theHeader/helpMenu/aboutNew/AboutNew.vue +103 -103
  60. package/components/common/layout/theHeader/userMenu/modals/preferences/view/ViewOld.vue +112 -112
  61. package/components/common/mainNavigationPanel/MainNavigationPanelNew.vue +336 -336
  62. package/components/common/mainNavigationPanel/MainNavigationPanelOld.vue +311 -311
  63. package/components/common/modals/unsavedChanges/UnsavedChanges.vue +56 -56
  64. package/components/common/monitor/overview/OverviewOld.vue +139 -139
  65. package/components/common/pages/home/StatusContent.vue +49 -49
  66. package/components/common/pages/home/headline/Headline.vue +45 -45
  67. package/components/common/pages/home/headline/HeadlineOld.vue +42 -42
  68. package/components/common/pages/home/lib/models/interfaces.ts +48 -48
  69. package/components/common/pages/home/widgets/Widgets.vue +49 -49
  70. package/components/common/pages/home/widgets/WidgetsNew.vue +86 -86
  71. package/components/common/pages/home/widgets/WidgetsOld.vue +34 -34
  72. package/components/common/pages/home/widgets/hosts/Hosts.vue +27 -27
  73. package/components/common/pages/home/widgets/hosts/lib/config/items.ts +23 -23
  74. package/components/common/pages/home/widgets/vms/Vms.vue +26 -26
  75. package/components/common/pages/home/widgets/vms/VmsOld.vue +35 -35
  76. package/components/common/pages/home/widgets/vms/lib/config/items.ts +19 -19
  77. package/components/common/pages/packages/Packages.vue +208 -208
  78. package/components/common/pages/shortcuts/block/BlockNew.vue +96 -96
  79. package/components/common/pages/shortcuts/block/BlockOld.vue +68 -68
  80. package/components/common/portlets/customAttributes/Portlet.vue +667 -667
  81. package/components/common/portlets/tag/Portlet.vue +433 -433
  82. package/components/common/recursionTree/RecursionTree.vue +223 -223
  83. package/components/common/select/button/ButtonDropdown.vue +108 -108
  84. package/components/common/spiceConsole/Drawer.vue +370 -370
  85. package/components/common/spiceConsole/lib/models/interfaces.ts +5 -5
  86. package/components/common/split/horizontal/HorizontalNew.vue +376 -376
  87. package/components/common/split/horizontal/HorizontalOld.vue +337 -337
  88. package/components/common/split/vertical/Vertical.vue +160 -160
  89. package/components/common/tools/Actions.vue +188 -188
  90. package/components/common/vm/actions/add/Add.vue +773 -761
  91. package/components/common/vm/actions/add/lib/config/steps.ts +247 -216
  92. package/components/common/vm/actions/clone/Clone.vue +635 -629
  93. package/components/common/vm/actions/clone/lib/config/steps.ts +178 -129
  94. package/components/common/vm/actions/clone/lib/models/interfaces.ts +1 -10
  95. package/components/common/vm/actions/clone/toTemplate/ToTemplate.vue +634 -634
  96. package/components/common/vm/actions/clone/toTemplate/lib/config/steps.ts +116 -116
  97. package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +275 -275
  98. package/components/common/vm/actions/common/customizeHardware/CustomizeHardwareNew.vue +274 -274
  99. package/components/common/vm/actions/common/customizeHardware/CustomizeHardwareOld.vue +177 -177
  100. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue +698 -698
  101. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardwareNew.vue +410 -410
  102. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardwareOld.vue +319 -319
  103. package/components/common/vm/actions/common/customizeHardware/virtualHardware/browseView/BrowseView.vue +219 -219
  104. package/components/common/vm/actions/common/customizeHardware/virtualHardware/bus/Bus.vue +99 -99
  105. package/components/common/vm/actions/common/customizeHardware/virtualHardware/bus/BusNew.vue +117 -117
  106. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDrive.vue +232 -232
  107. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDriveNew.vue +164 -164
  108. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDriveOld.vue +168 -168
  109. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/Media.vue +25 -25
  110. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/MediaNew.vue +70 -70
  111. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/MediaOld.vue +50 -50
  112. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Cpu.vue +338 -338
  113. package/components/common/vm/actions/common/customizeHardware/virtualHardware/limit/Limit.vue +220 -220
  114. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +368 -368
  115. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDiskNew.vue +232 -232
  116. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDiskOld.vue +250 -250
  117. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/mode/ModeOld.vue +56 -56
  118. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/sharing/SharingNew.vue +44 -44
  119. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +286 -286
  120. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetworkNew.vue +124 -124
  121. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/LocationOld.vue +134 -134
  122. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/new/New.vue +63 -63
  123. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/new/table/lib/config/config.ts +95 -95
  124. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddress.vue +119 -119
  125. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddressNew.vue +69 -69
  126. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddressOld.vue +83 -83
  127. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDevice.vue +205 -205
  128. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/DirectPathIoNew.vue +66 -66
  129. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/DirectPathIoOld.vue +62 -62
  130. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/DynamicDirectPathIo.vue +31 -31
  131. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/DynamicDirectPathIoNew.vue +84 -84
  132. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/DynamicDirectPathIoOld.vue +76 -76
  133. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/Note.vue +15 -15
  134. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/NoteNew.vue +42 -42
  135. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/NoteOld.vue +30 -30
  136. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/nvidiaGrid/NvidiaGrid.vue +41 -41
  137. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/nvidiaGrid/NvidiaGridNew.vue +81 -81
  138. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/nvidiaGrid/NvidiaGridOld.vue +84 -84
  139. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbControllerNew.vue +56 -56
  140. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/Other.vue +16 -16
  141. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/OtherNew.vue +30 -30
  142. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCardNew.vue +104 -104
  143. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCardOld.vue +112 -112
  144. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/totalVideoMemory/TotalVideoMemoryNew.vue +54 -54
  145. package/components/common/vm/actions/common/customizeHardware/vmoptions/Vmoptions.vue +145 -145
  146. package/components/common/vm/actions/common/customizeHardware/vmoptions/VmoptionsNew.vue +102 -102
  147. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptionsNew.vue +75 -75
  148. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/delay/Delay.vue +26 -26
  149. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/Firmware.vue +57 -57
  150. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/FirmwareNew.vue +42 -42
  151. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/menu/MenuNew.vue +25 -25
  152. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +171 -171
  153. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/OrderNew.vue +50 -50
  154. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptionsNew.vue +141 -141
  155. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/New.vue +140 -140
  156. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/copyPaste/CopyPasteNew.vue +30 -30
  157. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/fileTransfer/FileTransferNew.vue +30 -30
  158. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/folderSharing/FolderSharingNew.vue +30 -30
  159. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +32 -32
  160. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/KeymapNew.vue +39 -39
  161. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/Password.vue +103 -103
  162. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/PasswordNew.vue +102 -102
  163. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/PasswordOld.vue +94 -94
  164. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirection.vue +28 -28
  165. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirectionNew.vue +38 -38
  166. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirectionOld.vue +44 -44
  167. package/components/common/vm/actions/common/select/createType/CreateType.vue +74 -74
  168. package/components/common/vm/actions/common/select/storage/Storage.vue +130 -130
  169. package/components/common/vm/actions/common/select/storage/StorageOld.vue +129 -129
  170. package/components/common/vm/actions/common/select/template/Template.vue +62 -62
  171. package/components/common/vm/actions/common/select/template/TemplateTreeView.vue +88 -88
  172. package/components/common/vm/actions/editSettings/new/Skeleton.vue +88 -88
  173. package/components/common/wizards/datastore/add/lib/config/steps.ts +138 -138
  174. package/components/common/wizards/datastore/add/nfs/accessibility/Accessibility.vue +60 -60
  175. package/components/common/wizards/datastore/add/readyComplete/ReadyComplete.vue +92 -92
  176. package/components/common/wizards/network/add/steps/SelectConnectionType.vue +105 -105
  177. package/components/common/wizards/vm/migrate/lib/config/constructDataReady.ts +220 -220
  178. package/components/common/wizards/vm/migrate/select/network/Network.vue +103 -103
  179. package/components/common/wizards/vm/migrate/select/network/table/network/Network.vue +150 -150
  180. package/components/common/wizards/vm/migrate/select/network/table/network/lib/config/advancedTable.ts +91 -91
  181. package/components/common/wizards/vm/migrate/select/priority/Priority.vue +43 -43
  182. package/composables/productNameLocal.ts +30 -30
  183. package/composables/useAppVersion.ts +21 -21
  184. package/package.json +1 -1
  185. package/plugins/date.ts +233 -233
  186. package/plugins/directives.ts +24 -24
  187. package/public/spice-console/lib/images/bitmap.js +203 -203
  188. package/public/spice-console/network/spicechannel.js +383 -383
  189. package/store/main/mutations.ts +7 -7
  190. package/store/main/state.ts +7 -7
  191. package/store/tasks/mappers/recentTasks.ts +64 -64
@@ -1,761 +1,773 @@
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 === dynamicSteps.creationType"
18
- v-model="selectedCreateType"
19
- :import-from-v-m-warev-sphere="props.importFromVMWarevSphere"
20
- />
21
- <common-vm-actions-common-select-template
22
- v-show="selectedStep.id === dynamicSteps.selectTemplate"
23
- :template-submit="templateSubmit"
24
- @submit="onChangeTemplate"
25
- />
26
- <common-vm-actions-common-select-name
27
- v-show="
28
- selectedStep.id === dynamicSteps.selectName ||
29
- selectedStep.id === dynamicSteps.selectNameFolder
30
- "
31
- :show="
32
- selectedStep.id === dynamicSteps.selectName ||
33
- selectedStep.id === dynamicSteps.selectNameFolder
34
- "
35
- :name-form-submit="nameFormSubmit"
36
- :project="props.project"
37
- :data-center="props.dataCenter"
38
- @submit="onChangeName(...$event)"
39
- @check-name="emits('check-name', $event)"
40
- />
41
- <common-vm-actions-common-select-compute-resource
42
- v-if="isSphere"
43
- v-show="selectedStep.id === dynamicSteps.selectComputeResource"
44
- v-model="vmForm.computeResource"
45
- :compute-resource-submit="computeResourceSubmit"
46
- :data-center="vmForm.dataCenter"
47
- :compute-resource="props.computeResource"
48
- :compute-resource-tree="props.computeResourceTree"
49
- @submit="onChangeComputeResource"
50
- @select-compute-resource-tree="onSelectComputeResourceTree"
51
- @get-compute-resource-tree="
52
- emits('get-compute-resource-tree', $event)
53
- "
54
- @show-compute-resource-tree="
55
- emits('show-compute-resource-tree', $event)
56
- "
57
- @clear-compute-resource-tree="
58
- emits('clear-compute-resource-tree', $event)
59
- "
60
- />
61
- <common-vm-actions-common-select-storage
62
- v-show="selectedStep.id === dynamicSteps.selectStorage"
63
- :storage-submit="storageSubmit"
64
- :datastore="props.datastore"
65
- :get-datastore-table-func="props.getDatastoreTableFunc"
66
- @submit="onChangeStorage"
67
- />
68
- <common-vm-actions-common-select-options
69
- v-show="selectedStep.id === dynamicSteps.selectOptions"
70
- @change="onChangeSelectOptions"
71
- />
72
- <common-vm-actions-common-select-compatibility
73
- v-show="selectedStep.id === dynamicSteps.compatibility"
74
- :options="compatibility"
75
- :error-validation-fields="props.errorValidationFields"
76
- @change="onChangeCompatibility"
77
- @remove-error-by-title="emits('remove-error-by-title', $event)"
78
- />
79
- <common-vm-actions-common-select-os
80
- v-show="
81
- selectedStep.id === dynamicSteps.selectGuestOSMachineType ||
82
- selectedStep.id === dynamicSteps.selectGuestOS
83
- "
84
- :families-options="guestOsFamilies"
85
- :versions-options="guestOsVersions"
86
- :machine-types-options="machineTypes"
87
- :error-validation-fields="props.errorValidationFields"
88
- @change="onChangeOs"
89
- @remove-error-by-title="emits('remove-error-by-title', $event)"
90
- />
91
- <common-vm-actions-common-customize-hardware
92
- v-show="selectedStep.id === dynamicSteps.customizeHardware"
93
- :project="props.project"
94
- :vm-name="vmForm.name"
95
- :guest-machine-type="vmForm.guestMachineType"
96
- :guest-os-family="vmForm.guestOsFamily"
97
- :guest-os-version="vmForm.guestOsVersion"
98
- :storage="vmForm.storage"
99
- :hard-disks-for-boot-options="virtualHardwareHardDisksLocal"
100
- :cd-dvd-drives-for-boot-options="virtualHardwareCdDvdDrivesLocal"
101
- :networks-for-boot-options="virtualHardwareNetworksLocal"
102
- :cd-dvd-drives="virtualHardwareCdDvdDrivesLocal"
103
- :customize-hardware-submit="customizeHardwareSubmit"
104
- :max-cpus="maxCpus"
105
- :max-memory="maxMemory"
106
- :cpu-models="cpuModels"
107
- :selected-nav-item="selectedNavItem"
108
- :nodes="props.nodes"
109
- :files="props.files"
110
- :networks-table="props.networksTable"
111
- :error-validation-fields="props.errorValidationFields"
112
- :get-datastore-table-func="props.getDatastoreTableFunc"
113
- :datastore="props.datastore"
114
- :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
115
- :passthrough-devices="props.passthroughDevices"
116
- :mediated-devices="props.mediatedDevices"
117
- :compute-resource="vmForm.computeResource"
118
- @change-boot-order="onChangeBootOrder"
119
- @send-data="onChangeCustomizeHardware"
120
- @get-storage="emits('get-storage', $event)"
121
- @get-folders-or-files="emits('get-folders-or-files', $event)"
122
- @get-active-device-child="emits('get-active-device-child', $event)"
123
- @show-datastore-child="emits('show-datastore-child', $event)"
124
- @remove-error-by-title="emits('remove-error-by-title', $event)"
125
- @get-networks-table="emits('get-networks-table', $event)"
126
- @get-pci-devices="emits('get-pci-devices')"
127
- />
128
- <common-ready-to-complete
129
- v-if="selectedStep.id === dynamicSteps.readyComplete"
130
- :data="props.readyCompleteTableInfo"
131
- />
132
- <span
133
- v-if="selectedStep.id > dynamicSteps.compatibility"
134
- class="vm-hardware-version"
135
- >{{ compatibilityInfo }}</span
136
- >
137
- </div>
138
- </template>
139
-
140
- <template #modalFooterContent>
141
- <div v-if="isShowPowerOn" class="power-on-by-default-wrap">
142
- <input
143
- id="power-on-by-default"
144
- v-model="isPowerOnByDefault"
145
- data-id="power-on-by-default"
146
- type="checkbox"
147
- />
148
- <label for="power-on-by-default" class="label-text-normal">{{
149
- localization.common.powerOnByDefault
150
- }}</label>
151
- </div>
152
- </template>
153
- </atoms-wizard>
154
- </div>
155
- </template>
156
-
157
- <script setup lang="ts">
158
- import type {
159
- UI_I_Localization,
160
- UI_I_ArbitraryObject,
161
- } from '~/lib/models/interfaces'
162
- import type { UI_T_Project } from '~/lib/models/types'
163
- import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
164
- import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
165
- import type {
166
- UI_I_DatastoreTableItem,
167
- UI_I_FolderOrFileTreePayload,
168
- } from '~/lib/models/store/storage/interfaces'
169
- import type {
170
- API_UI_I_Error,
171
- UI_I_ErrorValidationField,
172
- } from '~/lib/models/store/interfaces'
173
- import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
174
- import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
175
- import type {
176
- UI_T_AddVmFinishFunc,
177
- UI_T_SelectedNavItem,
178
- } from '~/components/common/vm/actions/common/lib/models/types'
179
- import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
180
- import type {
181
- UI_I_ValidationReturn,
182
- UI_I_WizardStep,
183
- } from '~/components/atoms/wizard/lib/models/interfaces'
184
- import type {
185
- UI_I_Capabilities,
186
- UI_I_VmForm,
187
- UI_I_VmFormCash,
188
- } from '~/components/common/vm/actions/common/lib/models/interfaces'
189
- import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
190
- import type { UI_I_OsChange } from '~/components/common/vm/actions/common/select/lib/models/interfaces'
191
- import type {
192
- UI_I_SendDataCpu,
193
- UI_I_SendDataMemory,
194
- UI_I_SendDataNewCdDvdDrive,
195
- UI_I_SendDataNewHardDisk,
196
- UI_I_SendDataNewNetwork,
197
- } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
198
- import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
199
- import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/models/types'
200
- import type {
201
- UI_I_MediatedDevice,
202
- UI_I_PciDevice,
203
- } from '~/lib/models/store/vm/interfaces'
204
- import { capabilities } from '~/components/common/vm/actions/common/lib/config/capabilities'
205
- import {
206
- stepsSchemeInitial,
207
- stepsFunc,
208
- dynamicSteps,
209
- } from '~/components/common/vm/actions/add/lib/config/steps'
210
- import Wizard from '~/components/atoms/wizard/lib/utils/utils'
211
- import { mapCapabilities } from '~/components/common/vm/actions/common/lib/utils/capabilities'
212
-
213
- const props = defineProps<{
214
- project: UI_T_Project
215
- nodes: UI_I_FileTreeNode[]
216
- files: UI_I_FileTreeNode[]
217
- networksTable: UI_I_NetworkTableItem[]
218
- datastore: UI_I_DatastoreTableItem[]
219
- errorValidationFields: UI_I_ErrorValidationField[]
220
- readyCompleteTableInfo: UI_I_TableInfoItem[]
221
- vmCpuHelpTextSecond: string
222
- importFromVMWarevSphere: string
223
- finishFunc: UI_T_AddVmFinishFunc
224
- getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
225
- validateSendDataFunc: UI_T_AddVmFinishFunc<
226
- [UI_T_SelectedNavItem, null | number] | null
227
- >
228
- passthroughDevices: UI_I_PciDevice[]
229
- mediatedDevices: UI_I_MediatedDevice[]
230
- vmNameInWizard: string
231
- capabilities?: UI_I_Capabilities
232
- dataCenter?: UI_I_TreeNode // для сферы
233
- computeResource?: UI_I_TreeNode // для сферы
234
- computeResourceTree?: UI_I_TreeNode[] // для сферы
235
- }>()
236
-
237
- const emits = defineEmits<{
238
- (event: 'check-name', value: [string, (error: API_UI_I_Error) => void]): void
239
- (event: 'get-storage', value: UI_I_TablePayload): void
240
- (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
241
- (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
242
- (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
243
- (event: 'remove-error-by-title', value: string): void
244
- (event: 'get-networks-table', value: UI_I_TablePayload): void
245
- (event: 'get-pci-devices'): void
246
- (event: 'get-pci-devices'): void
247
- (event: 'hide'): void
248
- (
249
- event: 'get-compute-resource-tree',
250
- value: { id: string | number; cb: () => void }
251
- ): void // для сферы
252
- (event: 'show-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
253
- (event: 'select-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
254
- (event: 'clear-compute-resource-tree'): void // для сферы
255
- }>()
256
-
257
- const { $recursion } = useNuxtApp()
258
-
259
- const localization = computed<UI_I_Localization>(() => useLocal())
260
-
261
- const isSphere = computed<boolean>(() => props.project === 'sphere')
262
-
263
- watch(
264
- () => props.capabilities,
265
- () => {
266
- if (props.capabilities) mapCapabilities(props.capabilities)
267
- },
268
- { deep: true, immediate: true }
269
- )
270
-
271
- const selectedCreateType = ref<string>('0')
272
-
273
- const wizard: Wizard = new Wizard(
274
- stepsFunc(localization.value),
275
- stepsSchemeInitial
276
- )
277
- watch(
278
- selectedCreateType,
279
- (newValue) => {
280
- switch (newValue) {
281
- case '0':
282
- wizard.changeScheme(isSphere.value ? 1 : 0)
283
- break
284
- case '1':
285
- wizard.changeScheme(2)
286
- }
287
- },
288
- { immediate: true }
289
- )
290
- // if (isSphere.value) wizard.changeScheme(1)
291
- const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
292
- // const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
293
-
294
- const isShowPowerOn = computed<boolean>(
295
- () => wizard.selectedStepId > dynamicSteps.customizeHardware
296
- )
297
-
298
- const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
299
- wizard.changeSteps(value, validationFunc, validateSendData)
300
- }
301
- const validationFunc = async (
302
- value: UI_I_WizardStep[],
303
- currentStep: UI_I_WizardStep,
304
- nextStep: UI_I_WizardStep
305
- ): Promise<UI_I_ValidationReturn> => {
306
- let stepHasError = false
307
- let stepShouldStop = {
308
- ifOnCurrentStep: false,
309
- ifFromAnyStep: false,
310
- stoppageStepId: -1,
311
- }
312
-
313
- wizard.setLoader(true)
314
- if (
315
- wizard.isValidateForStep(
316
- dynamicSteps.selectTemplate,
317
- currentStep.id,
318
- nextStep.id
319
- )
320
- ) {
321
- const templateValidation = await checkTemplate(value)
322
-
323
- value = templateValidation.newValue
324
- stepHasError = stepHasError || templateValidation.stepHasError
325
- } else if (
326
- wizard.isValidateForStep(
327
- isSphere.value ? dynamicSteps.selectNameFolder : dynamicSteps.selectName,
328
- currentStep.id,
329
- nextStep.id
330
- )
331
- ) {
332
- const nameValidation = await checkName(value)
333
-
334
- value = nameValidation.newValue
335
- stepHasError = stepHasError || nameValidation.stepHasError
336
- } else if (
337
- isSphere.value &&
338
- wizard.isValidateForStep(
339
- dynamicSteps.selectComputeResource,
340
- currentStep.id,
341
- nextStep.id
342
- )
343
- ) {
344
- const computeResourceValidation = await checkComputeResource(value)
345
-
346
- value = computeResourceValidation.newValue
347
- stepHasError = stepHasError || computeResourceValidation.stepHasError
348
- } else if (
349
- wizard.isValidateForStep(
350
- dynamicSteps.selectStorage,
351
- currentStep.id,
352
- nextStep.id
353
- )
354
- ) {
355
- const storageValidation = await checkStorage(value)
356
-
357
- value = storageValidation.newValue
358
-
359
- stepHasError = stepHasError || storageValidation.stepHasError
360
- } else if (
361
- wizard.isValidateForStep(
362
- dynamicSteps.customizeHardware,
363
- currentStep.id,
364
- nextStep.id
365
- )
366
- ) {
367
- const storageValidation = await checkCustomizeHardware(value)
368
-
369
- value = storageValidation.newValue
370
-
371
- stepHasError = stepHasError || storageValidation.stepHasError
372
- }
373
- wizard.setLoader(false)
374
-
375
- return {
376
- newValue: value,
377
- stepHasError,
378
- stepShouldStop,
379
- }
380
- }
381
-
382
- const checkTemplate = async (
383
- value: UI_I_WizardStep[]
384
- ): Promise<UI_I_ValidationReturn> => {
385
- let stepHasError = false
386
-
387
- return new Promise((resolve) => {
388
- templateSubmit.value = (isValid: boolean) => {
389
- if (!isValid) {
390
- stepHasError = wizard.setValidation(
391
- dynamicSteps.selectTemplate,
392
- 'template',
393
- {
394
- fieldMessage: 'aaa',
395
- alertMessage: 'aaa',
396
- }
397
- )
398
- } else if (wizard.hasMessage(dynamicSteps.selectTemplate, 'template')) {
399
- value = wizard.removeValidation(
400
- dynamicSteps.selectTemplate,
401
- 'template',
402
- value
403
- )
404
- }
405
-
406
- resolve({
407
- stepHasError,
408
- newValue: value,
409
- })
410
- templateSubmit.value = null
411
- }
412
- })
413
- }
414
- const checkName = async (
415
- value: UI_I_WizardStep[]
416
- ): Promise<UI_I_ValidationReturn> => {
417
- let stepHasError = false
418
-
419
- return new Promise((resolve) => {
420
- const step = isSphere.value
421
- ? dynamicSteps.selectNameFolder
422
- : dynamicSteps.selectName
423
- nameFormSubmit.value = (isValid: boolean) => {
424
- if (!isValid) {
425
- stepHasError = wizard.setValidation(step, 'name', {
426
- fieldMessage: 'aaa',
427
- alertMessage: 'aaa',
428
- })
429
- } else if (wizard.hasMessage(step, 'name')) {
430
- value = wizard.removeValidation(step, 'name', value)
431
- }
432
-
433
- resolve({
434
- stepHasError,
435
- newValue: value,
436
- })
437
- nameFormSubmit.value = null
438
- }
439
- })
440
- }
441
- const checkComputeResource = async (
442
- value: UI_I_WizardStep[]
443
- ): Promise<UI_I_ValidationReturn> => {
444
- let stepHasError = false
445
-
446
- return new Promise((resolve) => {
447
- computeResourceSubmit.value = (isValid: boolean) => {
448
- if (!isValid) {
449
- stepHasError = wizard.setValidation(
450
- dynamicSteps.selectComputeResource,
451
- 'computeResource',
452
- {
453
- fieldMessage: 'aaa',
454
- alertMessage: 'aaa',
455
- }
456
- )
457
- } else if (
458
- wizard.hasMessage(dynamicSteps.selectComputeResource, 'computeResource')
459
- ) {
460
- value = wizard.removeValidation(
461
- dynamicSteps.selectComputeResource,
462
- 'computeResource',
463
- value
464
- )
465
- }
466
-
467
- resolve({
468
- stepHasError,
469
- newValue: value,
470
- })
471
- computeResourceSubmit.value = null
472
- }
473
- })
474
- }
475
- const checkStorage = async (
476
- value: UI_I_WizardStep[]
477
- ): Promise<UI_I_ValidationReturn> => {
478
- let stepHasError = false
479
-
480
- return new Promise((resolve) => {
481
- storageSubmit.value = (isValid: boolean) => {
482
- if (!isValid) {
483
- stepHasError = wizard.setValidation(
484
- dynamicSteps.selectStorage,
485
- 'storage',
486
- {
487
- fieldMessage: 'aaa',
488
- alertMessage: 'aaa',
489
- }
490
- )
491
- } else if (wizard.hasMessage(dynamicSteps.selectStorage, 'storage')) {
492
- value = wizard.removeValidation(
493
- dynamicSteps.selectStorage,
494
- 'storage',
495
- value
496
- )
497
- }
498
-
499
- resolve({
500
- stepHasError,
501
- newValue: value,
502
- })
503
- storageSubmit.value = null
504
- }
505
- })
506
- }
507
- const checkCustomizeHardware = async (
508
- value: UI_I_WizardStep[]
509
- ): Promise<UI_I_ValidationReturn> => {
510
- let stepHasError = false
511
-
512
- return new Promise((resolve) => {
513
- customizeHardwareSubmit.value = (isValid: boolean) => {
514
- if (!isValid) {
515
- stepHasError = wizard.setValidation(
516
- dynamicSteps.customizeHardware,
517
- 'customizeHardware',
518
- {
519
- fieldMessage: 'aaa',
520
- alertMessage: 'aaa',
521
- }
522
- )
523
- } else if (
524
- wizard.hasMessage(dynamicSteps.customizeHardware, 'customizeHardware')
525
- ) {
526
- value = wizard.removeValidation(
527
- dynamicSteps.customizeHardware,
528
- 'customizeHardware',
529
- value
530
- )
531
- }
532
-
533
- resolve({
534
- stepHasError,
535
- newValue: value,
536
- })
537
- storageSubmit.value = null
538
- }
539
- })
540
- }
541
-
542
- const storageIdCash = ref<string | null>(null)
543
- const vmForm = ref<UI_I_VmForm>({
544
- name: '',
545
- compatibility: '',
546
- guestMachineType: null,
547
- guestOsFamily: null,
548
- guestOsVersion: null,
549
- computeResource: null,
550
- storage: null,
551
- locationPath: '',
552
- dataCenter: null,
553
- })
554
- const vmFormCash = ref<UI_I_VmFormCash>({
555
- dataCenterId: null,
556
- computeResourceTypeAndId: null,
557
- })
558
-
559
- const onChangeName = (name: string, node: UI_I_TreeNode): void => {
560
- vmForm.value.name = name
561
- if (isSphere.value) {
562
- vmForm.value.locationPath = node.id
563
- vmForm.value.dataCenter = $recursion.findParentByValue(
564
- node,
565
- 'datacenter',
566
- 'type',
567
- 'parent'
568
- )
569
- vmFormCash.value.dataCenterId = vmForm.value.dataCenter?.id || null
570
- }
571
- }
572
- // // Для сферы
573
- const computeResourcePath = ref<string>('')
574
- const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
575
- emits('select-compute-resource-tree', node)
576
- computeResourcePath.value = node.id
577
- }
578
- const onChangeComputeResource = (node: UI_I_TreeNode): void => {
579
- vmForm.value.computeResource = node
580
- // const type = node.type.toUpperCase()
581
- // schedRequirementsTemplate.value = `sched_requirements="(${type}_ID=${node.id})"\\`
582
- vmFormCash.value.computeResourceTypeAndId = `${node.type}${node.id}` || null
583
- }
584
- const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
585
- if (!storage) return
586
-
587
- vmForm.value.storage = storage
588
- storageIdCash.value = storage.id
589
- }
590
- const compatibilityInfo = ref<string>('')
591
- const onChangeCompatibility = (compatibility: UI_I_OptionItem): void => {
592
- vmForm.value.compatibility = compatibility.value
593
-
594
- const version = compatibility.value.split('-')[1]
595
- compatibilityInfo.value = `${localization.value.common.compatibility}: ${compatibility.text} (${localization.value.common.vmVersion} ${version})`
596
- }
597
- const onChangeOs = (data: UI_I_OsChange): void => {
598
- vmForm.value.guestMachineType = data.selectedMachineType
599
- vmForm.value.guestOsFamily = data.selectedOS
600
- vmForm.value.guestOsVersion = data.selectedVersion
601
- }
602
- const customizeHardware = ref<UI_I_SendDataCustomizeHardware | null>(null)
603
- const onChangeCustomizeHardware = (
604
- data: UI_I_SendDataCustomizeHardware
605
- ): void => {
606
- customizeHardware.value = data
607
- }
608
-
609
- const virtualHardwareHardDisksLocal = computed<
610
- UI_I_SendDataNewHardDisk[] | null
611
- >(() => customizeHardware.value?.virtualHardware?.hardDisks || null)
612
- const virtualHardwareNetworksLocal = computed<UI_I_SendDataNewNetwork[] | null>(
613
- () => customizeHardware.value?.virtualHardware?.networks || null
614
- )
615
- const virtualHardwareCdDvdDrivesLocal = computed<
616
- UI_I_SendDataNewCdDvdDrive[] | null
617
- >(() => customizeHardware.value?.virtualHardware?.cdDvdDrives || null)
618
-
619
- const virtualHardwareCpu = computed<UI_I_SendDataCpu | null>(
620
- () => customizeHardware.value?.virtualHardware?.cpu || null
621
- )
622
- const virtualHardwareMemory = computed<UI_I_SendDataMemory | null>(
623
- () => customizeHardware.value?.virtualHardware?.memory || null
624
- )
625
- const virtualHardwareHardDisks = ref<UI_I_SendDataNewHardDisk[] | null>(null)
626
- const virtualHardwareCdDvdDrives = ref<UI_I_SendDataNewCdDvdDrive[] | null>(
627
- null
628
- )
629
- const virtualHardwareNetworks = ref<UI_I_SendDataNewNetwork[] | null>(null)
630
- const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
631
- virtualHardwareHardDisks.value = data[0]
632
- virtualHardwareCdDvdDrives.value = data[1]
633
- virtualHardwareNetworks.value = data[2]
634
- }
635
-
636
- const isPowerOnByDefault = ref<boolean>(true)
637
-
638
- watch(
639
- () => props.vmNameInWizard,
640
- (newValue) => {
641
- vmForm.value.name = newValue
642
- }
643
- )
644
-
645
- const validateSendData = async (
646
- value: UI_I_WizardStep[]
647
- ): Promise<UI_I_ValidationReturn> => {
648
- wizard.setLoader(true)
649
- let stepHasError = false
650
-
651
- const data = await props.validateSendDataFunc(
652
- vmForm.value,
653
- virtualHardwareCpu.value,
654
- virtualHardwareMemory.value,
655
- customizeHardware.value,
656
- virtualHardwareNetworks.value,
657
- virtualHardwareHardDisks.value,
658
- virtualHardwareCdDvdDrives.value,
659
- isPowerOnByDefault.value,
660
- localization.value,
661
- vmForm.value.locationPath, // для сферы
662
- computeResourcePath.value // для сферы
663
- )
664
-
665
- wizard.setLoader(false)
666
- if (data) {
667
- stepHasError = true
668
- selectedNavItem.value = data[0]
669
- data[1] !== null && wizard.selectStepHard(data[1])
670
- }
671
-
672
- return {
673
- stepHasError,
674
- newValue: value,
675
- }
676
- }
677
- const onFinish = (): void => {
678
- wizard.setLoader(false)
679
- props
680
- .finishFunc(
681
- vmForm.value,
682
- virtualHardwareCpu.value,
683
- virtualHardwareMemory.value,
684
- customizeHardware.value,
685
- virtualHardwareNetworks.value,
686
- virtualHardwareHardDisks.value,
687
- virtualHardwareCdDvdDrives.value,
688
- isPowerOnByDefault.value,
689
- localization.value,
690
- vmForm.value.locationPath, // для сферы
691
- computeResourcePath.value, // для сферы
692
- false
693
- )
694
- .then(() => {
695
- onHideModal()
696
- wizard.setLoader(false)
697
- })
698
- }
699
-
700
- const selectedNavItem = ref<UI_T_SelectedNavItem>(0)
701
-
702
- const nameFormSubmit = ref<null | Function>(null)
703
- const templateSubmit = ref<null | Function>(null)
704
- const computeResourceSubmit = ref<null | Function>(null)
705
- const storageSubmit = ref<null | Function>(null)
706
- const customizeHardwareSubmit = ref<null | Function>(null)
707
- const compatibility = ref<UI_I_OptionItem[]>(
708
- capabilities.compatibility.filter((camp) => {
709
- let result = true
710
- // if (isDev && camp.value === 'pvm-2') result = false
711
- if (camp.value === 'pvm-2') result = false
712
- return result
713
- })
714
- )
715
- const guestOsFamilies = ref<UI_I_OptionItem[]>(capabilities.guestOsFamilies)
716
- const guestOsVersions = ref<UI_I_ArbitraryObject<UI_I_OptionItem[]>>(
717
- capabilities.guestOsVersions
718
- )
719
- const machineTypes = ref<UI_I_OptionItem[]>(capabilities.machineTypes)
720
- const cpuModels = ref<UI_I_OptionItem[]>(capabilities.cpuModels)
721
- const maxCpus = ref<number>(capabilities.maxCpus)
722
- const maxMemory = ref<number>(capabilities.maxMemory)
723
-
724
- const selectedTemplate = ref<string>('')
725
- const onChangeTemplate = (id: string): void => {
726
- selectedTemplate.value = id
727
- }
728
- const selectedOptions = ref<string[]>([])
729
- const onChangeSelectOptions = (options: string[]) => {
730
- selectedOptions.value = options
731
- }
732
-
733
- const onHideModal = (): void => {
734
- emits('hide')
735
- }
736
- </script>
737
-
738
- <style scoped lang="scss">
739
- :deep(.modal-body) {
740
- display: flex;
741
- flex-direction: column;
742
- }
743
- .add-vm-content {
744
- display: flex;
745
- flex-direction: column;
746
- flex: 1;
747
- }
748
- .vm-hardware-version {
749
- align-self: flex-end;
750
- margin-top: auto;
751
- }
752
- .power-on-by-default-wrap {
753
- display: flex;
754
- align-items: center;
755
- margin-right: auto;
756
-
757
- input {
758
- margin-right: 6px;
759
- }
760
- }
761
- </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 === dynamicSteps.creationType"
18
+ v-model="selectedCreateType"
19
+ :import-from-v-m-warev-sphere="props.importFromVMWarevSphere"
20
+ />
21
+ <common-vm-actions-common-select-template
22
+ v-show="selectedStep.id === dynamicSteps.selectTemplate"
23
+ :template-submit="templateSubmit"
24
+ @submit="onChangeTemplate"
25
+ />
26
+ <common-vm-actions-common-select-name
27
+ v-show="
28
+ selectedStep.id === dynamicSteps.selectName ||
29
+ selectedStep.id === dynamicSteps.selectNameFolder
30
+ "
31
+ :show="
32
+ selectedStep.id === dynamicSteps.selectName ||
33
+ selectedStep.id === dynamicSteps.selectNameFolder
34
+ "
35
+ :name-form-submit="nameFormSubmit"
36
+ :project="props.project"
37
+ :data-center="props.dataCenter"
38
+ @submit="onChangeName(...$event)"
39
+ @check-name="emits('check-name', $event)"
40
+ />
41
+ <common-vm-actions-common-select-compute-resource
42
+ v-if="isSphere"
43
+ v-show="selectedStep.id === dynamicSteps.selectComputeResource"
44
+ v-model="vmForm.computeResource"
45
+ :compute-resource-submit="computeResourceSubmit"
46
+ :data-center="vmForm.dataCenter"
47
+ :compute-resource="props.computeResource"
48
+ :compute-resource-tree="props.computeResourceTree"
49
+ @submit="onChangeComputeResource"
50
+ @select-compute-resource-tree="onSelectComputeResourceTree"
51
+ @get-compute-resource-tree="
52
+ emits('get-compute-resource-tree', $event)
53
+ "
54
+ @show-compute-resource-tree="
55
+ emits('show-compute-resource-tree', $event)
56
+ "
57
+ @clear-compute-resource-tree="
58
+ emits('clear-compute-resource-tree', $event)
59
+ "
60
+ />
61
+ <common-vm-actions-common-select-storage
62
+ v-show="selectedStep.id === dynamicSteps.selectStorage"
63
+ :storage-submit="storageSubmit"
64
+ :datastore="props.datastore"
65
+ :get-datastore-table-func="props.getDatastoreTableFunc"
66
+ @submit="onChangeStorage"
67
+ />
68
+ <common-vm-actions-common-select-options
69
+ v-show="selectedStep.id === dynamicSteps.selectOptions"
70
+ @change="onChangeSelectOptions"
71
+ />
72
+ <common-vm-actions-common-select-compatibility
73
+ v-show="selectedStep.id === dynamicSteps.compatibility"
74
+ :options="compatibility"
75
+ :error-validation-fields="props.errorValidationFields"
76
+ @change="onChangeCompatibility"
77
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
78
+ />
79
+ <common-vm-actions-common-select-os
80
+ v-show="
81
+ selectedStep.id === dynamicSteps.selectGuestOSMachineType ||
82
+ selectedStep.id === dynamicSteps.selectGuestOS
83
+ "
84
+ :families-options="guestOsFamilies"
85
+ :versions-options="guestOsVersions"
86
+ :machine-types-options="machineTypes"
87
+ :error-validation-fields="props.errorValidationFields"
88
+ @change="onChangeOs"
89
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
90
+ />
91
+ <common-vm-actions-common-customize-hardware
92
+ v-show="selectedStep.id === dynamicSteps.customizeHardware"
93
+ :project="props.project"
94
+ :vm-name="vmForm.name"
95
+ :guest-machine-type="vmForm.guestMachineType"
96
+ :guest-os-family="vmForm.guestOsFamily"
97
+ :guest-os-version="vmForm.guestOsVersion"
98
+ :storage="vmForm.storage"
99
+ :hard-disks-for-boot-options="virtualHardwareHardDisksLocal"
100
+ :cd-dvd-drives-for-boot-options="virtualHardwareCdDvdDrivesLocal"
101
+ :networks-for-boot-options="virtualHardwareNetworksLocal"
102
+ :cd-dvd-drives="virtualHardwareCdDvdDrivesLocal"
103
+ :customize-hardware-submit="customizeHardwareSubmit"
104
+ :max-cpus="maxCpus"
105
+ :max-memory="maxMemory"
106
+ :cpu-models="cpuModels"
107
+ :selected-nav-item="selectedNavItem"
108
+ :nodes="props.nodes"
109
+ :files="props.files"
110
+ :networks-table="props.networksTable"
111
+ :error-validation-fields="props.errorValidationFields"
112
+ :get-datastore-table-func="props.getDatastoreTableFunc"
113
+ :datastore="props.datastore"
114
+ :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
115
+ :passthrough-devices="props.passthroughDevices"
116
+ :mediated-devices="props.mediatedDevices"
117
+ :compute-resource="vmForm.computeResource"
118
+ @change-boot-order="onChangeBootOrder"
119
+ @send-data="onChangeCustomizeHardware"
120
+ @get-storage="emits('get-storage', $event)"
121
+ @get-folders-or-files="emits('get-folders-or-files', $event)"
122
+ @get-active-device-child="emits('get-active-device-child', $event)"
123
+ @show-datastore-child="emits('show-datastore-child', $event)"
124
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
125
+ @get-networks-table="emits('get-networks-table', $event)"
126
+ @get-pci-devices="emits('get-pci-devices')"
127
+ />
128
+ <common-ready-to-complete
129
+ v-if="selectedStep.id === dynamicSteps.readyComplete"
130
+ :data="props.readyCompleteTableInfo"
131
+ />
132
+ <span
133
+ v-if="selectedStep.id > dynamicSteps.compatibility"
134
+ class="vm-hardware-version"
135
+ >{{ compatibilityInfo }}</span
136
+ >
137
+ </div>
138
+ </template>
139
+
140
+ <template #modalFooterContent>
141
+ <div v-if="isShowPowerOn" class="power-on-by-default-wrap">
142
+ <input
143
+ id="power-on-by-default"
144
+ v-model="isPowerOnByDefault"
145
+ data-id="power-on-by-default"
146
+ type="checkbox"
147
+ />
148
+ <label for="power-on-by-default" class="label-text-normal">{{
149
+ localization.common.powerOnByDefault
150
+ }}</label>
151
+ </div>
152
+ </template>
153
+ </atoms-wizard>
154
+ </div>
155
+ </template>
156
+
157
+ <script setup lang="ts">
158
+ import type {
159
+ UI_I_Localization,
160
+ UI_I_ArbitraryObject,
161
+ } from '~/lib/models/interfaces'
162
+ import type { UI_T_Project } from '~/lib/models/types'
163
+ import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
164
+ import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
165
+ import type {
166
+ UI_I_DatastoreTableItem,
167
+ UI_I_FolderOrFileTreePayload,
168
+ } from '~/lib/models/store/storage/interfaces'
169
+ import type {
170
+ API_UI_I_Error,
171
+ UI_I_ErrorValidationField,
172
+ } from '~/lib/models/store/interfaces'
173
+ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
174
+ import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
175
+ import type {
176
+ UI_T_AddVmFinishFunc,
177
+ UI_T_SelectedNavItem,
178
+ } from '~/components/common/vm/actions/common/lib/models/types'
179
+ import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
180
+ import type {
181
+ UI_I_ValidationReturn,
182
+ UI_I_WizardStep,
183
+ } from '~/components/atoms/wizard/lib/models/interfaces'
184
+ import type {
185
+ UI_I_Capabilities,
186
+ UI_I_VmForm,
187
+ UI_I_VmFormCash,
188
+ } from '~/components/common/vm/actions/common/lib/models/interfaces'
189
+ import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
190
+ import type { UI_I_OsChange } from '~/components/common/vm/actions/common/select/lib/models/interfaces'
191
+ import type {
192
+ UI_I_SendDataCpu,
193
+ UI_I_SendDataMemory,
194
+ UI_I_SendDataNewCdDvdDrive,
195
+ UI_I_SendDataNewHardDisk,
196
+ UI_I_SendDataNewNetwork,
197
+ } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
198
+ import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
199
+ import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/models/types'
200
+ import type {
201
+ UI_I_MediatedDevice,
202
+ UI_I_PciDevice,
203
+ } from '~/lib/models/store/vm/interfaces'
204
+ import { capabilities } from '~/components/common/vm/actions/common/lib/config/capabilities'
205
+ import {
206
+ stepsSchemeInitial,
207
+ stepsFunc,
208
+ dynamicSteps,
209
+ } from '~/components/common/vm/actions/add/lib/config/steps'
210
+ import Wizard from '~/components/atoms/wizard/lib/utils/utils'
211
+ import { mapCapabilities } from '~/components/common/vm/actions/common/lib/utils/capabilities'
212
+
213
+ const props = defineProps<{
214
+ project: UI_T_Project
215
+ nodes: UI_I_FileTreeNode[]
216
+ files: UI_I_FileTreeNode[]
217
+ networksTable: UI_I_NetworkTableItem[]
218
+ datastore: UI_I_DatastoreTableItem[]
219
+ errorValidationFields: UI_I_ErrorValidationField[]
220
+ readyCompleteTableInfo: UI_I_TableInfoItem[]
221
+ vmCpuHelpTextSecond: string
222
+ importFromVMWarevSphere: string
223
+ finishFunc: UI_T_AddVmFinishFunc
224
+ getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
225
+ validateSendDataFunc: UI_T_AddVmFinishFunc<
226
+ [UI_T_SelectedNavItem, null | number] | null
227
+ >
228
+ passthroughDevices: UI_I_PciDevice[]
229
+ mediatedDevices: UI_I_MediatedDevice[]
230
+ vmNameInWizard: string
231
+ capabilities?: UI_I_Capabilities
232
+ dataCenter?: UI_I_TreeNode // для сферы
233
+ computeResource?: UI_I_TreeNode // для сферы
234
+ computeResourceTree?: UI_I_TreeNode[] // для сферы
235
+ }>()
236
+
237
+ const emits = defineEmits<{
238
+ (event: 'check-name', value: [string, (error: API_UI_I_Error) => void]): void
239
+ (event: 'get-storage', value: UI_I_TablePayload): void
240
+ (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
241
+ (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
242
+ (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
243
+ (event: 'remove-error-by-title', value: string): void
244
+ (event: 'get-networks-table', value: UI_I_TablePayload): void
245
+ (event: 'get-pci-devices'): void
246
+ (event: 'get-pci-devices'): void
247
+ (event: 'hide'): void
248
+ (
249
+ event: 'get-compute-resource-tree',
250
+ value: { id: string | number; cb: () => void }
251
+ ): void // для сферы
252
+ (event: 'show-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
253
+ (event: 'select-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
254
+ (event: 'clear-compute-resource-tree'): void // для сферы
255
+ }>()
256
+
257
+ const { $recursion } = useNuxtApp()
258
+
259
+ const localization = computed<UI_I_Localization>(() => useLocal())
260
+
261
+ const isSphere = computed<boolean>(() => props.project === 'sphere')
262
+
263
+ watch(
264
+ () => props.capabilities,
265
+ () => {
266
+ if (props.capabilities) mapCapabilities(props.capabilities)
267
+ },
268
+ { deep: true, immediate: true }
269
+ )
270
+
271
+ const selectedCreateType = ref<string>('0')
272
+
273
+ const wizard: Wizard = new Wizard(
274
+ stepsFunc(localization.value),
275
+ stepsSchemeInitial
276
+ )
277
+ watch(
278
+ selectedCreateType,
279
+ (newValue) => {
280
+ switch (newValue) {
281
+ case '0':
282
+ wizard.changeScheme(isSphere.value ? 1 : 0)
283
+ break
284
+ case '1':
285
+ wizard.changeScheme(2)
286
+ }
287
+ },
288
+ { immediate: true }
289
+ )
290
+ // if (isSphere.value) wizard.changeScheme(1)
291
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
292
+ // const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
293
+
294
+ const isShowPowerOn = computed<boolean>(
295
+ () => wizard.selectedStepId > dynamicSteps.customizeHardware
296
+ )
297
+
298
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
299
+ wizard.changeSteps(value, validationFunc, validateSendData)
300
+ }
301
+ const validationFunc = async (
302
+ value: UI_I_WizardStep[],
303
+ currentStep: UI_I_WizardStep,
304
+ nextStep: UI_I_WizardStep
305
+ ): Promise<UI_I_ValidationReturn> => {
306
+ let stepHasError = false
307
+ let stepShouldStop = {
308
+ ifOnCurrentStep: false,
309
+ ifFromAnyStep: false,
310
+ stoppageStepId: -1,
311
+ }
312
+
313
+ wizard.setLoader(true)
314
+ if (
315
+ wizard.isValidateForStep(
316
+ dynamicSteps.selectTemplate,
317
+ currentStep.id,
318
+ nextStep.id
319
+ )
320
+ ) {
321
+ const templateValidation = await checkTemplate(value)
322
+
323
+ value = templateValidation.newValue
324
+ stepHasError = stepHasError || templateValidation.stepHasError
325
+ } else if (
326
+ wizard.isValidateForStep(
327
+ isSphere.value ? dynamicSteps.selectNameFolder : dynamicSteps.selectName,
328
+ currentStep.id,
329
+ nextStep.id
330
+ )
331
+ ) {
332
+ const nameValidation = await checkName(value)
333
+
334
+ value = nameValidation.newValue
335
+ stepHasError = stepHasError || nameValidation.stepHasError
336
+ } else if (
337
+ isSphere.value &&
338
+ wizard.isValidateForStep(
339
+ dynamicSteps.selectComputeResource,
340
+ currentStep.id,
341
+ nextStep.id
342
+ )
343
+ ) {
344
+ const computeResourceValidation = await checkComputeResource(value)
345
+
346
+ value = computeResourceValidation.newValue
347
+ stepHasError = stepHasError || computeResourceValidation.stepHasError
348
+ } else if (
349
+ wizard.isValidateForStep(
350
+ dynamicSteps.selectStorage,
351
+ currentStep.id,
352
+ nextStep.id
353
+ )
354
+ ) {
355
+ const storageValidation = await checkStorage(value)
356
+
357
+ value = storageValidation.newValue
358
+
359
+ stepHasError = stepHasError || storageValidation.stepHasError
360
+ } else if (
361
+ wizard.isValidateForStep(
362
+ dynamicSteps.customizeHardware,
363
+ currentStep.id,
364
+ nextStep.id
365
+ )
366
+ ) {
367
+ const storageValidation = await checkCustomizeHardware(value)
368
+
369
+ value = storageValidation.newValue
370
+
371
+ stepHasError = stepHasError || storageValidation.stepHasError
372
+ }
373
+ wizard.setLoader(false)
374
+
375
+ return {
376
+ newValue: value,
377
+ stepHasError,
378
+ stepShouldStop,
379
+ }
380
+ }
381
+
382
+ const checkTemplate = async (
383
+ value: UI_I_WizardStep[]
384
+ ): Promise<UI_I_ValidationReturn> => {
385
+ let stepHasError = false
386
+
387
+ return new Promise((resolve) => {
388
+ templateSubmit.value = (isValid: boolean) => {
389
+ if (!isValid) {
390
+ stepHasError = wizard.setValidation(
391
+ dynamicSteps.selectTemplate,
392
+ 'template',
393
+ {
394
+ fieldMessage: 'aaa',
395
+ alertMessage: 'aaa',
396
+ }
397
+ )
398
+ } else if (wizard.hasMessage(dynamicSteps.selectTemplate, 'template')) {
399
+ value = wizard.removeValidation(
400
+ dynamicSteps.selectTemplate,
401
+ 'template',
402
+ value
403
+ )
404
+ }
405
+
406
+ resolve({
407
+ stepHasError,
408
+ newValue: value,
409
+ })
410
+ templateSubmit.value = null
411
+ }
412
+ })
413
+ }
414
+ const checkName = async (
415
+ value: UI_I_WizardStep[]
416
+ ): Promise<UI_I_ValidationReturn> => {
417
+ let stepHasError = false
418
+
419
+ return new Promise((resolve) => {
420
+ const step = isSphere.value
421
+ ? dynamicSteps.selectNameFolder
422
+ : dynamicSteps.selectName
423
+ nameFormSubmit.value = (isValid: boolean) => {
424
+ if (!isValid) {
425
+ stepHasError = wizard.setValidation(step, 'name', {
426
+ fieldMessage: 'aaa',
427
+ alertMessage: 'aaa',
428
+ })
429
+ } else if (wizard.hasMessage(step, 'name')) {
430
+ value = wizard.removeValidation(step, 'name', value)
431
+ }
432
+
433
+ resolve({
434
+ stepHasError,
435
+ newValue: value,
436
+ })
437
+ nameFormSubmit.value = null
438
+ }
439
+ })
440
+ }
441
+ const checkComputeResource = async (
442
+ value: UI_I_WizardStep[]
443
+ ): Promise<UI_I_ValidationReturn> => {
444
+ let stepHasError = false
445
+
446
+ return new Promise((resolve) => {
447
+ computeResourceSubmit.value = (isValid: boolean) => {
448
+ if (!isValid) {
449
+ stepHasError = wizard.setValidation(
450
+ dynamicSteps.selectComputeResource,
451
+ 'computeResource',
452
+ {
453
+ fieldMessage: 'aaa',
454
+ alertMessage: 'aaa',
455
+ }
456
+ )
457
+ } else if (
458
+ wizard.hasMessage(dynamicSteps.selectComputeResource, 'computeResource')
459
+ ) {
460
+ value = wizard.removeValidation(
461
+ dynamicSteps.selectComputeResource,
462
+ 'computeResource',
463
+ value
464
+ )
465
+ }
466
+
467
+ resolve({
468
+ stepHasError,
469
+ newValue: value,
470
+ })
471
+ computeResourceSubmit.value = null
472
+ }
473
+ })
474
+ }
475
+ const checkStorage = async (
476
+ value: UI_I_WizardStep[]
477
+ ): Promise<UI_I_ValidationReturn> => {
478
+ let stepHasError = false
479
+
480
+ return new Promise((resolve) => {
481
+ storageSubmit.value = (isValid: boolean) => {
482
+ if (!isValid) {
483
+ stepHasError = wizard.setValidation(
484
+ dynamicSteps.selectStorage,
485
+ 'storage',
486
+ {
487
+ fieldMessage: 'aaa',
488
+ alertMessage: 'aaa',
489
+ }
490
+ )
491
+ } else if (wizard.hasMessage(dynamicSteps.selectStorage, 'storage')) {
492
+ value = wizard.removeValidation(
493
+ dynamicSteps.selectStorage,
494
+ 'storage',
495
+ value
496
+ )
497
+ }
498
+
499
+ resolve({
500
+ stepHasError,
501
+ newValue: value,
502
+ })
503
+ storageSubmit.value = null
504
+ }
505
+ })
506
+ }
507
+ const checkCustomizeHardware = async (
508
+ value: UI_I_WizardStep[]
509
+ ): Promise<UI_I_ValidationReturn> => {
510
+ let stepHasError = false
511
+
512
+ return new Promise((resolve) => {
513
+ customizeHardwareSubmit.value = (isValid: boolean) => {
514
+ if (!isValid) {
515
+ stepHasError = wizard.setValidation(
516
+ dynamicSteps.customizeHardware,
517
+ 'customizeHardware',
518
+ {
519
+ fieldMessage: 'aaa',
520
+ alertMessage: 'aaa',
521
+ }
522
+ )
523
+ } else if (
524
+ wizard.hasMessage(dynamicSteps.customizeHardware, 'customizeHardware')
525
+ ) {
526
+ value = wizard.removeValidation(
527
+ dynamicSteps.customizeHardware,
528
+ 'customizeHardware',
529
+ value
530
+ )
531
+ }
532
+
533
+ resolve({
534
+ stepHasError,
535
+ newValue: value,
536
+ })
537
+ storageSubmit.value = null
538
+ }
539
+ })
540
+ }
541
+
542
+ const storageIdCash = ref<string | null>(null)
543
+ const vmForm = ref<UI_I_VmForm>({
544
+ name: '',
545
+ compatibility: '',
546
+ guestMachineType: null,
547
+ guestOsFamily: null,
548
+ guestOsVersion: null,
549
+ computeResource: null,
550
+ storage: null,
551
+ locationPath: '',
552
+ dataCenter: null,
553
+ })
554
+ const vmFormCash = ref<UI_I_VmFormCash>({
555
+ dataCenterId: null,
556
+ computeResourceTypeAndId: null,
557
+ })
558
+
559
+ const onChangeName = (name: string, node: UI_I_TreeNode): void => {
560
+ vmForm.value.name = name
561
+ if (isSphere.value) {
562
+ vmForm.value.locationPath = node.id
563
+ vmForm.value.dataCenter = $recursion.findParentByValue(
564
+ node,
565
+ 'datacenter',
566
+ 'type',
567
+ 'parent'
568
+ )
569
+ vmFormCash.value.dataCenterId = vmForm.value.dataCenter?.id || null
570
+ }
571
+ }
572
+ // // Для сферы
573
+ const computeResourcePath = ref<string>('')
574
+ const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
575
+ emits('select-compute-resource-tree', node)
576
+ computeResourcePath.value = node.id
577
+ }
578
+ const onChangeComputeResource = (node: UI_I_TreeNode): void => {
579
+ vmForm.value.computeResource = node
580
+ // const type = node.type.toUpperCase()
581
+ // schedRequirementsTemplate.value = `sched_requirements="(${type}_ID=${node.id})"\\`
582
+ vmFormCash.value.computeResourceTypeAndId = `${node.type}${node.id}` || null
583
+ }
584
+ const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
585
+ if (!storage) return
586
+
587
+ vmForm.value.storage = storage
588
+ storageIdCash.value = storage.id
589
+ }
590
+ const compatibilityInfo = ref<string>('')
591
+ const onChangeCompatibility = (compatibility: UI_I_OptionItem): void => {
592
+ vmForm.value.compatibility = compatibility.value
593
+
594
+ const version = compatibility.value.split('-')[1]
595
+ compatibilityInfo.value = `${localization.value.common.compatibility}: ${compatibility.text} (${localization.value.common.vmVersion} ${version})`
596
+ }
597
+ const onChangeOs = (data: UI_I_OsChange): void => {
598
+ vmForm.value.guestMachineType = data.selectedMachineType
599
+ vmForm.value.guestOsFamily = data.selectedOS
600
+ vmForm.value.guestOsVersion = data.selectedVersion
601
+ }
602
+ const customizeHardware = ref<UI_I_SendDataCustomizeHardware | null>(null)
603
+ const onChangeCustomizeHardware = (
604
+ data: UI_I_SendDataCustomizeHardware
605
+ ): void => {
606
+ customizeHardware.value = data
607
+ }
608
+
609
+ const virtualHardwareHardDisksLocal = computed<
610
+ UI_I_SendDataNewHardDisk[] | null
611
+ >(() => customizeHardware.value?.virtualHardware?.hardDisks || null)
612
+ const virtualHardwareNetworksLocal = computed<UI_I_SendDataNewNetwork[] | null>(
613
+ () => customizeHardware.value?.virtualHardware?.networks || null
614
+ )
615
+ const virtualHardwareCdDvdDrivesLocal = computed<
616
+ UI_I_SendDataNewCdDvdDrive[] | null
617
+ >(() => customizeHardware.value?.virtualHardware?.cdDvdDrives || null)
618
+
619
+ const virtualHardwareCpu = computed<UI_I_SendDataCpu | null>(
620
+ () => customizeHardware.value?.virtualHardware?.cpu || null
621
+ )
622
+ const virtualHardwareMemory = computed<UI_I_SendDataMemory | null>(
623
+ () => customizeHardware.value?.virtualHardware?.memory || null
624
+ )
625
+ const virtualHardwareHardDisks = ref<UI_I_SendDataNewHardDisk[] | null>(null)
626
+ const virtualHardwareCdDvdDrives = ref<UI_I_SendDataNewCdDvdDrive[] | null>(
627
+ null
628
+ )
629
+ const virtualHardwareNetworks = ref<UI_I_SendDataNewNetwork[] | null>(null)
630
+ const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
631
+ virtualHardwareHardDisks.value = data[0]
632
+ virtualHardwareCdDvdDrives.value = data[1]
633
+ virtualHardwareNetworks.value = data[2]
634
+ }
635
+
636
+ const isPowerOnByDefault = ref<boolean>(true)
637
+
638
+ watch(
639
+ () => props.vmNameInWizard,
640
+ (newValue) => {
641
+ vmForm.value.name = newValue
642
+ }
643
+ )
644
+
645
+ const validateSendData = async (
646
+ value: UI_I_WizardStep[]
647
+ ): Promise<UI_I_ValidationReturn> => {
648
+ wizard.setLoader(true)
649
+ let stepHasError = false
650
+
651
+ const data = await props.validateSendDataFunc(
652
+ vmForm.value,
653
+ virtualHardwareCpu.value,
654
+ virtualHardwareMemory.value,
655
+ customizeHardware.value,
656
+ virtualHardwareNetworks.value,
657
+ virtualHardwareHardDisks.value,
658
+ virtualHardwareCdDvdDrives.value,
659
+ isPowerOnByDefault.value,
660
+ localization.value,
661
+ vmForm.value.locationPath, // для сферы
662
+ computeResourcePath.value // для сферы
663
+ )
664
+
665
+ wizard.setLoader(false)
666
+ if (data) {
667
+ stepHasError = true
668
+ selectedNavItem.value = data[0]
669
+ data[1] !== null && wizard.selectStepHard(data[1])
670
+ }
671
+
672
+ return {
673
+ stepHasError,
674
+ newValue: value,
675
+ }
676
+ }
677
+ const onFinish = (): void => {
678
+ wizard.setLoader(false)
679
+ props
680
+ .finishFunc(
681
+ vmForm.value,
682
+ virtualHardwareCpu.value,
683
+ virtualHardwareMemory.value,
684
+ customizeHardware.value,
685
+ virtualHardwareNetworks.value,
686
+ virtualHardwareHardDisks.value,
687
+ virtualHardwareCdDvdDrives.value,
688
+ isPowerOnByDefault.value,
689
+ localization.value,
690
+ vmForm.value.locationPath, // для сферы
691
+ computeResourcePath.value, // для сферы
692
+ false
693
+ )
694
+ .then(() => {
695
+ onHideModal()
696
+ wizard.setLoader(false)
697
+ })
698
+ }
699
+
700
+ const selectedNavItem = ref<UI_T_SelectedNavItem>(0)
701
+
702
+ const nameFormSubmit = ref<null | Function>(null)
703
+ const templateSubmit = ref<null | Function>(null)
704
+ const computeResourceSubmit = ref<null | Function>(null)
705
+ const storageSubmit = ref<null | Function>(null)
706
+ const customizeHardwareSubmit = ref<null | Function>(null)
707
+ const compatibility = ref<UI_I_OptionItem[]>(
708
+ capabilities.compatibility.filter((camp) => {
709
+ let result = true
710
+ // if (isDev && camp.value === 'pvm-2') result = false
711
+ if (camp.value === 'pvm-2') result = false
712
+ return result
713
+ })
714
+ )
715
+ const guestOsFamilies = ref<UI_I_OptionItem[]>(capabilities.guestOsFamilies)
716
+ const guestOsVersions = ref<UI_I_ArbitraryObject<UI_I_OptionItem[]>>(
717
+ capabilities.guestOsVersions
718
+ )
719
+ const machineTypes = ref<UI_I_OptionItem[]>(capabilities.machineTypes)
720
+ const cpuModels = ref<UI_I_OptionItem[]>(capabilities.cpuModels)
721
+ const maxCpus = ref<number>(capabilities.maxCpus)
722
+ const maxMemory = ref<number>(capabilities.maxMemory)
723
+
724
+ const selectedTemplate = ref<string>('')
725
+ const onChangeTemplate = (id: string): void => {
726
+ selectedTemplate.value = id
727
+ }
728
+ const selectedOptions = ref<string[]>([])
729
+ const onChangeSelectOptions = (options: string[]) => {
730
+ selectedOptions.value = options
731
+ if (
732
+ options.includes('customize-os') &&
733
+ options.includes('customize-hardware')
734
+ ) {
735
+ wizard.changeScheme(5)
736
+ } else if (options.includes('customize-os')) {
737
+ wizard.changeScheme(3)
738
+ } else if (options.includes('customize-hardware')) {
739
+ wizard.changeScheme(4)
740
+ } else {
741
+ wizard.changeScheme(2)
742
+ }
743
+ }
744
+
745
+ const onHideModal = (): void => {
746
+ emits('hide')
747
+ }
748
+ </script>
749
+
750
+ <style scoped lang="scss">
751
+ :deep(.modal-body) {
752
+ display: flex;
753
+ flex-direction: column;
754
+ }
755
+ .add-vm-content {
756
+ display: flex;
757
+ flex-direction: column;
758
+ flex: 1;
759
+ }
760
+ .vm-hardware-version {
761
+ align-self: flex-end;
762
+ margin-top: auto;
763
+ }
764
+ .power-on-by-default-wrap {
765
+ display: flex;
766
+ align-items: center;
767
+ margin-right: auto;
768
+
769
+ input {
770
+ margin-right: 6px;
771
+ }
772
+ }
773
+ </style>