bfg-common 1.5.37 → 1.5.39

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 (192) 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 +770 -761
  91. package/components/common/vm/actions/add/lib/config/steps.ts +247 -216
  92. package/components/common/vm/actions/clone/Clone.vue +668 -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/os/os.vue +18 -32
  169. package/components/common/vm/actions/common/select/storage/Storage.vue +130 -130
  170. package/components/common/vm/actions/common/select/storage/StorageOld.vue +129 -129
  171. package/components/common/vm/actions/common/select/template/Template.vue +62 -62
  172. package/components/common/vm/actions/common/select/template/TemplateTreeView.vue +88 -88
  173. package/components/common/vm/actions/editSettings/new/Skeleton.vue +88 -88
  174. package/components/common/wizards/datastore/add/lib/config/steps.ts +138 -138
  175. package/components/common/wizards/datastore/add/nfs/accessibility/Accessibility.vue +60 -60
  176. package/components/common/wizards/datastore/add/readyComplete/ReadyComplete.vue +92 -92
  177. package/components/common/wizards/network/add/steps/SelectConnectionType.vue +105 -105
  178. package/components/common/wizards/vm/migrate/lib/config/constructDataReady.ts +220 -220
  179. package/components/common/wizards/vm/migrate/select/network/Network.vue +103 -103
  180. package/components/common/wizards/vm/migrate/select/network/table/network/Network.vue +150 -150
  181. package/components/common/wizards/vm/migrate/select/network/table/network/lib/config/advancedTable.ts +91 -91
  182. package/components/common/wizards/vm/migrate/select/priority/Priority.vue +43 -43
  183. package/composables/productNameLocal.ts +30 -30
  184. package/composables/useAppVersion.ts +21 -21
  185. package/package.json +1 -1
  186. package/plugins/date.ts +233 -233
  187. package/plugins/directives.ts +24 -24
  188. package/public/spice-console/lib/images/bitmap.js +203 -203
  189. package/public/spice-console/network/spicechannel.js +383 -383
  190. package/store/main/mutations.ts +7 -7
  191. package/store/main/state.ts +7 -7
  192. package/store/tasks/mappers/recentTasks.ts +64 -64
