bfg-common 1.4.877 → 1.4.879

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