bfg-common 1.5.591 → 1.5.592

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 (261) 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/components/atoms/TheIcon3.vue +50 -50
  7. package/components/atoms/collapse/CollapseNav.vue +170 -170
  8. package/components/atoms/perPage/PerPage.vue +58 -58
  9. package/components/atoms/table/dataGrid/DataGrid.vue +1718 -1718
  10. package/components/atoms/table/dataGrid/DataGridPagination.vue +97 -97
  11. package/components/atoms/table/dataGrid/lib/config/settingsTable.ts +94 -94
  12. package/components/atoms/table/dataGrid/lib/utils/export.ts +16 -16
  13. package/components/common/backup/storage/actions/add/lib/utils.ts +51 -51
  14. package/components/common/browse/blocks/contents/filesNew/Skeleton.vue +18 -18
  15. package/components/common/browse/blocks/lib/models/types.ts +1 -1
  16. package/components/common/browse/lib/models/interfaces.ts +5 -5
  17. package/components/common/diagramMain/network/Contents.vue +497 -497
  18. package/components/common/layout/theHeader/helpMenu/About.vue +79 -79
  19. package/components/common/layout/theHeader/helpMenu/aboutOld/AboutOld.vue +79 -79
  20. package/components/common/pages/backups/DetailView.vue +52 -52
  21. package/components/common/pages/backups/lib/models/interfaces.ts +36 -36
  22. package/components/common/pages/backups/modals/Modals.vue +243 -243
  23. package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/config/options.ts +6 -6
  24. package/components/common/pages/backups/modals/createBackup/lib/config/readyToCompleteOptions.ts +69 -69
  25. package/components/common/pages/backups/modals/lib/config/restore.ts +115 -115
  26. package/components/common/pages/backups/modals/lib/models/interfaces.ts +186 -186
  27. package/components/common/pages/backups/modals/restore/name/lib/models/interfaces.ts +6 -6
  28. package/components/common/pages/home/lib/models/interfaces.ts +48 -48
  29. package/components/common/pages/home/widgets/hosts/Hosts.vue +27 -27
  30. package/components/common/pages/home/widgets/hosts/lib/config/items.ts +23 -23
  31. package/components/common/pages/home/widgets/vms/VmsOld.vue +35 -35
  32. package/components/common/pages/home/widgets/vms/lib/config/items.ts +19 -19
  33. package/components/common/pages/scheduledTasks/lib/utils/utils.ts +84 -84
  34. package/components/common/readyToComplete/ReadyToComplete.vue +17 -17
  35. package/components/common/select/radio/RadioGroup.vue +137 -137
  36. package/components/common/spiceConsole/Drawer.vue +420 -420
  37. package/components/common/spiceConsole/SpiceConsole.vue +184 -184
  38. package/components/common/spiceConsole/lib/models/interfaces.ts +5 -5
  39. package/components/common/tools/Actions.vue +207 -207
  40. package/components/common/treeView/TreeView.vue +52 -52
  41. package/components/common/vm/actions/add/Add.vue +819 -886
  42. package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +205 -241
  43. package/components/common/vm/actions/common/customizeHardware/{CustomizeHardwareNew.vue → New.vue} +325 -325
  44. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue +679 -733
  45. package/components/common/vm/actions/common/customizeHardware/virtualHardware/bus/Bus.vue +101 -110
  46. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDrive.vue +227 -252
  47. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/Media.vue +29 -30
  48. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Cpu.vue +322 -348
  49. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/coresPerSocket/CoresPerSocket.vue +81 -86
  50. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/hotPlug/HotPlug.vue +40 -40
  51. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/maxCpu/MaxCpu.vue +91 -94
  52. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/model/Model.vue +92 -124
  53. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/Shares.vue +133 -140
  54. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/lib/config/options.ts +28 -28
  55. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/tooltip/Tooltip.vue +27 -25
  56. package/components/common/vm/actions/common/customizeHardware/virtualHardware/limit/Limit.vue +214 -221
  57. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +280 -300
  58. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/{MemoryNew.vue → New.vue} +158 -158
  59. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/{MemoryOld.vue → Old.vue} +155 -155
  60. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/hotPlug/HotPlug.vue +29 -29
  61. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/{NewHardDiskNew.vue → New.vue} +0 -2
  62. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +483 -521
  63. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/{NewHardDiskOld.vue → Old.vue} +1 -6
  64. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/cache/Cache.vue +59 -63
  65. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/file/File.vue +24 -25
  66. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/limitIops/LimitIops.vue +96 -103
  67. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/Location.vue +142 -154
  68. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/storageModal/StorageModal.vue +55 -61
  69. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/maximumSize/MaximumSize.vue +26 -26
  70. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/mode/Mode.vue +61 -65
  71. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/provisioning/Provisioning.vue +57 -61
  72. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/sharing/Sharing.vue +59 -63
  73. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +257 -277
  74. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/adapterType/AdapterType.vue +56 -60
  75. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/Location.vue +65 -71
  76. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddress.vue +111 -119
  77. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDevice.vue +199 -210
  78. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/DirectPathIo.vue +27 -29
  79. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/DynamicDirectPathIo.vue +29 -31
  80. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/Note.vue +23 -22
  81. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/nvidiaGrid/NvidiaGrid.vue +40 -41
  82. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/typeSelection/TypeSelection.vue +34 -35
  83. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbController.vue +47 -47
  84. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/Other.vue +15 -16
  85. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/inputDevices/InputDevices.vue +15 -15
  86. package/components/common/vm/actions/common/customizeHardware/virtualHardware/reservation/Reservation.vue +194 -197
  87. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCard.vue +129 -140
  88. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/model/Model.vue +35 -37
  89. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/numberDisplays/NumberDisplays.vue +50 -53
  90. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/totalVideoMemory/TotalVideoMemory.vue +104 -107
  91. package/components/common/vm/actions/common/customizeHardware/vmoptions/Vmoptions.vue +70 -76
  92. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptions.vue +42 -46
  93. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/delay/Delay.vue +32 -32
  94. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/Firmware.vue +57 -60
  95. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/menu/Menu.vue +25 -26
  96. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +155 -156
  97. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +82 -86
  98. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/RemoteConsoleOptions.vue +74 -74
  99. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/copyPaste/CopyPaste.vue +25 -26
  100. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/fileTransfer/FileTransfer.vue +25 -26
  101. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/folderSharing/FolderSharing.vue +17 -20
  102. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +32 -32
  103. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/Password.vue +99 -102
  104. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirection.vue +28 -28
  105. package/components/common/vm/actions/common/customizeHardware/vmoptions/tools/Tools.vue +42 -42
  106. package/components/common/vm/actions/common/select/compatibility/Compatibility.vue +105 -107
  107. package/components/common/vm/actions/common/select/compatibility/Old.vue +107 -107
  108. package/components/common/vm/actions/common/select/createType/CreateType.vue +36 -38
  109. package/components/common/vm/actions/common/select/createType/lib/models/interfaces.ts +5 -5
  110. package/components/common/vm/actions/common/select/options/Options.vue +53 -54
  111. package/components/common/vm/actions/common/select/os/Os.vue +152 -164
  112. package/components/common/vm/actions/common/select/storage/Old.vue +125 -125
  113. package/components/common/vm/actions/common/select/storage/Storage.vue +170 -178
  114. package/components/common/vm/actions/common/select/storage/new/New.vue +311 -311
  115. package/components/common/vm/actions/common/select/storage/new/lib/models/interfaces.ts +5 -5
  116. package/components/common/vm/actions/common/select/storage/new/lib/utils/utils.ts +21 -21
  117. package/components/common/vm/actions/common/select/template/Template.vue +75 -77
  118. package/components/common/vm/actions/common/select/template/old/Old.vue +50 -50
  119. package/components/common/vm/actions/common/select/template/treeView/TreeView.vue +85 -87
  120. package/components/common/vm/actions/editSettings/new/Skeleton.vue +88 -88
  121. package/components/common/vm/actions/register/Register.vue +352 -352
  122. package/components/common/vm/actions/register/lib/config/steps.ts +86 -86
  123. package/components/common/wizards/common/compatibility/Compatibility.vue +35 -35
  124. package/components/common/wizards/common/compatibility/New.vue +99 -99
  125. package/components/common/wizards/common/compatibility/Old.vue +53 -53
  126. package/components/common/wizards/common/steps/computeResource/ComputeResource.vue +86 -86
  127. package/components/common/wizards/common/steps/computeResource/New.vue +93 -93
  128. package/components/common/wizards/common/steps/name/Name.vue +178 -178
  129. package/components/common/wizards/common/steps/name/New.vue +221 -221
  130. package/components/common/wizards/common/steps/name/Old.vue +121 -121
  131. package/components/common/wizards/common/steps/name/lib/models/interfaces.ts +4 -4
  132. package/components/common/wizards/common/steps/name/location/Location.vue +85 -85
  133. package/components/common/wizards/common/steps/name/location/New.vue +40 -40
  134. package/components/common/wizards/datastore/add/Add.vue +228 -228
  135. package/components/common/wizards/datastore/add/lib/utils.ts +85 -85
  136. package/components/common/wizards/datastore/add/steps/typeMode/lib/config/typeOptions.ts +43 -43
  137. package/components/common/wizards/vm/migrate/select/computeResource/ComputeResource.vue +205 -205
  138. package/components/common/wizards/vm/migrate/select/network/Network.vue +103 -103
  139. package/composables/useAppVersion.ts +21 -21
  140. package/composables/useLocal.ts +6 -6
  141. package/composables/useLocalCommon.ts +39 -39
  142. package/package.json +1 -1
  143. package/plugins/console.ts +21 -21
  144. package/plugins/date.ts +233 -233
  145. package/plugins/mouse.ts +21 -21
  146. package/plugins/panelStates.ts +70 -70
  147. package/plugins/text.ts +59 -59
  148. package/plugins/time.ts +58 -58
  149. package/public/spice-console/application/clientgui.js +854 -854
  150. package/public/spice-console/application/packetfactory.js +211 -211
  151. package/public/spice-console/application/virtualmouse.js +147 -147
  152. package/public/spice-console/lib/images/bitmap.js +203 -203
  153. package/public/spice-console/network/spicechannel.js +440 -440
  154. package/public/spice-console/process/cursorprocess.js +121 -121
  155. package/public/spice-console/process/inputprocess.js +227 -227
  156. package/public/spice-console/process/mainprocess.js +210 -210
  157. package/public/spice-console/run.js +210 -210
  158. package/store/main/mutations.ts +7 -7
  159. package/store/main/state.ts +7 -7
  160. /package/components/common/vm/actions/common/customizeHardware/{CustomizeHardwareOld.vue → Old.vue} +0 -0
  161. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/{VirtualHardwareNew.vue → New.vue} +0 -0
  162. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/{VirtualHardwareOld.vue → Old.vue} +0 -0
  163. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/bus/{BusNew.vue → New.vue} +0 -0
  164. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/bus/{BusOld.vue → Old.vue} +0 -0
  165. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/{CdDvdDriveNew.vue → New.vue} +0 -0
  166. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/{CdDvdDriveOld.vue → Old.vue} +0 -0
  167. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/{MediaNew.vue → New.vue} +0 -0
  168. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/{MediaOld.vue → Old.vue} +0 -0
  169. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/{CpuNew.vue → New.vue} +0 -0
  170. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/{CpuOld.vue → Old.vue} +0 -0
  171. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/coresPerSocket/{CoresPerSocketNew.vue → New.vue} +0 -0
  172. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/coresPerSocket/{CoresPerSocketOld.vue → Old.vue} +0 -0
  173. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/hotPlug/{HotPlugNew.vue → New.vue} +0 -0
  174. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/hotPlug/{HotPlugOld.vue → Old.vue} +0 -0
  175. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/maxCpu/{MaxCpuNew.vue → New.vue} +0 -0
  176. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/maxCpu/{MaxCpuOld.vue → Old.vue} +0 -0
  177. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/model/{ModelNew.vue → New.vue} +0 -0
  178. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/model/{ModelOld.vue → Old.vue} +0 -0
  179. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/{SharesNew.vue → New.vue} +0 -0
  180. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/{SharesOld.vue → Old.vue} +0 -0
  181. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/tooltip/{TooltipNew.vue → New.vue} +0 -0
  182. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/tooltip/{TooltipOld.vue → Old.vue} +0 -0
  183. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/limit/{LimitNew.vue → New.vue} +0 -0
  184. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/limit/{LimitOld.vue → Old.vue} +0 -0
  185. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/hotPlug/{HotPlugNew.vue → New.vue} +0 -0
  186. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/hotPlug/{HotPlugOld.vue → Old.vue} +0 -0
  187. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/cache/{CacheNew.vue → New.vue} +0 -0
  188. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/cache/{CacheOld.vue → Old.vue} +0 -0
  189. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/file/{FileNew.vue → New.vue} +0 -0
  190. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/file/{FileOld.vue → Old.vue} +0 -0
  191. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/limitIops/{LimitIopsNew.vue → New.vue} +0 -0
  192. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/limitIops/{LimitIopsOld.vue → Old.vue} +0 -0
  193. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/{LocationNew.vue → New.vue} +0 -0
  194. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/{LocationOld.vue → Old.vue} +0 -0
  195. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/maximumSize/{MaximumSizeNew.vue → New.vue} +0 -0
  196. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/maximumSize/{MaximumSizeOld.vue → Old.vue} +0 -0
  197. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/mode/{ModeNew.vue → New.vue} +0 -0
  198. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/mode/{ModeOld.vue → Old.vue} +0 -0
  199. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/provisioning/{ProvisioningNew.vue → New.vue} +0 -0
  200. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/provisioning/{ProvisioningOld.vue → Old.vue} +0 -0
  201. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/sharing/{SharingNew.vue → New.vue} +0 -0
  202. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/sharing/{SharingOld.vue → Old.vue} +0 -0
  203. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/{NewNetworkNew.vue → New.vue} +0 -0
  204. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/{NewNetworkOld.vue → Old.vue} +0 -0
  205. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/adapterType/{AdapterTypeNew.vue → New.vue} +0 -0
  206. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/adapterType/{AdapterTypeOld.vue → Old.vue} +0 -0
  207. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/{LocationOld.vue → Old.vue} +0 -0
  208. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/{MacAddressNew.vue → New.vue} +0 -0
  209. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/{MacAddressOld.vue → Old.vue} +0 -0
  210. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/{NewPciDeviceNew.vue → New.vue} +0 -0
  211. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/{NewPciDeviceOld.vue → Old.vue} +0 -0
  212. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/{DirectPathIoNew.vue → New.vue} +0 -0
  213. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/{DirectPathIoOld.vue → Old.vue} +0 -0
  214. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/{DynamicDirectPathIoNew.vue → New.vue} +0 -0
  215. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/{DynamicDirectPathIoOld.vue → Old.vue} +0 -0
  216. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/{NoteNew.vue → New.vue} +0 -0
  217. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/{NoteOld.vue → Old.vue} +0 -0
  218. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/nvidiaGrid/{NvidiaGridNew.vue → New.vue} +0 -0
  219. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/nvidiaGrid/{NvidiaGridOld.vue → Old.vue} +0 -0
  220. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/typeSelection/{TypeSelectionNew.vue → New.vue} +0 -0
  221. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/typeSelection/{TypeSelectionOld.vue → Old.vue} +0 -0
  222. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/{NewUsbControllerNew.vue → New.vue} +0 -0
  223. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/{NewUsbControllerOld.vue → Old.vue} +0 -0
  224. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/{OtherNew.vue → New.vue} +0 -0
  225. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/{OtherOld.vue → Old.vue} +0 -0
  226. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/inputDevices/{InputDevicesNew.vue → New.vue} +0 -0
  227. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/inputDevices/{InputDevicesOld.vue → Old.vue} +0 -0
  228. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/reservation/{ReservationNew.vue → New.vue} +0 -0
  229. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/reservation/{ReservationOld.vue → Old.vue} +0 -0
  230. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/{VideoCardNew.vue → New.vue} +0 -0
  231. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/{VideoCardOld.vue → Old.vue} +0 -0
  232. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/model/{ModelNew.vue → New.vue} +0 -0
  233. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/model/{ModelOld.vue → Old.vue} +0 -0
  234. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/numberDisplays/{NumberDisplaysNew.vue → New.vue} +0 -0
  235. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/numberDisplays/{NumberDisplaysOld.vue → Old.vue} +0 -0
  236. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/totalVideoMemory/{TotalVideoMemoryNew.vue → New.vue} +0 -0
  237. /package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/totalVideoMemory/{TotalVideoMemoryOld.vue → Old.vue} +0 -0
  238. /package/components/common/vm/actions/common/customizeHardware/vmoptions/{VmoptionsNew.vue → New.vue} +0 -0
  239. /package/components/common/vm/actions/common/customizeHardware/vmoptions/{VmoptionsOld.vue → Old.vue} +0 -0
  240. /package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/{BootOptionsNew.vue → New.vue} +0 -0
  241. /package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/{BootOptionsOld.vue → Old.vue} +0 -0
  242. /package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/delay/{DelayNew.vue → New.vue} +0 -0
  243. /package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/delay/{DelayOld.vue → Old.vue} +0 -0
  244. /package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/{FirmwareNew.vue → New.vue} +0 -0
  245. /package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/{FirmwareOld.vue → Old.vue} +0 -0
  246. /package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/menu/{MenuNew.vue → New.vue} +0 -0
  247. /package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/menu/{MenuOld.vue → Old.vue} +0 -0
  248. /package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/{OrderNew.vue → New.vue} +0 -0
  249. /package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/{OrderOld.vue → Old.vue} +0 -0
  250. /package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/{GeneralOptionsNew.vue → New.vue} +0 -0
  251. /package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/{GeneralOptionsOld.vue → Old.vue} +0 -0
  252. /package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/copyPaste/{CopyPasteNew.vue → New.vue} +0 -0
  253. /package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/copyPaste/{CopyPasteOld.vue → Old.vue} +0 -0
  254. /package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/fileTransfer/{FileTransferNew.vue → New.vue} +0 -0
  255. /package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/fileTransfer/{FileTransferOld.vue → Old.vue} +0 -0
  256. /package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/folderSharing/{FolderSharingNew.vue → New.vue} +0 -0
  257. /package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/folderSharing/{FolderSharingOld.vue → Old.vue} +0 -0
  258. /package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/{UsbRedirectionNew.vue → New.vue} +0 -0
  259. /package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/{UsbRedirectionOld.vue → Old.vue} +0 -0
  260. /package/components/common/vm/actions/common/customizeHardware/vmoptions/tools/{ToolsNew.vue → New.vue} +0 -0
  261. /package/components/common/vm/actions/common/customizeHardware/vmoptions/tools/{ToolsOld.vue → Old.vue} +0 -0
