bfg-common 1.5.57 → 1.5.59

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