bfg-common 1.5.60 → 1.5.61

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