bfg-common 1.4.875 → 1.4.877

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