@@ -1,886 +1,819 @@
1
- <template>
2
- <common-vm-actions-add-new
3
- v-if="isNewView"
4
- v-model="model"
5
- v-model:computed-resource="computeResource"
6
- v-model:selected-create-type="selectedCreateType"
7
- v-model:is-power-on-by-default="isPowerOnByDefault"
8
- :project="props.project"
9
- :is-vmt="props.isVmt"
10
- :nodes="props.nodes"
11
- :files="props.files"
12
- :networks-table="props.networksTable"
13
- :datastore="props.datastore"
14
- :is-datastore-loading="props.isDatastoreLoading"
15
- :error-validation-fields="props.errorValidationFields"
16
- :ready-complete-table-info="props.readyCompleteTableInfo"
17
- :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
18
- :import-from-v-m-warev-sphere="props.importFromVMWarevSphere"
19
- :get-datastore-table-func="props.getDatastoreTableFunc"
20
- :passthrough-devices="props.passthroughDevices"
21
- :mediated-devices="props.mediatedDevices"
22
- :templates-tree="props.templatesTree"
23
- :wizard="wizard"
24
- :selected-scheme="selectedScheme"
25
- :template-submit="templateSubmit"
26
- :name-form-submit="nameFormSubmit"
27
- :storage-submit="storageSubmit"
28
- :customize-hardware-submit="customizeHardwareSubmit"
29
- :customize-hardware-for-template-submit="customizeHardwareForTemplateSubmit"
30
- :is-sphere="isSphere"
31
- :compatibility="compatibility"
32
- :guestOsFamilies="guestOsFamilies"
33
- :guestOsVersions="guestOsVersions"
34
- :machineTypes="machineTypes"
35
- :max-memory="maxMemory"
36
- :cpu-models="cpuModels"
37
- :selected-nav-item="selectedNavItem"
38
- :compatibility-info="compatibilityInfo"
39
- :is-show-power-on="isShowPowerOn"
40
- :is-show-select-template="isShowSelectTemplate"
41
- :data-center="props.dataCenter"
42
- :compute-resource="props.computeResource"
43
- :compute-resource-tree="props.computeResourceTree"
44
- :location-nodes="props.locationNodes"
45
- :allowed-location-kinds="allowedLocationKinds"
46
- :location-description="locationDescription"
47
- :vmt-settings="props.vmtSettings"
48
- :is-loading="isLoading"
49
- :selected-template-id="props.selectedTemplateId"
50
- :validate-empty-name="props.validateEmptyName"
51
- :title="title"
52
- :name-request-url="props.nameRequestUrl"
53
- :validation-description="validationDescription"
54
- :name-exist-validation="nameExistValidation"
55
- :name-test-ids="nameTestIds"
56
- :is-loading-compute-tree="isLoadingComputeTree"
57
- :compute-resource-alert="computeResourceAlert"
58
- :compatibility-text="compatibilityText"
59
- @get-storage="emits('get-storage', $event)"
60
- @get-folders-or-files="emits('get-folders-or-files', $event)"
61
- @get-active-device-child="emits('get-active-device-child', $event)"
62
- @show-datastore-child="emits('show-datastore-child', $event)"
63
- @remove-error-by-title="emits('remove-error-by-title', $event)"
64
- @get-networks-table="emits('get-networks-table', $event)"
65
- @get-pci-devices="emits('get-pci-devices')"
66
- @change-steps="onChangeSteps"
67
- @change-template="onChangeTemplate"
68
- @change-name="onChangeName(...$event)"
69
- @change-storage="onChangeStorage"
70
- @change-select-options="onChangeSelectOptions"
71
- @change-clone-count="cloneCount = $event"
72
- @change-compatibility="onChangeCompatibility"
73
- @finish="onFinish"
74
- @hide="onHideModal"
75
- />
76
- <common-vm-actions-add-old
77
- v-else
78
- v-model="model"
79
- v-model:compute-resource="computeResource"
80
- v-model:selected-create-type="selectedCreateType"
81
- v-model:is-power-on-by-default="isPowerOnByDefault"
82
- :project="props.project"
83
- :is-vmt="props.isVmt"
84
- :nodes="props.nodes"
85
- :files="props.files"
86
- :networks-table="props.networksTable"
87
- :datastore="props.datastore"
88
- :is-datastore-loading="props.isDatastoreLoading"
89
- :error-validation-fields="props.errorValidationFields"
90
- :ready-complete-table-info="props.readyCompleteTableInfo"
91
- :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
92
- :import-from-v-m-warev-sphere="props.importFromVMWarevSphere"
93
- :get-datastore-table-func="props.getDatastoreTableFunc"
94
- :passthrough-devices="props.passthroughDevices"
95
- :mediated-devices="props.mediatedDevices"
96
- :templates-tree="props.templatesTree"
97
- :wizard="wizard"
98
- :selected-scheme="selectedScheme"
99
- :template-submit="templateSubmit"
100
- :name-form-submit="nameFormSubmit"
101
- :storage-submit="storageSubmit"
102
- :customize-hardware-submit="customizeHardwareSubmit"
103
- :customize-hardware-for-template-submit="customizeHardwareForTemplateSubmit"
104
- :is-sphere="isSphere"
105
- :compatibility="compatibility"
106
- :guestOsFamilies="guestOsFamilies"
107
- :guestOsVersions="guestOsVersions"
108
- :machineTypes="machineTypes"
109
- :max-memory="maxMemory"
110
- :cpu-models="cpuModels"
111
- :selected-nav-item="selectedNavItem"
112
- :compatibility-info="compatibilityInfo"
113
- :is-show-power-on="isShowPowerOn"
114
- :data-center="props.dataCenter"
115
- :compute-resource="props.computeResource"
116
- :compute-resource-tree="props.computeResourceTree"
117
- :location-nodes="props.locationNodes"
118
- :allowed-location-kinds="allowedLocationKinds"
119
- :location-description="locationDescription"
120
- :vmt-settings="props.vmtSettings"
121
- :is-loading="isLoading"
122
- :validate-empty-name="props.validateEmptyName"
123
- :title="title"
124
- :name-request-url="props.nameRequestUrl"
125
- :validation-description="validationDescription"
126
- :name-exist-validation="nameExistValidation"
127
- :name-test-ids="nameTestIds"
128
- :is-loading-compute-tree="isLoadingComputeTree"
129
- :compute-resource-alert="computeResourceAlert"
130
- :compatibility-text="compatibilityText"
131
- @get-storage="emits('get-storage', $event)"
132
- @get-folders-or-files="emits('get-folders-or-files', $event)"
133
- @get-active-device-child="emits('get-active-device-child', $event)"
134
- @show-datastore-child="emits('show-datastore-child', $event)"
135
- @remove-error-by-title="emits('remove-error-by-title', $event)"
136
- @get-networks-table="emits('get-networks-table', $event)"
137
- @get-pci-devices="emits('get-pci-devices')"
138
- @change-steps="onChangeSteps"
139
- @change-template="onChangeTemplate"
140
- @change-name="onChangeName(...$event)"
141
- @change-storage="onChangeStorage"
142
- @change-select-options="onChangeSelectOptions"
143
- @change-clone-count="cloneCount = $event"
144
- @change-compatibility="onChangeCompatibility"
145
- @finish="onFinish"
146
- @hide="onHideModal"
147
- />
148
- </template>
149
-
150
- <script setup lang="ts">
151
- import type {
152
- UI_I_ValidationReturn,
153
- UI_I_WizardStep,
154
- } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
155
- import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
156
- import type {
157
- UI_I_Localization,
158
- UI_I_ArbitraryObject,
159
- } from '~/lib/models/interfaces'
160
- import type { UI_T_Project } from '~/lib/models/types'
161
- import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
162
- import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
163
- import type {
164
- UI_I_DatastoreTableItem,
165
- UI_I_FolderOrFileTreePayload,
166
- } from '~/lib/models/store/storage/interfaces'
167
- import type {
168
- // API_UI_I_Error,
169
- UI_I_ErrorValidationField,
170
- } from '~/lib/models/store/interfaces'
171
- import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
172
- import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
173
- import type {
174
- UI_T_AddVmFinishFunc,
175
- UI_T_SelectedNavItem,
176
- } from '~/components/common/vm/actions/common/lib/models/types'
177
- import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
178
- import type {
179
- UI_I_Capabilities,
180
- UI_I_CreateVmData,
181
- UI_I_VmForm,
182
- // UI_I_VmFormCash,
183
- } from '~/components/common/vm/actions/common/lib/models/interfaces'
184
- import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
185
- import type {
186
- UI_I_MediatedDevice,
187
- UI_I_PciDevice,
188
- UI_I_VmSettings,
189
- } from '~/lib/models/store/vm/interfaces'
190
- import type { UI_I_NameTestIds } from '~/components/common/wizards/common/steps/name/lib/models/interfaces'
191
- import type { UI_T_CompatibilityStatus } from '~/components/common/wizards/common/compatibility/lib/models/types'
192
- import { capabilities } from '~/components/common/vm/actions/common/lib/config/capabilities'
193
- import {
194
- stepsSchemeInitial,
195
- stepsFunc,
196
- dynamicSteps,
197
- } from '~/components/common/vm/actions/add/lib/config/steps'
198
- import { mapCapabilities } from '~/components/common/vm/actions/common/lib/utils/capabilities'
199
-
200
- const model = defineModel<UI_I_CreateVmData>({ required: true })
201
-
202
- const props = withDefaults(
203
- defineProps<{
204
- project: UI_T_Project
205
- nodes: UI_I_FileTreeNode[]
206
- files: UI_I_FileTreeNode[]
207
- networksTable: UI_I_NetworkTableItem[]
208
- datastore: UI_I_DatastoreTableItem[]
209
- isDatastoreLoading: boolean
210
- errorValidationFields: UI_I_ErrorValidationField[]
211
- readyCompleteTableInfo: UI_I_TableInfoItem[]
212
- vmCpuHelpTextSecond: string
213
- importFromVMWarevSphere: string
214
- finishFunc: UI_T_AddVmFinishFunc
215
- getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
216
- validateSendDataFunc: UI_T_AddVmFinishFunc<
217
- [UI_T_SelectedNavItem, null | number] | null
218
- >
219
- passthroughDevices: UI_I_PciDevice[]
220
- mediatedDevices: UI_I_MediatedDevice[]
221
- vmNameInWizard: string
222
- nameRequestUrl: string
223
- templatesTree?: UI_I_TreeNode[]
224
- capabilities?: UI_I_Capabilities
225
- vmtSettings?: UI_I_VmSettings | null
226
- validateEmptyName?: boolean
227
- dataCenter?: UI_I_TreeNode // для сферы
228
- computeResource?: UI_I_TreeNode // для сферы
229
- computeResourceTree?: UI_I_TreeNode[] // для сферы
230
- locationNodes?: UI_I_TreeNode[] // для сферы
231
- selectedTemplateId?: string // для сферы
232
- isVmt?: boolean // для сферы
233
- }>(),
234
- {
235
- templatesTree: [],
236
- capabilities: undefined,
237
- vmtSettings: undefined,
238
- validateEmptyName: false,
239
- dataCenter: null,
240
- computeResource: null,
241
- computeResourceTree: undefined,
242
- locationNodes: undefined,
243
- selectedTemplateId: '',
244
- isVmt: false,
245
- }
246
- )
247
-
248
- const emits = defineEmits<{
249
- (event: 'get-storage', value: UI_I_TablePayload): void
250
- (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
251
- (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
252
- (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
253
- (event: 'remove-error-by-title', value: string): void
254
- (event: 'get-networks-table', value: UI_I_TablePayload): void
255
- (event: 'get-pci-devices'): void
256
- (event: 'hide'): void
257
- (event: 'select-template', value: string): void
258
- (
259
- event: 'get-compute-resource-tree',
260
- value: { id: string | number; cb: () => void }
261
- ): void // для сферы
262
- (event: 'select-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
263
- }>()
264
-
265
- const { $store, $recursion }: any = useNuxtApp()
266
- const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
267
-
268
- const localization = computed<UI_I_Localization>(() => useLocal())
269
-
270
- const isSphere = computed<boolean>(() => props.project === 'sphere')
271
-
272
- const title = computed<string>(() =>
273
- props.isVmt
274
- ? localization.value.vmt.newTemplate
275
- : localization.value.common.newVirtualMachine2
276
- )
277
-
278
- watch(
279
- () => props.capabilities,
280
- () => {
281
- if (props.capabilities) mapCapabilities(props.capabilities)
282
- },
283
- { deep: true, immediate: true }
284
- )
285
-
286
- const selectedCreateType = ref<string>('0')
287
- if (props.isVmt) selectedCreateType.value = '-1'
288
-
289
- const wizard: Wizard = new Wizard(
290
- stepsFunc(localization.value, props.isVmt, isSphere.value),
291
- stepsSchemeInitial
292
- )
293
- watch(
294
- selectedCreateType,
295
- (newValue) => {
296
- switch (newValue) {
297
- case '0':
298
- wizard.changeScheme(isSphere.value ? 1 : 0)
299
- break
300
- case '1':
301
- wizard.changeScheme(isSphere.value ? 6 : 2)
302
- break
303
- case '-1':
304
- wizard.changeScheme(isSphere.value ? 11 : 10)
305
- break
306
- }
307
- },
308
- { immediate: true }
309
- )
310
-
311
- // if (isSphere.value) wizard.changeScheme(1)
312
- const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
313
- // const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
314
-
315
- const allowedLocationKinds = [3, 7] // TODO use from config
316
- const locationDescription = computed<string>(() =>
317
- props.isVmt
318
- ? localization.value.vmt.selectLocationTemplate
319
- : localization.value.common.selectLocationVirtualMachine
320
- )
321
-
322
- const nameTestIds: UI_I_NameTestIds = {
323
- name: 'virtual-machine-name',
324
- helpIcon: 'show-vm-name-help-icon',
325
- }
326
- const validationDescription =
327
- localization.value.common.enterValidLocationVirtualMachine
328
- const nameExistValidation =
329
- localization.value.common.vmNameExistInSelectedLocation
330
-
331
- const isShowSelectTemplate = computed<boolean>(
332
- () =>
333
- wizard.selectedStepId === dynamicSteps.selectTemplate &&
334
- selectedCreateType.value === '1'
335
- )
336
-
337
- const isShowPowerOn = computed<boolean>(
338
- () =>
339
- wizard.selectedStepId > dynamicSteps.customizeHardware &&
340
- selectedCreateType.value !== '1' &&
341
- !props.isVmt
342
- )
343
-
344
- const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
345
- wizard.changeSteps(value, validationFunc, validateSendData)
346
- }
347
- const validationFunc = async (
348
- value: UI_I_WizardStep[],
349
- currentStep: UI_I_WizardStep,
350
- nextStep: UI_I_WizardStep
351
- ): Promise<UI_I_ValidationReturn> => {
352
- let stepHasError = false
353
- let stepShouldStop = {
354
- ifOnCurrentStep: false,
355
- ifFromAnyStep: false,
356
- stoppageStepId: -1,
357
- }
358
-
359
- wizard.setLoader(true)
360
- if (
361
- wizard.isValidateForStep(
362
- dynamicSteps.selectTemplate,
363
- currentStep.id,
364
- nextStep.id
365
- )
366
- ) {
367
- const templateValidation = await checkTemplate(value)
368
-
369
- value = templateValidation.newValue
370
- stepHasError = stepHasError || templateValidation.stepHasError
371
- } else if (
372
- wizard.isValidateForStep(
373
- isSphere.value ? dynamicSteps.selectNameFolder : dynamicSteps.selectName,
374
- currentStep.id,
375
- nextStep.id
376
- )
377
- ) {
378
- const nameValidation = await onCheckName(value)
379
-
380
- value = nameValidation.newValue
381
- stepHasError = stepHasError || nameValidation.stepHasError
382
- } else if (
383
- isSphere.value &&
384
- wizard.isValidateForStep(
385
- dynamicSteps.selectComputeResource,
386
- currentStep.id,
387
- nextStep.id
388
- )
389
- ) {
390
- const computeResourceValidation = await checkComputeResource(value)
391
-
392
- value = computeResourceValidation.newValue
393
- stepHasError = stepHasError || computeResourceValidation.stepHasError
394
- } else if (
395
- wizard.isValidateForStep(
396
- dynamicSteps.selectStorage,
397
- currentStep.id,
398
- nextStep.id
399
- )
400
- ) {
401
- const storageValidation = await checkStorage(value)
402
-
403
- value = storageValidation.newValue
404
-
405
- stepHasError = stepHasError || storageValidation.stepHasError
406
- } else if (
407
- wizard.isValidateForStep(
408
- dynamicSteps.customizeHardware,
409
- currentStep.id,
410
- nextStep.id
411
- )
412
- ) {
413
- const validation = await checkCustomizeHardware(value)
414
-
415
- value = validation.newValue
416
-
417
- stepHasError = stepHasError || validation.stepHasError
418
- } else if (
419
- wizard.isValidateForStep(
420
- dynamicSteps.customizeHardwareTemplate,
421
- currentStep.id,
422
- nextStep.id
423
- )
424
- ) {
425
- const validation = await checkCustomizeHardwareForTemplate(value)
426
-
427
- value = validation.newValue
428
-
429
- stepHasError = stepHasError || validation.stepHasError
430
- }
431
- wizard.setLoader(false)
432
-
433
- return {
434
- newValue: value,
435
- stepHasError,
436
- stepShouldStop,
437
- }
438
- }
439
-
440
- const checkTemplate = async (
441
- value: UI_I_WizardStep[]
442
- ): Promise<UI_I_ValidationReturn> => {
443
- let stepHasError = false
444
-
445
- return new Promise((resolve) => {
446
- templateSubmit.value = (isValid: boolean) => {
447
- if (!isValid) {
448
- stepHasError = wizard.setValidation(
449
- dynamicSteps.selectTemplate,
450
- 'template',
451
- {
452
- fieldMessage: 'aaa',
453
- alertMessage: 'aaa',
454
- }
455
- )
456
- } else if (wizard.hasMessage(dynamicSteps.selectTemplate, 'template')) {
457
- value = wizard.removeValidation(
458
- dynamicSteps.selectTemplate,
459
- 'template',
460
- value
461
- )
462
- }
463
-
464
- resolve({
465
- stepHasError,
466
- newValue: value,
467
- })
468
- templateSubmit.value = null
469
- }
470
- })
471
- }
472
- const onCheckName = async (
473
- value: UI_I_WizardStep[]
474
- ): Promise<UI_I_ValidationReturn> => {
475
- let stepHasError = false
476
-
477
- return new Promise((resolve) => {
478
- const step = isSphere.value
479
- ? dynamicSteps.selectNameFolder
480
- : dynamicSteps.selectName
481
- nameFormSubmit.value = (isValid: boolean) => {
482
- if (!isValid) {
483
- stepHasError = wizard.setValidation(step, 'name', {
484
- fieldMessage: 'aaa',
485
- alertMessage: 'aaa',
486
- })
487
- } else if (wizard.hasMessage(step, 'name')) {
488
- value = wizard.removeValidation(step, 'name', value)
489
- }
490
-
491
- resolve({
492
- stepHasError,
493
- newValue: value,
494
- })
495
- nameFormSubmit.value = null
496
- }
497
- })
498
- }
499
- const compatibilityText = computed<[UI_T_CompatibilityStatus, string]>(() => {
500
- if (!computeResource.value)
501
- return [
502
- 'none',
503
- localization.value.vmWizard.noDestinationComputeResourceSelected,
504
- ]
505
-
506
- let res: [UI_T_CompatibilityStatus, string] = [
507
- 'success',
508
- localization.value.common.compatibilityChecksSucceeded,
509
- ]
510
-
511
- if (
512
- !['cluster', 'host', 'resource_pool'].includes(computeResource.value?.type)
513
- ) {
514
- res = [
515
- 'error',
516
- localization.value.common.selectValidClusterOrHostDestination,
517
- ]
518
- }
519
- if (computeResource.value?.type === 'cluster') {
520
- const hasHost = !!computeResource.value.nodes.length
521
- if (!hasHost) {
522
- res = ['error', localization.value.common.clusterNotContainAnyHosts]
523
- }
524
- }
525
-
526
- if (computeResource.value?.type === 'host') {
527
- if (computeResource.value.state === 'Error') {
528
- // TODO check Maintenance Mode
529
- res = [
530
- 'error',
531
- localization.value.common.selectedHostDisconnectedMaintenanceMode,
532
- ]
533
- }
534
- }
535
-
536
- return res
537
- })
538
- const computeResourceAlert = ref<string[]>([])
539
- const checkComputeResource = (
540
- value: UI_I_WizardStep[]
541
- ): UI_I_ValidationReturn => {
542
- let stepHasError = false
543
-
544
- if (
545
- !computeResource.value ||
546
- // compatibilityText.value[0] !== 1 ||
547
- computeResource.value.type === 'datacenter' ||
548
- computeResource.value.type === 'folder' ||
549
- (computeResource.value.type === 'cluster' &&
550
- !computeResource.value.nodes.length)
551
- ) {
552
- computeResourceAlert.value = [
553
- localization.value.common.specifyValidClusterOrHostDestination,
554
- ]
555
- stepHasError = wizard.setValidation(
556
- dynamicSteps.selectComputeResource,
557
- 'computeResource',
558
- {
559
- fieldMessage: 'aaa',
560
- alertMessage: 'aaa',
561
- }
562
- )
563
- } else {
564
- computeResourceAlert.value = []
565
- if (
566
- wizard.hasMessage(dynamicSteps.selectComputeResource, 'computeResource')
567
- ) {
568
- value = wizard.removeValidation(
569
- dynamicSteps.selectComputeResource,
570
- 'computeResource',
571
- value
572
- )
573
- }
574
- }
575
-
576
- return {
577
- stepHasError,
578
- newValue: value,
579
- }
580
- }
581
- const checkStorage = async (
582
- value: UI_I_WizardStep[]
583
- ): Promise<UI_I_ValidationReturn> => {
584
- let stepHasError = false
585
-
586
- return new Promise((resolve) => {
587
- storageSubmit.value = (isValid: boolean) => {
588
- if (!isValid) {
589
- stepHasError = wizard.setValidation(
590
- dynamicSteps.selectStorage,
591
- 'storage',
592
- {
593
- fieldMessage: 'aaa',
594
- alertMessage: 'aaa',
595
- }
596
- )
597
- } else if (wizard.hasMessage(dynamicSteps.selectStorage, 'storage')) {
598
- value = wizard.removeValidation(
599
- dynamicSteps.selectStorage,
600
- 'storage',
601
- value
602
- )
603
- }
604
-
605
- resolve({
606
- stepHasError,
607
- newValue: value,
608
- })
609
- storageSubmit.value = null
610
- }
611
- })
612
- }
613
- const checkCustomizeHardware = async (
614
- value: UI_I_WizardStep[]
615
- ): Promise<UI_I_ValidationReturn> => {
616
- let stepHasError = false
617
- isLoading.value = true
618
-
619
- return new Promise((resolve) => {
620
- customizeHardwareSubmit.value = (isValid: boolean) => {
621
- if (!isValid) {
622
- stepHasError = wizard.setValidation(
623
- dynamicSteps.customizeHardware,
624
- 'customizeHardware',
625
- {
626
- fieldMessage: 'aaa',
627
- alertMessage: 'aaa',
628
- }
629
- )
630
- } else if (
631
- wizard.hasMessage(dynamicSteps.customizeHardware, 'customizeHardware')
632
- ) {
633
- wizard.removeValidationLocal(
634
- dynamicSteps.customizeHardware,
635
- 'customizeHardware'
636
- )
637
- value = wizard.removeValidation(
638
- dynamicSteps.customizeHardware,
639
- 'customizeHardware',
640
- value
641
- )
642
- }
643
-
644
- resolve({
645
- stepHasError,
646
- newValue: value,
647
- })
648
- storageSubmit.value = null
649
- isLoading.value = false
650
- }
651
- })
652
- }
653
- const checkCustomizeHardwareForTemplate = async (
654
- value: UI_I_WizardStep[]
655
- ): Promise<UI_I_ValidationReturn> => {
656
- let stepHasError = false
657
-
658
- return new Promise((resolve) => {
659
- customizeHardwareForTemplateSubmit.value = (isValid: boolean) => {
660
- if (!isValid) {
661
- stepHasError = wizard.setValidation(
662
- dynamicSteps.customizeHardwareTemplate,
663
- 'customizeHardwareForTemplate',
664
- {
665
- fieldMessage: 'aaa',
666
- alertMessage: 'aaa',
667
- }
668
- )
669
- } else if (
670
- wizard.hasMessage(
671
- dynamicSteps.customizeHardwareTemplate,
672
- 'customizeHardwareForTemplate'
673
- )
674
- ) {
675
- value = wizard.removeValidation(
676
- dynamicSteps.customizeHardwareTemplate,
677
- 'customizeHardwareForTemplate',
678
- value
679
- )
680
- }
681
-
682
- resolve({
683
- stepHasError,
684
- newValue: value,
685
- })
686
- storageSubmit.value = null
687
- }
688
- })
689
- }
690
-
691
- const computeResource = ref<UI_I_TreeNode | null>(props.computeResource)
692
- const vmForm = ref<UI_I_VmForm>({
693
- locationPath: '',
694
- dataCenter: null,
695
- })
696
-
697
- const isLoadingComputeTree = ref<boolean>(false)
698
- const onChangeName = (_name: string, node: UI_I_TreeNode | null): void => {
699
- // vmForm.value.name = name // TODO уже нету смысла
700
- if (isSphere.value) {
701
- vmForm.value.locationPath = node.id
702
- vmForm.value.dataCenter = $recursion.findParentByValue(
703
- node,
704
- 'datacenter',
705
- 'type',
706
- 'parent'
707
- )
708
- isLoadingComputeTree.value = true
709
- emits('get-compute-resource-tree', {
710
- id: node.id,
711
- cb: () => {
712
- isLoadingComputeTree.value = false
713
- },
714
- })
715
- }
716
- }
717
- // Для сферы
718
- const computeResourcePath = ref<string>('')
719
- const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
720
- emits('select-compute-resource-tree', node)
721
- computeResourcePath.value = node.id
722
- }
723
- watch(
724
- computeResource,
725
- (newValue, oldValue) => {
726
- if (newValue && newValue.id !== oldValue?.id) {
727
- onSelectComputeResourceTree(newValue)
728
- }
729
- },
730
- { deep: true, immediate: true }
731
- )
732
-
733
- const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
734
- if (!storage) return
735
-
736
- // vmForm.value.storage = storage
737
- model.value.storage = storage
738
- }
739
- const compatibilityInfo = ref<string>('')
740
- const onChangeCompatibility = (compatibility: UI_I_OptionItem): void => {
741
- // vmForm.value.compatibility = compatibility.value
742
- model.value.compatibility = compatibility.value
743
-
744
- const version = compatibility.value.split('-')[1]
745
- compatibilityInfo.value = `${localization.value.common.compatibility}: ${compatibility.text} (${localization.value.common.vmVersion} ${version})`
746
- }
747
-
748
- const isPowerOnByDefault = ref<boolean>(true)
749
- const isCreateLinkedClone = ref<boolean>(false)
750
-
751
- watch(
752
- () => props.vmNameInWizard,
753
- (newValue) => {
754
- // vmForm.value.name = newValue
755
- model.value.name = newValue
756
- }
757
- )
758
-
759
- const validateSendData = async (
760
- value: UI_I_WizardStep[]
761
- ): Promise<UI_I_ValidationReturn> => {
762
- wizard.setLoader(true)
763
- let stepHasError = false
764
- isLoading.value = true
765
-
766
- const data = await props.validateSendDataFunc(
767
- model.value,
768
- isPowerOnByDefault.value,
769
- localization.value,
770
- vmForm.value.locationPath, // для сферы
771
- computeResourcePath.value, // для сферы
772
- selectedCreateType.value
773
- )
774
-
775
- isLoading.value = false
776
- wizard.setLoader(false)
777
- if (data) {
778
- stepHasError = true
779
- selectedNavItem.value = data[0]
780
- data[1] !== null && wizard.selectStepHard(data[1])
781
- }
782
-
783
- return {
784
- stepHasError,
785
- newValue: value,
786
- }
787
- }
788
-
789
- const isLoading = ref<boolean>(false)
790
- const onFinish = (): void => {
791
- isLoading.value = true
792
- wizard.setLoader(false)
793
- props
794
- .finishFunc(
795
- model.value,
796
- isPowerOnByDefault.value,
797
- localization.value,
798
- vmForm.value.locationPath, // для сферы
799
- computeResourcePath.value, // для сферы
800
- false,
801
- selectedTemplate.value,
802
- selectedCreateType.value,
803
- isCreateLinkedClone.value, // для шаблонов
804
- cloneCount.value // для шаблонов
805
- )
806
- .then(() => {
807
- onHideModal()
808
- wizard.setLoader(false)
809
- isLoading.value = false
810
- })
811
- }
812
-
813
- const selectedNavItem = ref<UI_T_SelectedNavItem>(0)
814
-
815
- const nameFormSubmit = ref<null | Function>(null)
816
- const templateSubmit = ref<null | Function>(null)
817
- const storageSubmit = ref<null | Function>(null)
818
- const customizeHardwareSubmit = ref<null | Function>(null)
819
- const customizeHardwareForTemplateSubmit = ref<null | Function>(null)
820
- const compatibility = ref<UI_I_OptionItem[]>(capabilities.value.compatibility)
821
- const guestOsFamilies = ref<UI_I_OptionItem[]>(
822
- capabilities.value.guestOsFamilies
823
- )
824
- const guestOsVersions = ref<UI_I_ArbitraryObject<UI_I_OptionItem[]>>(
825
- capabilities.value.guestOsVersions
826
- )
827
- const machineTypes = ref<UI_I_OptionItem[]>(capabilities.value.machineTypes)
828
- const cpuModels = ref<UI_I_OptionItem[]>(capabilities.value.cpuModels)
829
- model.value.cpu.max_vcpus = capabilities.value.maxCpus
830
- const maxMemory = ref<number>(capabilities.value.maxMemory)
831
-
832
- const selectedTemplate = ref<string>('')
833
- const onChangeTemplate = (node: UI_I_TreeNode): void => {
834
- selectedTemplate.value = node.id.toString()
835
- emits('select-template', node.id.toString())
836
- }
837
- const selectedOptions = ref<string[]>([])
838
- const onChangeSelectOptions = (options: string[]) => {
839
- selectedOptions.value = options
840
- if (
841
- options.includes('customize-os') &&
842
- options.includes('customize-hardware')
843
- ) {
844
- wizard.changeScheme(isSphere.value ? 9 : 5)
845
- } else if (options.includes('customize-os')) {
846
- wizard.changeScheme(isSphere.value ? 7 : 3)
847
- } else if (options.includes('customize-hardware')) {
848
- wizard.changeScheme(isSphere.value ? 8 : 4)
849
- } else {
850
- wizard.changeScheme(isSphere.value ? 6 : 2)
851
- }
852
-
853
- isPowerOnByDefault.value = options.includes('power-on')
854
- isCreateLinkedClone.value = options.includes('create-linked-clone')
855
- }
856
- const cloneCount = ref<number>(1)
857
-
858
- const onHideModal = (): void => {
859
- emits('hide')
860
- }
861
-
862
- watch(
863
- () => props.vmtSettings,
864
- (newValue) => {
865
- if (newValue) {
866
- // vmForm.value.name = newValue.name
867
- // vmForm.value.compatibility =
868
- // newValue.compatibility || vmForm.value.compatibility
869
- // vmForm.value.storage = newValue.storage
870
- // TODO remove
871
- model.value.name = newValue.name
872
- model.value.compatibility =
873
- newValue.compatibility || model.value.compatibility
874
- model.value.storage = newValue.storage
875
- // TODO remove end
876
-
877
- capabilities.value.maxCpus = newValue.cpu.max_vcpus
878
- // cpuModels.value = newValue.cpu.model
879
- isPowerOnByDefault.value = false
880
- isCreateLinkedClone.value = false
881
- }
882
- }
883
- )
884
- </script>
885
-
886
- <style scoped lang="scss"></style>
1
+ <template>
2
+ <component
3
+ :is="currentComponent"
4
+ v-model="model"
5
+ v-model:compute-resource="computeResource"
6
+ v-model:selected-create-type="selectedCreateType"
7
+ v-model:is-power-on-by-default="isPowerOnByDefault"
8
+ :project="props.project"
9
+ :is-vmt="props.isVmt"
10
+ :nodes="props.nodes"
11
+ :files="props.files"
12
+ :networks-table="props.networksTable"
13
+ :datastore="props.datastore"
14
+ :is-datastore-loading="props.isDatastoreLoading"
15
+ :error-validation-fields="props.errorValidationFields"
16
+ :ready-complete-table-info="props.readyCompleteTableInfo"
17
+ :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
18
+ :import-from-v-m-warev-sphere="props.importFromVMWarevSphere"
19
+ :get-datastore-table-func="props.getDatastoreTableFunc"
20
+ :passthrough-devices="props.passthroughDevices"
21
+ :mediated-devices="props.mediatedDevices"
22
+ :templates-tree="props.templatesTree"
23
+ :wizard="wizard"
24
+ :selected-scheme="selectedScheme"
25
+ :template-submit="templateSubmit"
26
+ :name-form-submit="nameFormSubmit"
27
+ :storage-submit="storageSubmit"
28
+ :customize-hardware-submit="customizeHardwareSubmit"
29
+ :customize-hardware-for-template-submit="customizeHardwareForTemplateSubmit"
30
+ :is-sphere="isSphere"
31
+ :compatibility="compatibility"
32
+ :guestOsFamilies="guestOsFamilies"
33
+ :guestOsVersions="guestOsVersions"
34
+ :machineTypes="machineTypes"
35
+ :max-memory="maxMemory"
36
+ :cpu-models="cpuModels"
37
+ :selected-nav-item="selectedNavItem"
38
+ :compatibility-info="compatibilityInfo"
39
+ :is-show-power-on="isShowPowerOn"
40
+ :is-show-select-template="isShowSelectTemplate"
41
+ :data-center="props.dataCenter"
42
+ :compute-resource-tree="props.computeResourceTree"
43
+ :location-nodes="props.locationNodes"
44
+ :allowed-location-kinds="allowedLocationKinds"
45
+ :location-description="locationDescription"
46
+ :vmt-settings="props.vmtSettings"
47
+ :is-loading="isLoading"
48
+ :selected-template-id="props.selectedTemplateId"
49
+ :validate-empty-name="props.validateEmptyName"
50
+ :title="title"
51
+ :name-request-url="props.nameRequestUrl"
52
+ :validation-description="validationDescription"
53
+ :name-exist-validation="nameExistValidation"
54
+ :name-test-ids="nameTestIds"
55
+ :is-loading-compute-tree="isLoadingComputeTree"
56
+ :compute-resource-alert="computeResourceAlert"
57
+ :compatibility-text="compatibilityText"
58
+ @get-storage="emits('get-storage', $event)"
59
+ @get-folders-or-files="emits('get-folders-or-files', $event)"
60
+ @get-active-device-child="emits('get-active-device-child', $event)"
61
+ @show-datastore-child="emits('show-datastore-child', $event)"
62
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
63
+ @get-networks-table="emits('get-networks-table', $event)"
64
+ @get-pci-devices="emits('get-pci-devices')"
65
+ @change-steps="onChangeSteps"
66
+ @change-template="onChangeTemplate"
67
+ @change-name="onChangeName(...$event)"
68
+ @change-storage="onChangeStorage"
69
+ @change-select-options="onChangeSelectOptions"
70
+ @change-clone-count="cloneCount = $event"
71
+ @change-compatibility="onChangeCompatibility"
72
+ @finish="onFinish"
73
+ @hide="onHideModal"
74
+ />
75
+ </template>
76
+
77
+ <script setup lang="ts">
78
+ import type {
79
+ UI_I_ValidationReturn,
80
+ UI_I_WizardStep,
81
+ } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
82
+ import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
83
+ import type {
84
+ UI_I_Localization,
85
+ UI_I_ArbitraryObject,
86
+ } from '~/lib/models/interfaces'
87
+ import type { UI_T_Project } from '~/lib/models/types'
88
+ import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
89
+ import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
90
+ import type {
91
+ UI_I_DatastoreTableItem,
92
+ UI_I_FolderOrFileTreePayload,
93
+ } from '~/lib/models/store/storage/interfaces'
94
+ import type {
95
+ // API_UI_I_Error,
96
+ UI_I_ErrorValidationField,
97
+ } from '~/lib/models/store/interfaces'
98
+ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
99
+ import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
100
+ import type {
101
+ UI_T_AddVmFinishFunc,
102
+ UI_T_SelectedNavItem,
103
+ } from '~/components/common/vm/actions/common/lib/models/types'
104
+ import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
105
+ import type {
106
+ UI_I_Capabilities,
107
+ UI_I_CreateVmData,
108
+ UI_I_VmForm,
109
+ // UI_I_VmFormCash,
110
+ } from '~/components/common/vm/actions/common/lib/models/interfaces'
111
+ import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
112
+ import type {
113
+ UI_I_MediatedDevice,
114
+ UI_I_PciDevice,
115
+ UI_I_VmSettings,
116
+ } from '~/lib/models/store/vm/interfaces'
117
+ import type { UI_I_NameTestIds } from '~/components/common/wizards/common/steps/name/lib/models/interfaces'
118
+ import type { UI_T_CompatibilityStatus } from '~/components/common/wizards/common/compatibility/lib/models/types'
119
+ import { capabilities } from '~/components/common/vm/actions/common/lib/config/capabilities'
120
+ import {
121
+ stepsSchemeInitial,
122
+ stepsFunc,
123
+ dynamicSteps,
124
+ } from '~/components/common/vm/actions/add/lib/config/steps'
125
+ import { mapCapabilities } from '~/components/common/vm/actions/common/lib/utils/capabilities'
126
+
127
+ const model = defineModel<UI_I_CreateVmData>({ required: true })
128
+
129
+ const props = withDefaults(
130
+ defineProps<{
131
+ project: UI_T_Project
132
+ nodes: UI_I_FileTreeNode[]
133
+ files: UI_I_FileTreeNode[]
134
+ networksTable: UI_I_NetworkTableItem[]
135
+ datastore: UI_I_DatastoreTableItem[]
136
+ isDatastoreLoading: boolean
137
+ errorValidationFields: UI_I_ErrorValidationField[]
138
+ readyCompleteTableInfo: UI_I_TableInfoItem[]
139
+ vmCpuHelpTextSecond: string
140
+ importFromVMWarevSphere: string
141
+ finishFunc: UI_T_AddVmFinishFunc
142
+ getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
143
+ validateSendDataFunc: UI_T_AddVmFinishFunc<
144
+ [UI_T_SelectedNavItem, null | number] | null
145
+ >
146
+ passthroughDevices: UI_I_PciDevice[]
147
+ mediatedDevices: UI_I_MediatedDevice[]
148
+ vmNameInWizard: string
149
+ nameRequestUrl: string
150
+ templatesTree?: UI_I_TreeNode[]
151
+ capabilities?: UI_I_Capabilities
152
+ vmtSettings?: UI_I_VmSettings | null
153
+ validateEmptyName?: boolean
154
+ dataCenter?: UI_I_TreeNode // для сферы
155
+ computeResource?: UI_I_TreeNode // для сферы
156
+ computeResourceTree?: UI_I_TreeNode[] // для сферы
157
+ locationNodes?: UI_I_TreeNode[] // для сферы
158
+ selectedTemplateId?: string // для сферы
159
+ isVmt?: boolean // для сферы
160
+ }>(),
161
+ {
162
+ templatesTree: [],
163
+ capabilities: undefined,
164
+ vmtSettings: undefined,
165
+ validateEmptyName: false,
166
+ dataCenter: null,
167
+ computeResource: null,
168
+ computeResourceTree: undefined,
169
+ locationNodes: undefined,
170
+ selectedTemplateId: '',
171
+ isVmt: false,
172
+ }
173
+ )
174
+
175
+ const emits = defineEmits<{
176
+ (event: 'get-storage', value: UI_I_TablePayload): void
177
+ (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
178
+ (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
179
+ (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
180
+ (event: 'remove-error-by-title', value: string): void
181
+ (event: 'get-networks-table', value: UI_I_TablePayload): void
182
+ (event: 'get-pci-devices'): void
183
+ (event: 'hide'): void
184
+ (event: 'select-template', value: string): void
185
+ (
186
+ event: 'get-compute-resource-tree',
187
+ value: { id: string | number; cb: () => void }
188
+ ): void // для сферы
189
+ (event: 'select-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
190
+ }>()
191
+
192
+ const { $store, $recursion }: any = useNuxtApp()
193
+ const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
194
+
195
+ const currentComponent = computed(() =>
196
+ isNewView.value
197
+ ? defineAsyncComponent(() => import('./New.vue'))
198
+ : defineAsyncComponent(() => import('./Old.vue'))
199
+ )
200
+
201
+ const localization = computed<UI_I_Localization>(() => useLocal())
202
+
203
+ const isSphere = computed<boolean>(() => props.project === 'sphere')
204
+
205
+ const title = computed<string>(() =>
206
+ props.isVmt
207
+ ? localization.value.vmt.newTemplate
208
+ : localization.value.common.newVirtualMachine2
209
+ )
210
+
211
+ watch(
212
+ () => props.capabilities,
213
+ () => {
214
+ if (props.capabilities) mapCapabilities(props.capabilities)
215
+ },
216
+ { deep: true, immediate: true }
217
+ )
218
+
219
+ const selectedCreateType = ref<string>('0')
220
+ if (props.isVmt) selectedCreateType.value = '-1'
221
+
222
+ const wizard: Wizard = new Wizard(
223
+ stepsFunc(localization.value, props.isVmt, isSphere.value),
224
+ stepsSchemeInitial
225
+ )
226
+ watch(
227
+ selectedCreateType,
228
+ (newValue) => {
229
+ switch (newValue) {
230
+ case '0':
231
+ wizard.changeScheme(isSphere.value ? 1 : 0)
232
+ break
233
+ case '1':
234
+ wizard.changeScheme(isSphere.value ? 6 : 2)
235
+ break
236
+ case '-1':
237
+ wizard.changeScheme(isSphere.value ? 11 : 10)
238
+ break
239
+ }
240
+ },
241
+ { immediate: true }
242
+ )
243
+
244
+ // if (isSphere.value) wizard.changeScheme(1)
245
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
246
+ // const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
247
+
248
+ const allowedLocationKinds = [3, 7] // TODO use from config
249
+ const locationDescription = computed<string>(() =>
250
+ props.isVmt
251
+ ? localization.value.vmt.selectLocationTemplate
252
+ : localization.value.common.selectLocationVirtualMachine
253
+ )
254
+
255
+ const nameTestIds: UI_I_NameTestIds = {
256
+ name: 'virtual-machine-name',
257
+ helpIcon: 'show-vm-name-help-icon',
258
+ }
259
+ const validationDescription =
260
+ localization.value.common.enterValidLocationVirtualMachine
261
+ const nameExistValidation =
262
+ localization.value.common.vmNameExistInSelectedLocation
263
+
264
+ const isShowSelectTemplate = computed<boolean>(
265
+ () =>
266
+ wizard.selectedStepId === dynamicSteps.selectTemplate &&
267
+ selectedCreateType.value === '1'
268
+ )
269
+
270
+ const isShowPowerOn = computed<boolean>(
271
+ () =>
272
+ wizard.selectedStepId > dynamicSteps.customizeHardware &&
273
+ selectedCreateType.value !== '1' &&
274
+ !props.isVmt
275
+ )
276
+
277
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
278
+ wizard.changeSteps(value, validationFunc, validateSendData)
279
+ }
280
+ const validationFunc = async (
281
+ value: UI_I_WizardStep[],
282
+ currentStep: UI_I_WizardStep,
283
+ nextStep: UI_I_WizardStep
284
+ ): Promise<UI_I_ValidationReturn> => {
285
+ let stepHasError = false
286
+ let stepShouldStop = {
287
+ ifOnCurrentStep: false,
288
+ ifFromAnyStep: false,
289
+ stoppageStepId: -1,
290
+ }
291
+
292
+ wizard.setLoader(true)
293
+ if (
294
+ wizard.isValidateForStep(
295
+ dynamicSteps.selectTemplate,
296
+ currentStep.id,
297
+ nextStep.id
298
+ )
299
+ ) {
300
+ const templateValidation = await checkTemplate(value)
301
+
302
+ value = templateValidation.newValue
303
+ stepHasError = stepHasError || templateValidation.stepHasError
304
+ } else if (
305
+ wizard.isValidateForStep(
306
+ isSphere.value ? dynamicSteps.selectNameFolder : dynamicSteps.selectName,
307
+ currentStep.id,
308
+ nextStep.id
309
+ )
310
+ ) {
311
+ const nameValidation = await onCheckName(value)
312
+
313
+ value = nameValidation.newValue
314
+ stepHasError = stepHasError || nameValidation.stepHasError
315
+ } else if (
316
+ isSphere.value &&
317
+ wizard.isValidateForStep(
318
+ dynamicSteps.selectComputeResource,
319
+ currentStep.id,
320
+ nextStep.id
321
+ )
322
+ ) {
323
+ const computeResourceValidation = await checkComputeResource(value)
324
+
325
+ value = computeResourceValidation.newValue
326
+ stepHasError = stepHasError || computeResourceValidation.stepHasError
327
+ } else if (
328
+ wizard.isValidateForStep(
329
+ dynamicSteps.selectStorage,
330
+ currentStep.id,
331
+ nextStep.id
332
+ )
333
+ ) {
334
+ const storageValidation = await checkStorage(value)
335
+
336
+ value = storageValidation.newValue
337
+
338
+ stepHasError = stepHasError || storageValidation.stepHasError
339
+ } else if (
340
+ wizard.isValidateForStep(
341
+ dynamicSteps.customizeHardware,
342
+ currentStep.id,
343
+ nextStep.id
344
+ )
345
+ ) {
346
+ const validation = await checkCustomizeHardware(value)
347
+
348
+ value = validation.newValue
349
+
350
+ stepHasError = stepHasError || validation.stepHasError
351
+ } else if (
352
+ wizard.isValidateForStep(
353
+ dynamicSteps.customizeHardwareTemplate,
354
+ currentStep.id,
355
+ nextStep.id
356
+ )
357
+ ) {
358
+ const validation = await checkCustomizeHardwareForTemplate(value)
359
+
360
+ value = validation.newValue
361
+
362
+ stepHasError = stepHasError || validation.stepHasError
363
+ }
364
+ wizard.setLoader(false)
365
+
366
+ return {
367
+ newValue: value,
368
+ stepHasError,
369
+ stepShouldStop,
370
+ }
371
+ }
372
+
373
+ const checkTemplate = async (
374
+ value: UI_I_WizardStep[]
375
+ ): Promise<UI_I_ValidationReturn> => {
376
+ let stepHasError = false
377
+
378
+ return new Promise((resolve) => {
379
+ templateSubmit.value = (isValid: boolean) => {
380
+ if (!isValid) {
381
+ stepHasError = wizard.setValidation(
382
+ dynamicSteps.selectTemplate,
383
+ 'template',
384
+ {
385
+ fieldMessage: 'aaa',
386
+ alertMessage: 'aaa',
387
+ }
388
+ )
389
+ } else if (wizard.hasMessage(dynamicSteps.selectTemplate, 'template')) {
390
+ value = wizard.removeValidation(
391
+ dynamicSteps.selectTemplate,
392
+ 'template',
393
+ value
394
+ )
395
+ }
396
+
397
+ resolve({
398
+ stepHasError,
399
+ newValue: value,
400
+ })
401
+ templateSubmit.value = null
402
+ }
403
+ })
404
+ }
405
+ const onCheckName = async (
406
+ value: UI_I_WizardStep[]
407
+ ): Promise<UI_I_ValidationReturn> => {
408
+ let stepHasError = false
409
+
410
+ return new Promise((resolve) => {
411
+ const step = isSphere.value
412
+ ? dynamicSteps.selectNameFolder
413
+ : dynamicSteps.selectName
414
+ nameFormSubmit.value = (isValid: boolean) => {
415
+ if (!isValid) {
416
+ stepHasError = wizard.setValidation(step, 'name', {
417
+ fieldMessage: 'aaa',
418
+ alertMessage: 'aaa',
419
+ })
420
+ } else if (wizard.hasMessage(step, 'name')) {
421
+ value = wizard.removeValidation(step, 'name', value)
422
+ }
423
+
424
+ resolve({
425
+ stepHasError,
426
+ newValue: value,
427
+ })
428
+ nameFormSubmit.value = null
429
+ }
430
+ })
431
+ }
432
+ const compatibilityText = computed<[UI_T_CompatibilityStatus, string]>(() => {
433
+ if (!computeResource.value)
434
+ return [
435
+ 'none',
436
+ localization.value.vmWizard.noDestinationComputeResourceSelected,
437
+ ]
438
+
439
+ let res: [UI_T_CompatibilityStatus, string] = [
440
+ 'success',
441
+ localization.value.common.compatibilityChecksSucceeded,
442
+ ]
443
+
444
+ if (
445
+ !['cluster', 'host', 'resource_pool'].includes(computeResource.value?.type)
446
+ ) {
447
+ res = [
448
+ 'error',
449
+ localization.value.common.selectValidClusterOrHostDestination,
450
+ ]
451
+ }
452
+ if (computeResource.value?.type === 'cluster') {
453
+ const hasHost = !!computeResource.value.nodes.length
454
+ if (!hasHost) {
455
+ res = ['error', localization.value.common.clusterNotContainAnyHosts]
456
+ }
457
+ }
458
+
459
+ if (computeResource.value?.type === 'host') {
460
+ if (computeResource.value.state === 'Error') {
461
+ // TODO check Maintenance Mode
462
+ res = [
463
+ 'error',
464
+ localization.value.common.selectedHostDisconnectedMaintenanceMode,
465
+ ]
466
+ }
467
+ }
468
+
469
+ return res
470
+ })
471
+ const computeResourceAlert = ref<string[]>([])
472
+ const checkComputeResource = (
473
+ value: UI_I_WizardStep[]
474
+ ): UI_I_ValidationReturn => {
475
+ let stepHasError = false
476
+
477
+ if (
478
+ !computeResource.value ||
479
+ // compatibilityText.value[0] !== 1 ||
480
+ computeResource.value.type === 'datacenter' ||
481
+ computeResource.value.type === 'folder' ||
482
+ (computeResource.value.type === 'cluster' &&
483
+ !computeResource.value.nodes.length)
484
+ ) {
485
+ computeResourceAlert.value = [
486
+ localization.value.common.specifyValidClusterOrHostDestination,
487
+ ]
488
+ stepHasError = wizard.setValidation(
489
+ dynamicSteps.selectComputeResource,
490
+ 'computeResource',
491
+ {
492
+ fieldMessage: 'aaa',
493
+ alertMessage: 'aaa',
494
+ }
495
+ )
496
+ } else {
497
+ computeResourceAlert.value = []
498
+ if (
499
+ wizard.hasMessage(dynamicSteps.selectComputeResource, 'computeResource')
500
+ ) {
501
+ value = wizard.removeValidation(
502
+ dynamicSteps.selectComputeResource,
503
+ 'computeResource',
504
+ value
505
+ )
506
+ }
507
+ }
508
+
509
+ return {
510
+ stepHasError,
511
+ newValue: value,
512
+ }
513
+ }
514
+ const checkStorage = async (
515
+ value: UI_I_WizardStep[]
516
+ ): Promise<UI_I_ValidationReturn> => {
517
+ let stepHasError = false
518
+
519
+ return new Promise((resolve) => {
520
+ storageSubmit.value = (isValid: boolean) => {
521
+ if (!isValid) {
522
+ stepHasError = wizard.setValidation(
523
+ dynamicSteps.selectStorage,
524
+ 'storage',
525
+ {
526
+ fieldMessage: 'aaa',
527
+ alertMessage: 'aaa',
528
+ }
529
+ )
530
+ } else if (wizard.hasMessage(dynamicSteps.selectStorage, 'storage')) {
531
+ value = wizard.removeValidation(
532
+ dynamicSteps.selectStorage,
533
+ 'storage',
534
+ value
535
+ )
536
+ }
537
+
538
+ resolve({
539
+ stepHasError,
540
+ newValue: value,
541
+ })
542
+ storageSubmit.value = null
543
+ }
544
+ })
545
+ }
546
+ const checkCustomizeHardware = async (
547
+ value: UI_I_WizardStep[]
548
+ ): Promise<UI_I_ValidationReturn> => {
549
+ let stepHasError = false
550
+ isLoading.value = true
551
+
552
+ return new Promise((resolve) => {
553
+ customizeHardwareSubmit.value = (isValid: boolean) => {
554
+ if (!isValid) {
555
+ stepHasError = wizard.setValidation(
556
+ dynamicSteps.customizeHardware,
557
+ 'customizeHardware',
558
+ {
559
+ fieldMessage: 'aaa',
560
+ alertMessage: 'aaa',
561
+ }
562
+ )
563
+ } else if (
564
+ wizard.hasMessage(dynamicSteps.customizeHardware, 'customizeHardware')
565
+ ) {
566
+ wizard.removeValidationLocal(
567
+ dynamicSteps.customizeHardware,
568
+ 'customizeHardware'
569
+ )
570
+ value = wizard.removeValidation(
571
+ dynamicSteps.customizeHardware,
572
+ 'customizeHardware',
573
+ value
574
+ )
575
+ }
576
+
577
+ resolve({
578
+ stepHasError,
579
+ newValue: value,
580
+ })
581
+ storageSubmit.value = null
582
+ isLoading.value = false
583
+ }
584
+ })
585
+ }
586
+ const checkCustomizeHardwareForTemplate = async (
587
+ value: UI_I_WizardStep[]
588
+ ): Promise<UI_I_ValidationReturn> => {
589
+ let stepHasError = false
590
+
591
+ return new Promise((resolve) => {
592
+ customizeHardwareForTemplateSubmit.value = (isValid: boolean) => {
593
+ if (!isValid) {
594
+ stepHasError = wizard.setValidation(
595
+ dynamicSteps.customizeHardwareTemplate,
596
+ 'customizeHardwareForTemplate',
597
+ {
598
+ fieldMessage: 'aaa',
599
+ alertMessage: 'aaa',
600
+ }
601
+ )
602
+ } else if (
603
+ wizard.hasMessage(
604
+ dynamicSteps.customizeHardwareTemplate,
605
+ 'customizeHardwareForTemplate'
606
+ )
607
+ ) {
608
+ value = wizard.removeValidation(
609
+ dynamicSteps.customizeHardwareTemplate,
610
+ 'customizeHardwareForTemplate',
611
+ value
612
+ )
613
+ }
614
+
615
+ resolve({
616
+ stepHasError,
617
+ newValue: value,
618
+ })
619
+ storageSubmit.value = null
620
+ }
621
+ })
622
+ }
623
+
624
+ const computeResource = ref<UI_I_TreeNode | null>(props.computeResource)
625
+ const vmForm = ref<UI_I_VmForm>({
626
+ locationPath: '',
627
+ dataCenter: null,
628
+ })
629
+
630
+ const isLoadingComputeTree = ref<boolean>(false)
631
+ const onChangeName = (_name: string, node: UI_I_TreeNode | null): void => {
632
+ // vmForm.value.name = name // TODO уже нету смысла
633
+ if (isSphere.value) {
634
+ vmForm.value.locationPath = node.id
635
+ vmForm.value.dataCenter = $recursion.findParentByValue(
636
+ node,
637
+ 'datacenter',
638
+ 'type',
639
+ 'parent'
640
+ )
641
+ isLoadingComputeTree.value = true
642
+ emits('get-compute-resource-tree', {
643
+ id: node.id,
644
+ cb: () => {
645
+ isLoadingComputeTree.value = false
646
+ },
647
+ })
648
+ }
649
+ }
650
+ // Для сферы
651
+ const computeResourcePath = ref<string>('')
652
+ const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
653
+ emits('select-compute-resource-tree', node)
654
+ computeResourcePath.value = node.id
655
+ }
656
+ watch(
657
+ computeResource,
658
+ (newValue, oldValue) => {
659
+ if (newValue && newValue.id !== oldValue?.id) {
660
+ onSelectComputeResourceTree(newValue)
661
+ }
662
+ },
663
+ { deep: true, immediate: true }
664
+ )
665
+
666
+ const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
667
+ if (!storage) return
668
+
669
+ // vmForm.value.storage = storage
670
+ model.value.storage = storage
671
+ }
672
+ const compatibilityInfo = ref<string>('')
673
+ const onChangeCompatibility = (compatibility: UI_I_OptionItem): void => {
674
+ // vmForm.value.compatibility = compatibility.value
675
+ model.value.compatibility = compatibility.value
676
+
677
+ const version = compatibility.value.split('-')[1]
678
+ compatibilityInfo.value = `${localization.value.common.compatibility}: ${compatibility.text} (${localization.value.common.vmVersion} ${version})`
679
+ }
680
+
681
+ const isPowerOnByDefault = ref<boolean>(true)
682
+ const isCreateLinkedClone = ref<boolean>(false)
683
+
684
+ watch(
685
+ () => props.vmNameInWizard,
686
+ (newValue) => {
687
+ // vmForm.value.name = newValue
688
+ model.value.name = newValue
689
+ }
690
+ )
691
+
692
+ const validateSendData = async (
693
+ value: UI_I_WizardStep[]
694
+ ): Promise<UI_I_ValidationReturn> => {
695
+ wizard.setLoader(true)
696
+ let stepHasError = false
697
+ isLoading.value = true
698
+
699
+ const data = await props.validateSendDataFunc(
700
+ model.value,
701
+ isPowerOnByDefault.value,
702
+ localization.value,
703
+ vmForm.value.locationPath, // для сферы
704
+ computeResourcePath.value, // для сферы
705
+ selectedCreateType.value
706
+ )
707
+
708
+ isLoading.value = false
709
+ wizard.setLoader(false)
710
+ if (data) {
711
+ stepHasError = true
712
+ selectedNavItem.value = data[0]
713
+ data[1] !== null && wizard.selectStepHard(data[1])
714
+ }
715
+
716
+ return {
717
+ stepHasError,
718
+ newValue: value,
719
+ }
720
+ }
721
+
722
+ const isLoading = ref<boolean>(false)
723
+ const onFinish = (): void => {
724
+ isLoading.value = true
725
+ wizard.setLoader(false)
726
+ props
727
+ .finishFunc(
728
+ model.value,
729
+ isPowerOnByDefault.value,
730
+ localization.value,
731
+ vmForm.value.locationPath, // для сферы
732
+ computeResourcePath.value, // для сферы
733
+ false,
734
+ selectedTemplate.value,
735
+ selectedCreateType.value,
736
+ isCreateLinkedClone.value, // для шаблонов
737
+ cloneCount.value // для шаблонов
738
+ )
739
+ .then(() => {
740
+ onHideModal()
741
+ wizard.setLoader(false)
742
+ isLoading.value = false
743
+ })
744
+ }
745
+
746
+ const selectedNavItem = ref<UI_T_SelectedNavItem>(0)
747
+
748
+ const nameFormSubmit = ref<null | Function>(null)
749
+ const templateSubmit = ref<null | Function>(null)
750
+ const storageSubmit = ref<null | Function>(null)
751
+ const customizeHardwareSubmit = ref<null | Function>(null)
752
+ const customizeHardwareForTemplateSubmit = ref<null | Function>(null)
753
+ const compatibility = ref<UI_I_OptionItem[]>(capabilities.value.compatibility)
754
+ const guestOsFamilies = ref<UI_I_OptionItem[]>(
755
+ capabilities.value.guestOsFamilies
756
+ )
757
+ const guestOsVersions = ref<UI_I_ArbitraryObject<UI_I_OptionItem[]>>(
758
+ capabilities.value.guestOsVersions
759
+ )
760
+ const machineTypes = ref<UI_I_OptionItem[]>(capabilities.value.machineTypes)
761
+ const cpuModels = ref<UI_I_OptionItem[]>(capabilities.value.cpuModels)
762
+ model.value.cpu.max_vcpus = capabilities.value.maxCpus
763
+ const maxMemory = ref<number>(capabilities.value.maxMemory)
764
+
765
+ const selectedTemplate = ref<string>('')
766
+ const onChangeTemplate = (node: UI_I_TreeNode): void => {
767
+ selectedTemplate.value = node.id.toString()
768
+ emits('select-template', node.id.toString())
769
+ }
770
+ const selectedOptions = ref<string[]>([])
771
+ const onChangeSelectOptions = (options: string[]) => {
772
+ selectedOptions.value = options
773
+ if (
774
+ options.includes('customize-os') &&
775
+ options.includes('customize-hardware')
776
+ ) {
777
+ wizard.changeScheme(isSphere.value ? 9 : 5)
778
+ } else if (options.includes('customize-os')) {
779
+ wizard.changeScheme(isSphere.value ? 7 : 3)
780
+ } else if (options.includes('customize-hardware')) {
781
+ wizard.changeScheme(isSphere.value ? 8 : 4)
782
+ } else {
783
+ wizard.changeScheme(isSphere.value ? 6 : 2)
784
+ }
785
+
786
+ isPowerOnByDefault.value = options.includes('power-on')
787
+ isCreateLinkedClone.value = options.includes('create-linked-clone')
788
+ }
789
+ const cloneCount = ref<number>(1)
790
+
791
+ const onHideModal = (): void => {
792
+ emits('hide')
793
+ }
794
+
795
+ watch(
796
+ () => props.vmtSettings,
797
+ (newValue) => {
798
+ if (newValue) {
799
+ // vmForm.value.name = newValue.name
800
+ // vmForm.value.compatibility =
801
+ // newValue.compatibility || vmForm.value.compatibility
802
+ // vmForm.value.storage = newValue.storage
803
+ // TODO remove
804
+ model.value.name = newValue.name
805
+ model.value.compatibility =
806
+ newValue.compatibility || model.value.compatibility
807
+ model.value.storage = newValue.storage
808
+ // TODO remove end
809
+
810
+ capabilities.value.maxCpus = newValue.cpu.max_vcpus
811
+ // cpuModels.value = newValue.cpu.model
812
+ isPowerOnByDefault.value = false
813
+ isCreateLinkedClone.value = false
814
+ }
815
+ }
816
+ )
817
+ </script>
818
+
819
+ <style scoped lang="scss"></style>