@@ -1,761 +1,770 @@
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
+ v-model:machine-type="vmForm.guestMachineType"
85
+ v-model:guest-os-family="vmForm.guestOsFamily"
86
+ v-model:guest-os-version="vmForm.guestOsVersion"
87
+ :families-options="guestOsFamilies"
88
+ :versions-options="guestOsVersions"
89
+ :machine-types-options="machineTypes"
90
+ :error-validation-fields="props.errorValidationFields"
91
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
92
+ />
93
+ <common-vm-actions-common-customize-hardware
94
+ v-show="selectedStep.id === dynamicSteps.customizeHardware"
95
+ :project="props.project"
96
+ :vm-name="vmForm.name"
97
+ :guest-machine-type="vmForm.guestMachineType"
98
+ :guest-os-family="vmForm.guestOsFamily"
99
+ :guest-os-version="vmForm.guestOsVersion"
100
+ :storage="vmForm.storage"
101
+ :hard-disks-for-boot-options="virtualHardwareHardDisksLocal"
102
+ :cd-dvd-drives-for-boot-options="virtualHardwareCdDvdDrivesLocal"
103
+ :networks-for-boot-options="virtualHardwareNetworksLocal"
104
+ :cd-dvd-drives="virtualHardwareCdDvdDrivesLocal"
105
+ :customize-hardware-submit="customizeHardwareSubmit"
106
+ :max-cpus="maxCpus"
107
+ :max-memory="maxMemory"
108
+ :cpu-models="cpuModels"
109
+ :selected-nav-item="selectedNavItem"
110
+ :nodes="props.nodes"
111
+ :files="props.files"
112
+ :networks-table="props.networksTable"
113
+ :error-validation-fields="props.errorValidationFields"
114
+ :get-datastore-table-func="props.getDatastoreTableFunc"
115
+ :datastore="props.datastore"
116
+ :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
117
+ :passthrough-devices="props.passthroughDevices"
118
+ :mediated-devices="props.mediatedDevices"
119
+ :compute-resource="vmForm.computeResource"
120
+ @change-boot-order="onChangeBootOrder"
121
+ @send-data="onChangeCustomizeHardware"
122
+ @get-storage="emits('get-storage', $event)"
123
+ @get-folders-or-files="emits('get-folders-or-files', $event)"
124
+ @get-active-device-child="emits('get-active-device-child', $event)"
125
+ @show-datastore-child="emits('show-datastore-child', $event)"
126
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
127
+ @get-networks-table="emits('get-networks-table', $event)"
128
+ @get-pci-devices="emits('get-pci-devices')"
129
+ />
130
+ <common-ready-to-complete
131
+ v-if="selectedStep.id === dynamicSteps.readyComplete"
132
+ :data="props.readyCompleteTableInfo"
133
+ />
134
+ <span
135
+ v-if="selectedStep.id > dynamicSteps.compatibility"
136
+ class="vm-hardware-version"
137
+ >{{ compatibilityInfo }}</span
138
+ >
139
+ </div>
140
+ </template>
141
+
142
+ <template #modalFooterContent>
143
+ <div v-if="isShowPowerOn" class="power-on-by-default-wrap">
144
+ <input
145
+ id="power-on-by-default"
146
+ v-model="isPowerOnByDefault"
147
+ data-id="power-on-by-default"
148
+ type="checkbox"
149
+ />
150
+ <label for="power-on-by-default" class="label-text-normal">{{
151
+ localization.common.powerOnByDefault
152
+ }}</label>
153
+ </div>
154
+ </template>
155
+ </atoms-wizard>
156
+ </div>
157
+ </template>
158
+
159
+ <script setup lang="ts">
160
+ import type {
161
+ UI_I_Localization,
162
+ UI_I_ArbitraryObject,
163
+ } from '~/lib/models/interfaces'
164
+ import type { UI_T_Project } from '~/lib/models/types'
165
+ import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
166
+ import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
167
+ import type {
168
+ UI_I_DatastoreTableItem,
169
+ UI_I_FolderOrFileTreePayload,
170
+ } from '~/lib/models/store/storage/interfaces'
171
+ import type {
172
+ API_UI_I_Error,
173
+ UI_I_ErrorValidationField,
174
+ } from '~/lib/models/store/interfaces'
175
+ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
176
+ import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
177
+ import type {
178
+ UI_T_AddVmFinishFunc,
179
+ UI_T_SelectedNavItem,
180
+ } from '~/components/common/vm/actions/common/lib/models/types'
181
+ import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
182
+ import type {
183
+ UI_I_ValidationReturn,
184
+ UI_I_WizardStep,
185
+ } from '~/components/atoms/wizard/lib/models/interfaces'
186
+ import type {
187
+ UI_I_Capabilities,
188
+ UI_I_VmForm,
189
+ UI_I_VmFormCash,
190
+ } from '~/components/common/vm/actions/common/lib/models/interfaces'
191
+ import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
192
+ import type { UI_I_OsChange } from '~/components/common/vm/actions/common/select/lib/models/interfaces'
193
+ import type {
194
+ UI_I_SendDataCpu,
195
+ UI_I_SendDataMemory,
196
+ UI_I_SendDataNewCdDvdDrive,
197
+ UI_I_SendDataNewHardDisk,
198
+ UI_I_SendDataNewNetwork,
199
+ } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
200
+ import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
201
+ import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/models/types'
202
+ import type {
203
+ UI_I_MediatedDevice,
204
+ UI_I_PciDevice,
205
+ } from '~/lib/models/store/vm/interfaces'
206
+ import { capabilities } from '~/components/common/vm/actions/common/lib/config/capabilities'
207
+ import {
208
+ stepsSchemeInitial,
209
+ stepsFunc,
210
+ dynamicSteps,
211
+ } from '~/components/common/vm/actions/add/lib/config/steps'
212
+ import Wizard from '~/components/atoms/wizard/lib/utils/utils'
213
+ import { mapCapabilities } from '~/components/common/vm/actions/common/lib/utils/capabilities'
214
+
215
+ const props = defineProps<{
216
+ project: UI_T_Project
217
+ nodes: UI_I_FileTreeNode[]
218
+ files: UI_I_FileTreeNode[]
219
+ networksTable: UI_I_NetworkTableItem[]
220
+ datastore: UI_I_DatastoreTableItem[]
221
+ errorValidationFields: UI_I_ErrorValidationField[]
222
+ readyCompleteTableInfo: UI_I_TableInfoItem[]
223
+ vmCpuHelpTextSecond: string
224
+ importFromVMWarevSphere: string
225
+ finishFunc: UI_T_AddVmFinishFunc
226
+ getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
227
+ validateSendDataFunc: UI_T_AddVmFinishFunc<
228
+ [UI_T_SelectedNavItem, null | number] | null
229
+ >
230
+ passthroughDevices: UI_I_PciDevice[]
231
+ mediatedDevices: UI_I_MediatedDevice[]
232
+ vmNameInWizard: string
233
+ capabilities?: UI_I_Capabilities
234
+ dataCenter?: UI_I_TreeNode // для сферы
235
+ computeResource?: UI_I_TreeNode // для сферы
236
+ computeResourceTree?: UI_I_TreeNode[] // для сферы
237
+ }>()
238
+
239
+ const emits = defineEmits<{
240
+ (event: 'check-name', value: [string, (error: API_UI_I_Error) => void]): void
241
+ (event: 'get-storage', value: UI_I_TablePayload): void
242
+ (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
243
+ (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
244
+ (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
245
+ (event: 'remove-error-by-title', value: string): void
246
+ (event: 'get-networks-table', value: UI_I_TablePayload): void
247
+ (event: 'get-pci-devices'): void
248
+ (event: 'get-pci-devices'): void
249
+ (event: 'hide'): void
250
+ (
251
+ event: 'get-compute-resource-tree',
252
+ value: { id: string | number; cb: () => void }
253
+ ): void // для сферы
254
+ (event: 'show-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
255
+ (event: 'select-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
256
+ (event: 'clear-compute-resource-tree'): void // для сферы
257
+ }>()
258
+
259
+ const { $recursion } = useNuxtApp()
260
+
261
+ const localization = computed<UI_I_Localization>(() => useLocal())
262
+
263
+ const isSphere = computed<boolean>(() => props.project === 'sphere')
264
+
265
+ watch(
266
+ () => props.capabilities,
267
+ () => {
268
+ if (props.capabilities) mapCapabilities(props.capabilities)
269
+ },
270
+ { deep: true, immediate: true }
271
+ )
272
+
273
+ const selectedCreateType = ref<string>('0')
274
+
275
+ const wizard: Wizard = new Wizard(
276
+ stepsFunc(localization.value),
277
+ stepsSchemeInitial
278
+ )
279
+ watch(
280
+ selectedCreateType,
281
+ (newValue) => {
282
+ switch (newValue) {
283
+ case '0':
284
+ wizard.changeScheme(isSphere.value ? 1 : 0)
285
+ break
286
+ case '1':
287
+ wizard.changeScheme(2)
288
+ }
289
+ },
290
+ { immediate: true }
291
+ )
292
+ // if (isSphere.value) wizard.changeScheme(1)
293
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
294
+ // const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
295
+
296
+ const isShowPowerOn = computed<boolean>(
297
+ () => wizard.selectedStepId > dynamicSteps.customizeHardware
298
+ )
299
+
300
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
301
+ wizard.changeSteps(value, validationFunc, validateSendData)
302
+ }
303
+ const validationFunc = async (
304
+ value: UI_I_WizardStep[],
305
+ currentStep: UI_I_WizardStep,
306
+ nextStep: UI_I_WizardStep
307
+ ): Promise<UI_I_ValidationReturn> => {
308
+ let stepHasError = false
309
+ let stepShouldStop = {
310
+ ifOnCurrentStep: false,
311
+ ifFromAnyStep: false,
312
+ stoppageStepId: -1,
313
+ }
314
+
315
+ wizard.setLoader(true)
316
+ if (
317
+ wizard.isValidateForStep(
318
+ dynamicSteps.selectTemplate,
319
+ currentStep.id,
320
+ nextStep.id
321
+ )
322
+ ) {
323
+ const templateValidation = await checkTemplate(value)
324
+
325
+ value = templateValidation.newValue
326
+ stepHasError = stepHasError || templateValidation.stepHasError
327
+ } else if (
328
+ wizard.isValidateForStep(
329
+ isSphere.value ? dynamicSteps.selectNameFolder : dynamicSteps.selectName,
330
+ currentStep.id,
331
+ nextStep.id
332
+ )
333
+ ) {
334
+ const nameValidation = await checkName(value)
335
+
336
+ value = nameValidation.newValue
337
+ stepHasError = stepHasError || nameValidation.stepHasError
338
+ } else if (
339
+ isSphere.value &&
340
+ wizard.isValidateForStep(
341
+ dynamicSteps.selectComputeResource,
342
+ currentStep.id,
343
+ nextStep.id
344
+ )
345
+ ) {
346
+ const computeResourceValidation = await checkComputeResource(value)
347
+
348
+ value = computeResourceValidation.newValue
349
+ stepHasError = stepHasError || computeResourceValidation.stepHasError
350
+ } else if (
351
+ wizard.isValidateForStep(
352
+ dynamicSteps.selectStorage,
353
+ currentStep.id,
354
+ nextStep.id
355
+ )
356
+ ) {
357
+ const storageValidation = await checkStorage(value)
358
+
359
+ value = storageValidation.newValue
360
+
361
+ stepHasError = stepHasError || storageValidation.stepHasError
362
+ } else if (
363
+ wizard.isValidateForStep(
364
+ dynamicSteps.customizeHardware,
365
+ currentStep.id,
366
+ nextStep.id
367
+ )
368
+ ) {
369
+ const storageValidation = await checkCustomizeHardware(value)
370
+
371
+ value = storageValidation.newValue
372
+
373
+ stepHasError = stepHasError || storageValidation.stepHasError
374
+ }
375
+ wizard.setLoader(false)
376
+
377
+ return {
378
+ newValue: value,
379
+ stepHasError,
380
+ stepShouldStop,
381
+ }
382
+ }
383
+
384
+ const checkTemplate = async (
385
+ value: UI_I_WizardStep[]
386
+ ): Promise<UI_I_ValidationReturn> => {
387
+ let stepHasError = false
388
+
389
+ return new Promise((resolve) => {
390
+ templateSubmit.value = (isValid: boolean) => {
391
+ if (!isValid) {
392
+ stepHasError = wizard.setValidation(
393
+ dynamicSteps.selectTemplate,
394
+ 'template',
395
+ {
396
+ fieldMessage: 'aaa',
397
+ alertMessage: 'aaa',
398
+ }
399
+ )
400
+ } else if (wizard.hasMessage(dynamicSteps.selectTemplate, 'template')) {
401
+ value = wizard.removeValidation(
402
+ dynamicSteps.selectTemplate,
403
+ 'template',
404
+ value
405
+ )
406
+ }
407
+
408
+ resolve({
409
+ stepHasError,
410
+ newValue: value,
411
+ })
412
+ templateSubmit.value = null
413
+ }
414
+ })
415
+ }
416
+ const checkName = async (
417
+ value: UI_I_WizardStep[]
418
+ ): Promise<UI_I_ValidationReturn> => {
419
+ let stepHasError = false
420
+
421
+ return new Promise((resolve) => {
422
+ const step = isSphere.value
423
+ ? dynamicSteps.selectNameFolder
424
+ : dynamicSteps.selectName
425
+ nameFormSubmit.value = (isValid: boolean) => {
426
+ if (!isValid) {
427
+ stepHasError = wizard.setValidation(step, 'name', {
428
+ fieldMessage: 'aaa',
429
+ alertMessage: 'aaa',
430
+ })
431
+ } else if (wizard.hasMessage(step, 'name')) {
432
+ value = wizard.removeValidation(step, 'name', value)
433
+ }
434
+
435
+ resolve({
436
+ stepHasError,
437
+ newValue: value,
438
+ })
439
+ nameFormSubmit.value = null
440
+ }
441
+ })
442
+ }
443
+ const checkComputeResource = async (
444
+ value: UI_I_WizardStep[]
445
+ ): Promise<UI_I_ValidationReturn> => {
446
+ let stepHasError = false
447
+
448
+ return new Promise((resolve) => {
449
+ computeResourceSubmit.value = (isValid: boolean) => {
450
+ if (!isValid) {
451
+ stepHasError = wizard.setValidation(
452
+ dynamicSteps.selectComputeResource,
453
+ 'computeResource',
454
+ {
455
+ fieldMessage: 'aaa',
456
+ alertMessage: 'aaa',
457
+ }
458
+ )
459
+ } else if (
460
+ wizard.hasMessage(dynamicSteps.selectComputeResource, 'computeResource')
461
+ ) {
462
+ value = wizard.removeValidation(
463
+ dynamicSteps.selectComputeResource,
464
+ 'computeResource',
465
+ value
466
+ )
467
+ }
468
+
469
+ resolve({
470
+ stepHasError,
471
+ newValue: value,
472
+ })
473
+ computeResourceSubmit.value = null
474
+ }
475
+ })
476
+ }
477
+ const checkStorage = async (
478
+ value: UI_I_WizardStep[]
479
+ ): Promise<UI_I_ValidationReturn> => {
480
+ let stepHasError = false
481
+
482
+ return new Promise((resolve) => {
483
+ storageSubmit.value = (isValid: boolean) => {
484
+ if (!isValid) {
485
+ stepHasError = wizard.setValidation(
486
+ dynamicSteps.selectStorage,
487
+ 'storage',
488
+ {
489
+ fieldMessage: 'aaa',
490
+ alertMessage: 'aaa',
491
+ }
492
+ )
493
+ } else if (wizard.hasMessage(dynamicSteps.selectStorage, 'storage')) {
494
+ value = wizard.removeValidation(
495
+ dynamicSteps.selectStorage,
496
+ 'storage',
497
+ value
498
+ )
499
+ }
500
+
501
+ resolve({
502
+ stepHasError,
503
+ newValue: value,
504
+ })
505
+ storageSubmit.value = null
506
+ }
507
+ })
508
+ }
509
+ const checkCustomizeHardware = async (
510
+ value: UI_I_WizardStep[]
511
+ ): Promise<UI_I_ValidationReturn> => {
512
+ let stepHasError = false
513
+
514
+ return new Promise((resolve) => {
515
+ customizeHardwareSubmit.value = (isValid: boolean) => {
516
+ if (!isValid) {
517
+ stepHasError = wizard.setValidation(
518
+ dynamicSteps.customizeHardware,
519
+ 'customizeHardware',
520
+ {
521
+ fieldMessage: 'aaa',
522
+ alertMessage: 'aaa',
523
+ }
524
+ )
525
+ } else if (
526
+ wizard.hasMessage(dynamicSteps.customizeHardware, 'customizeHardware')
527
+ ) {
528
+ value = wizard.removeValidation(
529
+ dynamicSteps.customizeHardware,
530
+ 'customizeHardware',
531
+ value
532
+ )
533
+ }
534
+
535
+ resolve({
536
+ stepHasError,
537
+ newValue: value,
538
+ })
539
+ storageSubmit.value = null
540
+ }
541
+ })
542
+ }
543
+
544
+ const storageIdCash = ref<string | null>(null)
545
+ const vmForm = ref<UI_I_VmForm>({
546
+ name: '',
547
+ compatibility: '',
548
+ guestMachineType: null,
549
+ guestOsFamily: null,
550
+ guestOsVersion: null,
551
+ computeResource: null,
552
+ storage: null,
553
+ locationPath: '',
554
+ dataCenter: null,
555
+ })
556
+ const vmFormCash = ref<UI_I_VmFormCash>({
557
+ dataCenterId: null,
558
+ computeResourceTypeAndId: null,
559
+ })
560
+
561
+ const onChangeName = (name: string, node: UI_I_TreeNode): void => {
562
+ vmForm.value.name = name
563
+ if (isSphere.value) {
564
+ vmForm.value.locationPath = node.id
565
+ vmForm.value.dataCenter = $recursion.findParentByValue(
566
+ node,
567
+ 'datacenter',
568
+ 'type',
569
+ 'parent'
570
+ )
571
+ vmFormCash.value.dataCenterId = vmForm.value.dataCenter?.id || null
572
+ }
573
+ }
574
+ // // Для сферы
575
+ const computeResourcePath = ref<string>('')
576
+ const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
577
+ emits('select-compute-resource-tree', node)
578
+ computeResourcePath.value = node.id
579
+ }
580
+ const onChangeComputeResource = (node: UI_I_TreeNode): void => {
581
+ vmForm.value.computeResource = node
582
+ // const type = node.type.toUpperCase()
583
+ // schedRequirementsTemplate.value = `sched_requirements="(${type}_ID=${node.id})"\\`
584
+ vmFormCash.value.computeResourceTypeAndId = `${node.type}${node.id}` || null
585
+ }
586
+ const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
587
+ if (!storage) return
588
+
589
+ vmForm.value.storage = storage
590
+ storageIdCash.value = storage.id
591
+ }
592
+ const compatibilityInfo = ref<string>('')
593
+ const onChangeCompatibility = (compatibility: UI_I_OptionItem): void => {
594
+ vmForm.value.compatibility = compatibility.value
595
+
596
+ const version = compatibility.value.split('-')[1]
597
+ compatibilityInfo.value = `${localization.value.common.compatibility}: ${compatibility.text} (${localization.value.common.vmVersion} ${version})`
598
+ }
599
+ const customizeHardware = ref<UI_I_SendDataCustomizeHardware | null>(null)
600
+ const onChangeCustomizeHardware = (
601
+ data: UI_I_SendDataCustomizeHardware
602
+ ): void => {
603
+ customizeHardware.value = data
604
+ }
605
+
606
+ const virtualHardwareHardDisksLocal = computed<
607
+ UI_I_SendDataNewHardDisk[] | null
608
+ >(() => customizeHardware.value?.virtualHardware?.hardDisks || null)
609
+ const virtualHardwareNetworksLocal = computed<UI_I_SendDataNewNetwork[] | null>(
610
+ () => customizeHardware.value?.virtualHardware?.networks || null
611
+ )
612
+ const virtualHardwareCdDvdDrivesLocal = computed<
613
+ UI_I_SendDataNewCdDvdDrive[] | null
614
+ >(() => customizeHardware.value?.virtualHardware?.cdDvdDrives || null)
615
+
616
+ const virtualHardwareCpu = computed<UI_I_SendDataCpu | null>(
617
+ () => customizeHardware.value?.virtualHardware?.cpu || null
618
+ )
619
+ const virtualHardwareMemory = computed<UI_I_SendDataMemory | null>(
620
+ () => customizeHardware.value?.virtualHardware?.memory || null
621
+ )
622
+ const virtualHardwareHardDisks = ref<UI_I_SendDataNewHardDisk[] | null>(null)
623
+ const virtualHardwareCdDvdDrives = ref<UI_I_SendDataNewCdDvdDrive[] | null>(
624
+ null
625
+ )
626
+ const virtualHardwareNetworks = ref<UI_I_SendDataNewNetwork[] | null>(null)
627
+ const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
628
+ virtualHardwareHardDisks.value = data[0]
629
+ virtualHardwareCdDvdDrives.value = data[1]
630
+ virtualHardwareNetworks.value = data[2]
631
+ }
632
+
633
+ const isPowerOnByDefault = ref<boolean>(true)
634
+
635
+ watch(
636
+ () => props.vmNameInWizard,
637
+ (newValue) => {
638
+ vmForm.value.name = newValue
639
+ }
640
+ )
641
+
642
+ const validateSendData = async (
643
+ value: UI_I_WizardStep[]
644
+ ): Promise<UI_I_ValidationReturn> => {
645
+ wizard.setLoader(true)
646
+ let stepHasError = false
647
+
648
+ const data = await props.validateSendDataFunc(
649
+ vmForm.value,
650
+ virtualHardwareCpu.value,
651
+ virtualHardwareMemory.value,
652
+ customizeHardware.value,
653
+ virtualHardwareNetworks.value,
654
+ virtualHardwareHardDisks.value,
655
+ virtualHardwareCdDvdDrives.value,
656
+ isPowerOnByDefault.value,
657
+ localization.value,
658
+ vmForm.value.locationPath, // для сферы
659
+ computeResourcePath.value // для сферы
660
+ )
661
+
662
+ wizard.setLoader(false)
663
+ if (data) {
664
+ stepHasError = true
665
+ selectedNavItem.value = data[0]
666
+ data[1] !== null && wizard.selectStepHard(data[1])
667
+ }
668
+
669
+ return {
670
+ stepHasError,
671
+ newValue: value,
672
+ }
673
+ }
674
+ const onFinish = (): void => {
675
+ wizard.setLoader(false)
676
+ props
677
+ .finishFunc(
678
+ vmForm.value,
679
+ virtualHardwareCpu.value,
680
+ virtualHardwareMemory.value,
681
+ customizeHardware.value,
682
+ virtualHardwareNetworks.value,
683
+ virtualHardwareHardDisks.value,
684
+ virtualHardwareCdDvdDrives.value,
685
+ isPowerOnByDefault.value,
686
+ localization.value,
687
+ vmForm.value.locationPath, // для сферы
688
+ computeResourcePath.value, // для сферы
689
+ false
690
+ )
691
+ .then(() => {
692
+ onHideModal()
693
+ wizard.setLoader(false)
694
+ })
695
+ }
696
+
697
+ const selectedNavItem = ref<UI_T_SelectedNavItem>(0)
698
+
699
+ const nameFormSubmit = ref<null | Function>(null)
700
+ const templateSubmit = ref<null | Function>(null)
701
+ const computeResourceSubmit = ref<null | Function>(null)
702
+ const storageSubmit = ref<null | Function>(null)
703
+ const customizeHardwareSubmit = ref<null | Function>(null)
704
+ const compatibility = ref<UI_I_OptionItem[]>(
705
+ capabilities.compatibility.filter((camp) => {
706
+ let result = true
707
+ // if (isDev && camp.value === 'pvm-2') result = false
708
+ if (camp.value === 'pvm-2') result = false
709
+ return result
710
+ })
711
+ )
712
+ const guestOsFamilies = ref<UI_I_OptionItem[]>(capabilities.guestOsFamilies)
713
+ const guestOsVersions = ref<UI_I_ArbitraryObject<UI_I_OptionItem[]>>(
714
+ capabilities.guestOsVersions
715
+ )
716
+ const machineTypes = ref<UI_I_OptionItem[]>(capabilities.machineTypes)
717
+ const cpuModels = ref<UI_I_OptionItem[]>(capabilities.cpuModels)
718
+ const maxCpus = ref<number>(capabilities.maxCpus)
719
+ const maxMemory = ref<number>(capabilities.maxMemory)
720
+
721
+ const selectedTemplate = ref<string>('')
722
+ const onChangeTemplate = (id: string): void => {
723
+ selectedTemplate.value = id
724
+ }
725
+ const selectedOptions = ref<string[]>([])
726
+ const onChangeSelectOptions = (options: string[]) => {
727
+ selectedOptions.value = options
728
+ if (
729
+ options.includes('customize-os') &&
730
+ options.includes('customize-hardware')
731
+ ) {
732
+ wizard.changeScheme(5)
733
+ } else if (options.includes('customize-os')) {
734
+ wizard.changeScheme(3)
735
+ } else if (options.includes('customize-hardware')) {
736
+ wizard.changeScheme(4)
737
+ } else {
738
+ wizard.changeScheme(2)
739
+ }
740
+ }
741
+
742
+ const onHideModal = (): void => {
743
+ emits('hide')
744
+ }
745
+ </script>
746
+
747
+ <style scoped lang="scss">
748
+ :deep(.modal-body) {
749
+ display: flex;
750
+ flex-direction: column;
751
+ }
752
+ .add-vm-content {
753
+ display: flex;
754
+ flex-direction: column;
755
+ flex: 1;
756
+ }
757
+ .vm-hardware-version {
758
+ align-self: flex-end;
759
+ margin-top: auto;
760
+ }
761
+ .power-on-by-default-wrap {
762
+ display: flex;
763
+ align-items: center;
764
+ margin-right: auto;
765
+
766
+ input {
767
+ margin-right: 6px;
768
+ }
769
+ }
770
+ </style>