bfg-common 1.5.408 → 1.5.410

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 (176) hide show
  1. package/CODE_STYLE.md +109 -109
  2. package/assets/img/icons/icons-sprite-dark-3.svg +227 -227
  3. package/assets/img/icons/icons-sprite-dark-5.svg +488 -488
  4. package/assets/img/icons/icons-sprite-light-3.svg +227 -227
  5. package/assets/img/icons/icons-sprite-light-5.svg +488 -488
  6. package/assets/localization/local_be.json +11 -1
  7. package/assets/localization/local_en.json +11 -1
  8. package/assets/localization/local_hy.json +11 -1
  9. package/assets/localization/local_kk.json +11 -1
  10. package/assets/localization/local_ru.json +12 -2
  11. package/assets/localization/local_zh.json +11 -1
  12. package/components/atoms/TheIcon3.vue +50 -50
  13. package/components/atoms/collapse/CollapseNav.vue +170 -170
  14. package/components/atoms/collapse/CollapseNavItem.vue +226 -226
  15. package/components/atoms/nav/NavBar.vue +159 -159
  16. package/components/atoms/perPage/PerPage.vue +58 -58
  17. package/components/atoms/table/dataGrid/DataGrid.vue +1717 -1717
  18. package/components/atoms/table/dataGrid/DataGridColumnSwitch.vue +277 -277
  19. package/components/atoms/table/dataGrid/lib/config/settingsTable.ts +94 -94
  20. package/components/atoms/table/dataGrid/lib/utils/export.ts +16 -16
  21. package/components/atoms/tabs/VerticalTabs.vue +105 -105
  22. package/components/common/backup/storage/actions/add/lib/config/steps.ts +168 -168
  23. package/components/common/backup/storage/actions/add/steps/hostAccessibility/HostAccessibility.vue +52 -52
  24. package/components/common/backup/storage/actions/add/steps/readyComplete/ReadyComplete.vue +45 -45
  25. package/components/common/backup/storage/actions/delete/Delete.vue +65 -65
  26. package/components/common/browse/blocks/Container.vue +234 -234
  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/lib/models/interfaces.ts +33 -33
  31. package/components/common/diagramMain/adapter/AdapterItems.vue +61 -61
  32. package/components/common/diagramMain/lib/config/initial.ts +50 -50
  33. package/components/common/diagramMain/lib/models/types.ts +21 -21
  34. package/components/common/diagramMain/lib/utils/utils.ts +331 -331
  35. package/components/common/diagramMain/modals/editSettings/ConfirmTeamingSettingsModal.vue +40 -40
  36. package/components/common/diagramMain/modals/editSettings/tabs/NetworkProperties.vue +214 -214
  37. package/components/common/diagramMain/modals/editSettings/tabs/Security.vue +189 -189
  38. package/components/common/diagramMain/modals/editSettings/tabs/SwitchProperties.vue +163 -163
  39. package/components/common/diagramMain/modals/editSettings/tabs/TeamingFailover.vue +175 -175
  40. package/components/common/diagramMain/modals/editSettings/tabs/port/IpvFourSettings.vue +346 -346
  41. package/components/common/diagramMain/modals/lib/config/initial.ts +180 -180
  42. package/components/common/diagramMain/modals/lib/config/networkModal.ts +398 -398
  43. package/components/common/diagramMain/modals/lib/config/vmKernelAdapter.ts +90 -90
  44. package/components/common/diagramMain/modals/lib/mappers/mappers.ts +87 -87
  45. package/components/common/diagramMain/modals/lib/utils/index.ts +24 -24
  46. package/components/common/diagramMain/modals/migrateVmkernelAdapter/lib/config/steps.ts +114 -114
  47. package/components/common/diagramMain/modals/migrateVmkernelAdapter/steps/ConnectionSettings.vue +169 -169
  48. package/components/common/diagramMain/modals/migrateVmkernelAdapter/steps/SelectVmkernelAdapter.vue +159 -159
  49. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/common.ts +14 -14
  50. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/connectionSettings.ts +137 -137
  51. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/selectVmkernelAdapter.ts +52 -52
  52. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/validations.ts +19 -19
  53. package/components/common/diagramMain/network/Network.vue +141 -141
  54. package/components/common/diagramMain/port/Ports.vue +47 -47
  55. package/components/common/layout/theHeader/helpMenu/About.vue +82 -82
  56. package/components/common/layout/theHeader/userMenu/modals/preferences/view/ViewOld.vue +112 -112
  57. package/components/common/monitor/overview/OverviewOld.vue +139 -139
  58. package/components/common/pages/home/headline/Headline.vue +45 -45
  59. package/components/common/pages/home/headline/HeadlineOld.vue +42 -42
  60. package/components/common/pages/home/lib/models/interfaces.ts +48 -48
  61. package/components/common/pages/home/widgets/Widgets.vue +49 -49
  62. package/components/common/pages/home/widgets/WidgetsNew.vue +88 -88
  63. package/components/common/pages/home/widgets/WidgetsOld.vue +36 -36
  64. package/components/common/pages/home/widgets/hosts/Hosts.vue +27 -27
  65. package/components/common/pages/home/widgets/hosts/lib/config/items.ts +23 -23
  66. package/components/common/pages/home/widgets/vms/Vms.vue +26 -26
  67. package/components/common/pages/home/widgets/vms/VmsOld.vue +35 -35
  68. package/components/common/pages/home/widgets/vms/lib/config/items.ts +19 -19
  69. package/components/common/pages/packages/Packages.vue +208 -208
  70. package/components/common/pages/shortcuts/block/BlockOld.vue +68 -68
  71. package/components/common/readyToComplete/ReadyToComplete.vue +17 -17
  72. package/components/common/recursionTree/RecursionTree.vue +223 -223
  73. package/components/common/select/button/ButtonDropdown.vue +112 -112
  74. package/components/common/select/radio/RadioGroup.vue +137 -137
  75. package/components/common/spiceConsole/Drawer.vue +381 -381
  76. package/components/common/spiceConsole/SpiceConsole.vue +127 -127
  77. package/components/common/spiceConsole/lib/models/interfaces.ts +5 -5
  78. package/components/common/tools/Actions.vue +207 -207
  79. package/components/common/vm/actions/add/Old.vue +388 -388
  80. package/components/common/vm/actions/add/folderTreeView/FolderTreeView.vue +72 -72
  81. package/components/common/vm/actions/add/folderTreeView/New.vue +40 -40
  82. package/components/common/vm/actions/add/folderTreeView/Old.vue +50 -50
  83. package/components/common/vm/actions/clone/Clone.vue +823 -823
  84. package/components/common/vm/actions/clone/lib/config/steps.ts +291 -291
  85. package/components/common/vm/actions/clone/toTemplate/lib/config/steps.ts +116 -116
  86. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardwareOld.vue +321 -321
  87. package/components/common/vm/actions/common/customizeHardware/virtualHardware/browseView/BrowseView.vue +227 -227
  88. package/components/common/vm/actions/common/customizeHardware/virtualHardware/bus/Bus.vue +100 -100
  89. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDrive.vue +232 -232
  90. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDriveOld.vue +168 -168
  91. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/Media.vue +25 -25
  92. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/MediaNew.vue +78 -78
  93. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/MediaOld.vue +50 -50
  94. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/Shares.vue +140 -140
  95. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/lib/config/options.ts +28 -28
  96. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/tooltip/TooltipNew.vue +154 -154
  97. package/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/config/dropdownItems.ts +155 -155
  98. package/components/common/vm/actions/common/customizeHardware/virtualHardware/limit/Limit.vue +220 -220
  99. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +307 -307
  100. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +385 -385
  101. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/Location.vue +154 -154
  102. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/LocationOld.vue +85 -85
  103. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +288 -288
  104. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/new/table/lib/config/config.ts +94 -94
  105. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddress.vue +119 -119
  106. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDevice.vue +205 -205
  107. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/DirectPathIoNew.vue +66 -66
  108. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/DirectPathIoOld.vue +62 -62
  109. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/DynamicDirectPathIo.vue +31 -31
  110. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/DynamicDirectPathIoOld.vue +76 -76
  111. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/Note.vue +15 -15
  112. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/NoteNew.vue +42 -42
  113. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/NoteOld.vue +30 -30
  114. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/nvidiaGrid/NvidiaGridOld.vue +84 -84
  115. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/Other.vue +16 -16
  116. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCard.vue +154 -154
  117. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/numberDisplays/NumberDisplays.vue +53 -53
  118. package/components/common/vm/actions/common/customizeHardware/vmoptions/Vmoptions.vue +155 -155
  119. package/components/common/vm/actions/common/customizeHardware/vmoptions/VmoptionsNew.vue +130 -130
  120. package/components/common/vm/actions/common/customizeHardware/vmoptions/VmoptionsOld.vue +113 -113
  121. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/delay/Delay.vue +32 -32
  122. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/Firmware.vue +60 -60
  123. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +174 -174
  124. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +95 -95
  125. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptionsOld.vue +155 -155
  126. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +32 -32
  127. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/KeymapOld.vue +44 -44
  128. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/Password.vue +103 -103
  129. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirection.vue +28 -28
  130. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirectionOld.vue +44 -44
  131. package/components/common/vm/actions/common/select/compatibility/Old.vue +107 -107
  132. package/components/common/vm/actions/common/select/computeResource/ComputeResource.vue +143 -143
  133. package/components/common/vm/actions/common/select/computeResource/New.vue +184 -184
  134. package/components/common/vm/actions/common/select/computeResource/treeView/TreeView.vue +131 -131
  135. package/components/common/vm/actions/common/select/createType/CreateType.vue +38 -38
  136. package/components/common/vm/actions/common/select/createType/lib/config/items.ts +48 -48
  137. package/components/common/vm/actions/common/select/createType/lib/models/interfaces.ts +5 -5
  138. package/components/common/vm/actions/common/select/os/Old.vue +152 -152
  139. package/components/common/vm/actions/common/select/os/Os.vue +139 -139
  140. package/components/common/vm/actions/common/select/storage/Storage.vue +155 -155
  141. package/components/common/vm/actions/common/select/storage/new/New.vue +300 -300
  142. package/components/common/vm/actions/common/select/storage/new/lib/models/interfaces.ts +5 -5
  143. package/components/common/vm/actions/common/select/storage/new/lib/utils/utils.ts +21 -21
  144. package/components/common/vm/actions/common/select/template/old/Old.vue +50 -50
  145. package/components/common/vm/actions/editSettings/EditSettings.vue +242 -242
  146. package/components/common/vm/actions/editSettings/new/Skeleton.vue +88 -88
  147. package/components/common/vmt/actions/add/lib/models/interfaces.ts +23 -23
  148. package/components/common/wizards/datastore/add/New.vue +7 -6
  149. package/components/common/wizards/datastore/add/steps/hostAccessibility/table/new/New.vue +9 -4
  150. package/components/common/wizards/datastore/add/steps/nameAndConfigure/NameAndConfigure.vue +13 -5
  151. package/components/common/wizards/datastore/add/steps/nameAndConfigure/NameAndConfigureNew.vue +4 -0
  152. package/components/common/wizards/datastore/add/steps/nameAndDevice/NameAndDeviceNew.vue +1 -0
  153. package/components/common/wizards/datastore/add/steps/nameAndDevice/table/new/New.vue +12 -4
  154. package/components/common/wizards/datastore/add/steps/nameAndDevice/table/new/lib/models/enums.ts +1 -1
  155. package/components/common/wizards/datastore/add/steps/typeMode/lib/config/typeOptions.ts +43 -43
  156. package/components/common/wizards/network/add/steps/SelectConnectionType.vue +104 -104
  157. package/components/common/wizards/network/add/steps/SelectedTargetDevice.vue +467 -467
  158. package/components/common/wizards/vm/migrate/Migrate.vue +349 -349
  159. package/components/common/wizards/vm/migrate/lib/config/constructDataReady.ts +220 -220
  160. package/components/common/wizards/vm/migrate/lib/config/steps.ts +157 -157
  161. package/components/common/wizards/vm/migrate/lib/validations.ts +68 -68
  162. package/components/common/wizards/vm/migrate/select/network/Network.vue +103 -103
  163. package/components/common/wizards/vm/migrate/select/network/table/network/lib/config/advancedTable.ts +91 -91
  164. package/components/common/wizards/vm/migrate/select/type/lib/config/typeOptions.ts +45 -45
  165. package/composables/productNameLocal.ts +30 -30
  166. package/composables/useAppVersion.ts +21 -21
  167. package/package.json +2 -2
  168. package/plugins/date.ts +233 -233
  169. package/plugins/panelStates.ts +70 -70
  170. package/plugins/text.ts +59 -59
  171. package/public/spice-console/lib/images/bitmap.js +203 -203
  172. package/public/spice-console/network/spicechannel.js +390 -390
  173. package/store/main/mutations.ts +7 -7
  174. package/store/main/state.ts +7 -7
  175. package/store/tasks/lib/models/enums.ts +4 -4
  176. package/store/tasks/mappers/recentTasks.ts +79 -79
@@ -1,823 +1,823 @@
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 || isLoading" 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="
24
- selectedStep.id === dynamicSteps.selectName ||
25
- selectedStep.id === dynamicSteps.selectNameFolder
26
- "
27
- :show="
28
- selectedStep.id === dynamicSteps.selectName ||
29
- selectedStep.id === dynamicSteps.selectNameFolder
30
- "
31
- :name-form-submit="nameFormSubmit"
32
- :project="props.project"
33
- :data-center="props.dataCenter"
34
- @submit="onChangeName(...$event)"
35
- @check-name="emits('check-name', $event)"
36
- />
37
- <common-vm-actions-common-select-compute-resource
38
- v-if="isSphere"
39
- v-show="selectedStep.id === dynamicSteps.selectComputeResource"
40
- v-model="computeResource"
41
- :compute-resource-submit="computeResourceSubmit"
42
- :data-center="vmForm.dataCenter"
43
- :compute-resource="props.computeResource"
44
- :compute-resource-tree="props.computeResourceTree"
45
- @submit="onChangeComputeResource"
46
- @select-compute-resource-tree="onSelectComputeResourceTree"
47
- @get-compute-resource-tree="
48
- emits('get-compute-resource-tree', $event)
49
- "
50
- @show-compute-resource-tree="
51
- emits('show-compute-resource-tree', $event)
52
- "
53
- @clear-compute-resource-tree="emits('clear-compute-resource-tree')"
54
- />
55
- <common-vm-actions-common-select-storage
56
- v-show="selectedStep.id === dynamicSteps.selectStorage"
57
- :storage-submit="storageSubmit"
58
- :datastore="props.datastore"
59
- :is-datastore-loading="props.isDatastoreLoading"
60
- :storage="vmForm.storage"
61
- :get-datastore-table-func="props.getDatastoreTableFunc"
62
- @submit="onChangeStorage"
63
- />
64
- <common-vm-actions-common-select-options
65
- v-show="selectedStep.id === dynamicSteps.selectOptions"
66
- :is-create-template="props.isNewVmFromTemplate"
67
- @change="onChangeSelectOptions"
68
- />
69
- <common-vm-actions-common-select-os
70
- v-show="selectedStep.id === dynamicSteps.selectGuestOSMachineType"
71
- v-model:machine-type="vmForm.guestMachineType"
72
- v-model:guest-os-family="vmForm.guestOsFamily"
73
- v-model:guest-os-version="vmForm.guestOsVersion"
74
- :families-options="guestOsFamilies"
75
- :versions-options="guestOsVersions"
76
- :machine-types-options="machineTypes"
77
- :error-validation-fields="props.errorValidationFields"
78
- @remove-error-by-title="emits('remove-error-by-title', $event)"
79
- />
80
- <common-vm-actions-common-customize-hardware
81
- v-show="selectedStep.id === dynamicSteps.customizeHardware"
82
- v-model:vm-name="vmName"
83
- v-model:guest-machine-type="vmSettings.guestMachineType"
84
- v-model:guest-os-family="vmSettings.guestOsFamily"
85
- v-model:guest-os-version="vmSettings.guestOsVersion"
86
- :storage="vmForm.storage"
87
- :hard-disks-for-boot-options="virtualHardwareHardDisksLocal"
88
- :cd-dvd-drives-for-boot-options="virtualHardwareCdDvdDrivesLocal"
89
- :networks-for-boot-options="virtualHardwareNetworksLocal"
90
- :cd-dvd-drives="vmSettings.cdDvdDrives"
91
- :hard-disks="vmSettings.hardDisks"
92
- :networks="vmSettings.networks"
93
- :customize-hardware-submit="customizeHardwareSubmit"
94
- :max-cpus="vmSettings.maxCpus"
95
- :max-memory="vmSettings.maxMemory"
96
- :cpu-models="vmSettings.cpuModels"
97
- :cpu="vmSettings.cpu"
98
- :memory="vmSettings.memory"
99
- :video-card="vmSettings.videoCard"
100
- :usb-controller="vmSettings.usbController"
101
- :pci-devices="vmSettings.pciDevices"
102
- :selected-nav-item="selectedNavItem"
103
- :hard-disks-for-edit="vmSettings.hardDisks"
104
- :options="vmSettings.options"
105
- :nodes="props.nodes"
106
- :files="props.files"
107
- :networks-table="props.networksTable"
108
- :error-validation-fields="props.errorValidationFields"
109
- :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
110
- :passthrough-devices="props.passthroughDevices"
111
- :mediated-devices="props.mediatedDevices"
112
- :get-datastore-table-func="props.getDatastoreTableFunc"
113
- :datastore="props.datastore"
114
- :is-datastore-loading="props.isDatastoreLoading"
115
- :project="props.project"
116
- is-clone
117
- @change-boot-order="onChangeBootOrder"
118
- @send-data="onChangeCustomizeHardware"
119
- @get-storage="emits('get-storage', $event)"
120
- @get-folders-or-files="emits('get-folders-or-files', $event)"
121
- @get-active-device-child="emits('get-active-device-child', $event)"
122
- @show-datastore-child="emits('show-datastore-child', $event)"
123
- @get-networks-table="emits('get-networks-table', $event)"
124
- @get-pci-devices="emits('get-pci-devices')"
125
- />
126
- <common-ready-to-complete
127
- v-show="selectedStep.id === dynamicSteps.readyComplete"
128
- :data="props.readyCompleteTableInfo"
129
- />
130
- </div>
131
- </template>
132
- </atoms-wizard>
133
- </div>
134
- </template>
135
-
136
- <script setup lang="ts">
137
- import type {
138
- UI_I_DatastoreTableItem,
139
- UI_I_FolderOrFileTreePayload,
140
- } from '~/lib/models/store/storage/interfaces'
141
- import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
142
- import type { API_UI_I_Error } from '~/lib/models/store/interfaces'
143
- import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
144
- import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
145
- import type {
146
- UI_I_ArbitraryObject,
147
- UI_I_Localization,
148
- } from '~/lib/models/interfaces'
149
- import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
150
- import type { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
151
- import type {
152
- UI_I_SendDataCpu,
153
- UI_I_SendDataMemory,
154
- UI_I_SendDataNewCdDvdDrive,
155
- UI_I_SendDataNewHardDisk,
156
- UI_I_SendDataNewNetwork,
157
- } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
158
- import type { UI_T_SelectedNavItem } from '~/components/common/vm/actions/common/lib/models/types'
159
- import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
160
- import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/models/types'
161
- import type { UI_T_Project } from '~/lib/models/types'
162
- import type {
163
- UI_I_MediatedDevice,
164
- UI_I_PciDevice,
165
- UI_I_VmSettings,
166
- } from '~/lib/models/store/vm/interfaces'
167
- import type { UI_I_VmForm } from '~/components/common/vm/actions/common/lib/models/interfaces'
168
- import type {
169
- UI_I_ValidationReturn,
170
- UI_I_WizardStep,
171
- } from '~/components/atoms/wizard/lib/models/interfaces'
172
- import type { UI_I_Capabilities } from '~/components/common/vm/actions/common/lib/models/interfaces'
173
- import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
174
- import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
175
- import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
176
- import {
177
- stepsSchemeInitial,
178
- stepsFunc,
179
- dynamicSteps,
180
- } from '~/components/common/vm/actions/clone/lib/config/steps'
181
- import Wizard from '~/components/atoms/wizard/lib/utils/utils'
182
- import { mapCapabilities } from '~/components/common/vm/actions/common/lib/utils/capabilities'
183
- import { scheduledTaskDefaultFormFunc } from '~/components/common/pages/scheduledTasks/modals/lib/config/createScheduledTask'
184
- import { capabilities } from '~/components/common/vm/actions/common/lib/config/capabilities'
185
-
186
- const props = defineProps<{
187
- project: UI_T_Project
188
- vmSettings: UI_I_VmSettings | null
189
- nodes: UI_I_FileTreeNode[]
190
- files: UI_I_FileTreeNode[]
191
- networksTable: UI_I_NetworkTableItem[]
192
- datastore: UI_I_DatastoreTableItem[]
193
- isDatastoreLoading: boolean
194
- errorValidationFields: UI_I_ErrorValidationField[]
195
- readyCompleteTableInfo: UI_I_TableInfoItem[]
196
- vmCpuHelpTextSecond: string
197
- finishFunc: any
198
- getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
199
- validateSendDataFunc: any
200
- passthroughDevices: UI_I_PciDevice[]
201
- mediatedDevices: UI_I_MediatedDevice[]
202
- vmNameInWizard: string
203
- capabilities?: UI_I_Capabilities
204
- schedulerTask?: any // TODO надо interface переместить глобално
205
- selectedVirtualMachine?: UI_I_Capabilities
206
- isNewVmFromTemplate?: boolean
207
- dataCenter?: UI_I_TreeNode // для сферы
208
- computeResource?: UI_I_TreeNode // для сферы
209
- computeResourceTree?: UI_I_TreeNode[] // для сферы
210
- }>()
211
-
212
- const emits = defineEmits<{
213
- (event: 'check-name', value: [string, (error: API_UI_I_Error) => void]): void
214
- (event: 'get-storage', value: UI_I_TablePayload): void
215
- (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
216
- (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
217
- (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
218
- (event: 'remove-error-by-title', value: string): void
219
- (event: 'get-networks-table', value: UI_I_TablePayload): void
220
- (event: 'get-pci-devices'): void
221
- (event: 'hide'): void
222
- (
223
- event: 'get-compute-resource-tree',
224
- value: { id: string | number; cb: () => void }
225
- ): void // для сферы
226
- (event: 'show-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
227
- (event: 'select-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
228
- (event: 'clear-compute-resource-tree'): void // для сферы
229
- }>()
230
-
231
- const { $recursion } = useNuxtApp()
232
-
233
- const localization = computed<UI_I_Localization>(() => useLocal())
234
-
235
- const isSphere = computed<boolean>(() => props.project === 'sphere')
236
-
237
- const isScheduledTasks = computed<boolean>(
238
- () => props.schedulerTask?.isSchedulerTask
239
- )
240
-
241
- const title = computed<string>(() => {
242
- const { scheduleNewTasks, scheduleTaskEdit, cloneExistingVirtualMachine } =
243
- localization.value.common
244
-
245
- let result = cloneExistingVirtualMachine
246
- if (isScheduledTasks.value) {
247
- const schedulerMode = props.schedulerTask.editTask
248
- ? scheduleTaskEdit
249
- : scheduleNewTasks
250
-
251
- result = `${schedulerMode} (${cloneExistingVirtualMachine})`
252
- }
253
-
254
- if (props.isNewVmFromTemplate) {
255
- result = localization.value.vmWizard.deployFromTemplate
256
- }
257
-
258
- return result
259
- })
260
-
261
- watch(
262
- () => props.capabilities,
263
- () => {
264
- if (props.capabilities) {
265
- mapCapabilities(props.capabilities)
266
- }
267
- },
268
- { deep: true, immediate: true }
269
- )
270
-
271
- const wizard: Wizard = new Wizard(
272
- stepsFunc(localization.value),
273
- stepsSchemeInitial
274
- )
275
- watch(
276
- isScheduledTasks,
277
- (newValue) => {
278
- if (newValue) {
279
- wizard.changeScheme(isSphere.value ? 12 : 4)
280
- } else {
281
- wizard.changeScheme(isSphere.value ? 8 : 0)
282
- wizard.selectStepHard(isSphere.value ? 2 : 1)
283
- }
284
- },
285
- { immediate: true }
286
- )
287
-
288
- // TODO move to common
289
- const newTaskForm = ref<UI_I_ScheduleNewTasksForm>(
290
- useDeepCopy(scheduledTaskDefaultFormFunc())
291
- )
292
- watch(
293
- newTaskForm,
294
- (newValue: UI_I_ScheduleNewTasksForm) => {
295
- if (isScheduledTasks.value) wizard.setDisabledNextButton(newValue.isValid)
296
- },
297
- { immediate: true, deep: true }
298
- )
299
-
300
- const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
301
-
302
- const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
303
- wizard.changeSteps(value, validationFunc, validateSendData)
304
- }
305
-
306
- const validationFunc = async (
307
- value: UI_I_WizardStep[],
308
- currentStep: UI_I_WizardStep,
309
- nextStep: UI_I_WizardStep
310
- ): Promise<UI_I_ValidationReturn> => {
311
- let stepHasError = false
312
- let stepShouldStop = {
313
- ifOnCurrentStep: false,
314
- ifFromAnyStep: false,
315
- stoppageStepId: -1,
316
- }
317
-
318
- wizard.setLoader(true)
319
- if (
320
- wizard.isValidateForStep(
321
- isSphere.value ? dynamicSteps.selectNameFolder : dynamicSteps.selectName,
322
- currentStep.id,
323
- nextStep.id
324
- )
325
- ) {
326
- const nameValidation = await checkName(value)
327
-
328
- value = nameValidation.newValue
329
- stepHasError = stepHasError || nameValidation.stepHasError
330
- } else if (
331
- isSphere.value &&
332
- wizard.isValidateForStep(
333
- dynamicSteps.selectComputeResource,
334
- currentStep.id,
335
- nextStep.id
336
- )
337
- ) {
338
- const computeResourceValidation = await checkComputeResource(value)
339
-
340
- value = computeResourceValidation.newValue
341
- stepHasError = stepHasError || computeResourceValidation.stepHasError
342
- } else if (
343
- wizard.isValidateForStep(
344
- dynamicSteps.selectStorage,
345
- currentStep.id,
346
- nextStep.id
347
- )
348
- ) {
349
- const storageValidation = await checkStorage(value)
350
-
351
- value = storageValidation.newValue
352
-
353
- stepHasError = stepHasError || storageValidation.stepHasError
354
- } else if (
355
- wizard.isValidateForStep(
356
- dynamicSteps.customizeHardware,
357
- currentStep.id,
358
- nextStep.id
359
- )
360
- ) {
361
- const customizeHardwareValidation = await checkCustomizeHardware(value)
362
-
363
- value = customizeHardwareValidation.newValue
364
-
365
- stepHasError = stepHasError || customizeHardwareValidation.stepHasError
366
- }
367
- wizard.setLoader(false)
368
-
369
- return {
370
- newValue: value,
371
- stepHasError,
372
- stepShouldStop,
373
- }
374
- }
375
- const checkName = async (
376
- value: UI_I_WizardStep[]
377
- ): Promise<UI_I_ValidationReturn> => {
378
- let stepHasError = false
379
-
380
- return new Promise((resolve) => {
381
- const step = isSphere.value
382
- ? dynamicSteps.selectNameFolder
383
- : dynamicSteps.selectName
384
- nameFormSubmit.value = (isValid: boolean) => {
385
- if (!isValid) {
386
- stepHasError = wizard.setValidation(step, 'name', {
387
- fieldMessage: 'aaa',
388
- alertMessage: 'aaa',
389
- })
390
- } else if (wizard.hasMessage(step, 'name')) {
391
- value = wizard.removeValidation(step, 'name', value)
392
- }
393
-
394
- resolve({
395
- stepHasError,
396
- newValue: value,
397
- })
398
- nameFormSubmit.value = null
399
- }
400
- })
401
- }
402
- const checkComputeResource = async (
403
- value: UI_I_WizardStep[]
404
- ): Promise<UI_I_ValidationReturn> => {
405
- let stepHasError = false
406
-
407
- return new Promise((resolve) => {
408
- computeResourceSubmit.value = (isValid: boolean) => {
409
- if (!isValid) {
410
- stepHasError = wizard.setValidation(
411
- dynamicSteps.selectComputeResource,
412
- 'computeResource',
413
- {
414
- fieldMessage: 'aaa',
415
- alertMessage: 'aaa',
416
- }
417
- )
418
- } else if (
419
- wizard.hasMessage(dynamicSteps.selectComputeResource, 'computeResource')
420
- ) {
421
- value = wizard.removeValidation(
422
- dynamicSteps.selectComputeResource,
423
- 'computeResource',
424
- value
425
- )
426
- }
427
-
428
- resolve({
429
- stepHasError,
430
- newValue: value,
431
- })
432
- computeResourceSubmit.value = null
433
- }
434
- })
435
- }
436
- const checkStorage = async (
437
- value: UI_I_WizardStep[]
438
- ): Promise<UI_I_ValidationReturn> => {
439
- let stepHasError = false
440
-
441
- return new Promise((resolve) => {
442
- storageSubmit.value = (isValid: boolean) => {
443
- if (!isValid) {
444
- stepHasError = wizard.setValidation(
445
- dynamicSteps.selectStorage,
446
- 'storage',
447
- {
448
- fieldMessage: 'aaa',
449
- alertMessage: 'aaa',
450
- }
451
- )
452
- } else if (wizard.hasMessage(dynamicSteps.selectStorage, 'storage')) {
453
- value = wizard.removeValidation(
454
- dynamicSteps.selectStorage,
455
- 'storage',
456
- value
457
- )
458
- }
459
-
460
- resolve({
461
- stepHasError,
462
- newValue: value,
463
- })
464
- storageSubmit.value = null
465
- }
466
- })
467
- }
468
- const checkCustomizeHardware = async (
469
- value: UI_I_WizardStep[]
470
- ): Promise<UI_I_ValidationReturn> => {
471
- let stepHasError = false
472
-
473
- return new Promise((resolve) => {
474
- customizeHardwareSubmit.value = (isValid: boolean) => {
475
- if (!isValid) {
476
- stepHasError = wizard.setValidation(
477
- dynamicSteps.customizeHardware,
478
- 'customizeHardware',
479
- {
480
- fieldMessage: 'aaa',
481
- alertMessage: 'aaa',
482
- }
483
- )
484
- } else if (
485
- wizard.hasMessage(dynamicSteps.customizeHardware, 'customizeHardware')
486
- ) {
487
- value = wizard.removeValidation(
488
- dynamicSteps.customizeHardware,
489
- 'customizeHardware',
490
- value
491
- )
492
- }
493
-
494
- resolve({
495
- stepHasError,
496
- newValue: value,
497
- })
498
- storageSubmit.value = null
499
- }
500
- })
501
- }
502
-
503
- const vmForm = ref<UI_I_VmForm>({
504
- name: '',
505
- compatibility: '',
506
- guestMachineType: null,
507
- guestOsFamily: null,
508
- guestOsVersion: null,
509
- computeResource: null,
510
- storage: null,
511
- locationPath: '',
512
- dataCenter: null,
513
- options: [],
514
- })
515
- const onChangeName = (name: string, node: UI_I_TreeNode): void => {
516
- vmForm.value.name = name
517
- if (isSphere.value) {
518
- vmForm.value.locationPath = node.id
519
- vmForm.value.dataCenter = $recursion.findParentByValue(
520
- node,
521
- 'datacenter',
522
- 'type',
523
- 'parent'
524
- )
525
- }
526
- }
527
- const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
528
- if (!storage) return
529
-
530
- vmForm.value.storage = storage
531
- }
532
- const onChangeSelectOptions = (options: string[]): void => {
533
- vmForm.value.options = options
534
- if (
535
- options.includes('customize-os') &&
536
- options.includes('customize-hardware')
537
- ) {
538
- let procuratorSchame = isScheduledTasks.value ? 7 : 3
539
- let sphereSchame = isScheduledTasks.value ? 15 : 11
540
- wizard.changeScheme(isSphere.value ? sphereSchame : procuratorSchame)
541
- } else if (options.includes('customize-os')) {
542
- let procuratorSchame = isScheduledTasks.value ? 5 : 1
543
- let sphereSchame = isScheduledTasks.value ? 13 : 9
544
- wizard.changeScheme(isSphere.value ? sphereSchame : procuratorSchame)
545
- } else if (options.includes('customize-hardware')) {
546
- let procuratorSchame = isScheduledTasks.value ? 6 : 2
547
- let sphereSchame = isScheduledTasks.value ? 14 : 10
548
- wizard.changeScheme(isSphere.value ? sphereSchame : procuratorSchame)
549
- } else {
550
- let procuratorSchame = isScheduledTasks.value ? 4 : 0
551
- let sphereSchame = isScheduledTasks.value ? 12 : 8
552
- wizard.changeScheme(isSphere.value ? sphereSchame : procuratorSchame)
553
- }
554
-
555
- // Change power on by default
556
- isPowerOnByDefault.value = options.includes('power-on')
557
- }
558
- const customizeHardware = ref<UI_I_SendDataCustomizeHardware | null>(null)
559
- const onChangeCustomizeHardware = (
560
- data: UI_I_SendDataCustomizeHardware
561
- ): void => {
562
- customizeHardware.value = data
563
- }
564
-
565
- const virtualHardwareHardDisksLocal = computed<
566
- UI_I_SendDataNewHardDisk[] | null
567
- >(() => customizeHardware.value?.virtualHardware?.hardDisks || null)
568
- const virtualHardwareNetworksLocal = computed<UI_I_SendDataNewNetwork[] | null>(
569
- () => customizeHardware.value?.virtualHardware?.networks || null
570
- )
571
- const virtualHardwareCdDvdDrivesLocal = computed<
572
- UI_I_SendDataNewCdDvdDrive[] | null
573
- >(() => customizeHardware.value?.virtualHardware?.cdDvdDrives || null)
574
-
575
- const virtualHardwareCpu = computed<UI_I_SendDataCpu | null>(
576
- () => customizeHardware.value?.virtualHardware?.cpu || null
577
- )
578
- const virtualHardwareMemory = computed<UI_I_SendDataMemory | null>(
579
- () => customizeHardware.value?.virtualHardware?.memory || null
580
- )
581
- const virtualHardwareHardDisks = ref<UI_I_SendDataNewHardDisk[] | null>(null)
582
- const virtualHardwareCdDvdDrives = ref<UI_I_SendDataNewCdDvdDrive[] | null>(
583
- null
584
- )
585
- const virtualHardwareNetworks = ref<UI_I_SendDataNewNetwork[] | null>(null)
586
- const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
587
- virtualHardwareHardDisks.value = data[0]
588
- virtualHardwareCdDvdDrives.value = data[1]
589
- virtualHardwareNetworks.value = data[2]
590
- }
591
-
592
- const isPowerOnByDefault = ref<boolean>(false)
593
-
594
- watch(
595
- () => props.vmNameInWizard,
596
- (newValue) => {
597
- vmForm.value.name = newValue
598
- }
599
- )
600
-
601
- const validateSendData = async (
602
- value: UI_I_WizardStep[]
603
- ): Promise<UI_I_ValidationReturn> => {
604
- wizard.setLoader(true)
605
- let stepHasError = false
606
-
607
- const data = await props.validateSendDataFunc(
608
- vmForm.value,
609
- virtualHardwareCpu.value,
610
- virtualHardwareMemory.value,
611
- customizeHardware.value,
612
- virtualHardwareNetworks.value,
613
- virtualHardwareHardDisks.value,
614
- virtualHardwareCdDvdDrives.value,
615
- isPowerOnByDefault.value,
616
- localization.value,
617
- vmForm.value.locationPath, // для сферы
618
- // computeResourcePath.value // для сферы
619
- vmSettings.value.host_id // для сферы // TODO rollback
620
- )
621
-
622
- wizard.setLoader(false)
623
- if (data) {
624
- stepHasError = true
625
- selectedNavItem.value = data[0]
626
- }
627
-
628
- return {
629
- stepHasError,
630
- newValue: value,
631
- }
632
- }
633
-
634
- const isLoading = ref<boolean>(false)
635
- const onFinish = (): void => {
636
- isLoading.value = true
637
- wizard.setLoader(false)
638
- props
639
- .finishFunc(
640
- vmForm.value,
641
- virtualHardwareCpu.value,
642
- virtualHardwareMemory.value,
643
- customizeHardware.value,
644
- virtualHardwareNetworks.value,
645
- virtualHardwareHardDisks.value,
646
- virtualHardwareCdDvdDrives.value,
647
- isPowerOnByDefault.value,
648
- localization.value,
649
- vmForm.value.locationPath, // для сферы
650
- // computeResourcePath.value, // для сферы
651
- vmSettings.value.host_id, // для сферы // TODO rollback
652
- false,
653
- newTaskForm.value,
654
- props.schedulerTask
655
- )
656
- .then(() => {
657
- isLoading.value = false
658
- onHideModal()
659
- wizard.setLoader(false)
660
- })
661
- }
662
-
663
- const selectedNavItem = ref<UI_T_SelectedNavItem>(0)
664
-
665
- const nameFormSubmit = ref<null | Function>(null)
666
- const computeResourceSubmit = ref<null | Function>(null)
667
- const storageSubmit = ref<null | Function>(null)
668
- const customizeHardwareSubmit = ref<null | Function>(null)
669
-
670
- const vmSettings = computed<UI_I_VmSettings | null>(() => props.vmSettings)
671
- const vmName = ref<string>(vmSettings.value?.name || '')
672
-
673
- const guestOsFamilies = ref<UI_I_OptionItem[]>(
674
- capabilities.value.guestOsFamilies
675
- )
676
- const guestOsVersions = ref<UI_I_ArbitraryObject<UI_I_OptionItem[]>>(
677
- capabilities.value.guestOsVersions
678
- )
679
- const machineTypes = ref<UI_I_OptionItem[]>(capabilities.value.machineTypes)
680
-
681
- const computeResource = ref<UI_I_TreeNode | null>(null)
682
- const onChangeComputeResource = (node: UI_I_TreeNode): void => {
683
- computeResource.value = node
684
- }
685
- // // Для сферы
686
- const computeResourcePath = ref<string>('')
687
- const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
688
- emits('select-compute-resource-tree', node)
689
- computeResourcePath.value = node.id
690
- }
691
-
692
- watch(vmSettings, (newValue) => {
693
- vmName.value = newValue?.name || ''
694
-
695
- if (newValue?.guestOsFamily)
696
- vmForm.value.guestOsFamily = newValue.guestOsFamily
697
- if (newValue?.guestMachineType)
698
- vmForm.value.guestMachineType = newValue.guestMachineType
699
- if (newValue?.guestOsVersion)
700
- vmForm.value.guestOsVersion = newValue.guestOsVersion
701
-
702
- if (newValue?.compatibility)
703
- vmForm.value.compatibility = newValue.compatibility
704
-
705
- if (newValue?.storage) {
706
- const datastore = props.datastore.find(
707
- (item) => item.id === newValue.storage.id
708
- )
709
- if (datastore) vmForm.value.storage = datastore
710
- }
711
- })
712
-
713
- const onHideModal = (): void => {
714
- emits('hide')
715
- }
716
- </script>
717
-
718
- <style scoped lang="scss">
719
- :deep(.has-solid.close-icon.clr-icon) {
720
- width: 20px;
721
- top: 0;
722
- }
723
- .vm-context {
724
- padding: 16px 15px 10px 10px;
725
- height: 100%;
726
- display: flex;
727
- flex-direction: column;
728
-
729
- .context-title-wrap {
730
- padding-bottom: 3px;
731
- border-bottom: 1px solid #a6a6a6;
732
-
733
- h4 {
734
- font-weight: 700;
735
- font-size: 13px;
736
- color: var(--vm-context-title);
737
- }
738
- p {
739
- font-weight: 400;
740
- font-size: 13px;
741
- color: var(--vm-context-sub-title);
742
- }
743
- }
744
-
745
- .finish-block {
746
- padding: 18px 24px 24px 24px;
747
-
748
- .add-hosts-ready-to-complete-mt-12 {
749
- margin-top: 12px;
750
-
751
- .add-hosts-ready-to-complete-bold {
752
- line-height: 18px;
753
- font-weight: 700;
754
- }
755
- }
756
- }
757
-
758
- .vm-hardware-version {
759
- align-self: flex-end;
760
- margin-top: auto;
761
- }
762
- }
763
-
764
- :deep(.modal .modal-dialog .modal-content .modal-footer) {
765
- flex: unset;
766
- height: unset;
767
- min-height: unset;
768
- }
769
- :deep(.wizard-modal-titlebar h3) {
770
- color: #000;
771
- font-size: 24px;
772
- font-weight: 200;
773
- line-height: 27px;
774
- margin: 0;
775
- padding: 0;
776
- }
777
- :deep(.clr-wizard-stepnav-item) {
778
- padding-left: 0;
779
- }
780
- :deep(.clr-wizard-stepnav
781
- .clr-wizard-stepnav-item
782
- button
783
- .clr-wizard-stepnav-link-title) {
784
- width: 189px;
785
- font-weight: 700;
786
- font-size: 13px;
787
- }
788
-
789
- #vm-wizard-notification {
790
- h3 {
791
- color: var(--global-font-color7);
792
- margin-top: 6px;
793
- }
794
- p {
795
- color: var(--global-font-color6);
796
- line-height: 16px;
797
- }
798
- }
799
-
800
- .power-on-by-default-wrap {
801
- display: flex;
802
- align-items: center;
803
-
804
- input {
805
- margin-right: 6px;
806
- }
807
- }
808
-
809
- .new-task-form {
810
- padding: 0 25px 0 5px;
811
- }
812
- </style>
813
-
814
- <style>
815
- :root {
816
- --vm-context-title: #333;
817
- --vm-context-sub-title: #000;
818
- }
819
- :root.dark-theme {
820
- --vm-context-title: #adbbc4;
821
- --vm-context-sub-title: #adbbc4;
822
- }
823
- </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 || isLoading" 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="
24
+ selectedStep.id === dynamicSteps.selectName ||
25
+ selectedStep.id === dynamicSteps.selectNameFolder
26
+ "
27
+ :show="
28
+ selectedStep.id === dynamicSteps.selectName ||
29
+ selectedStep.id === dynamicSteps.selectNameFolder
30
+ "
31
+ :name-form-submit="nameFormSubmit"
32
+ :project="props.project"
33
+ :data-center="props.dataCenter"
34
+ @submit="onChangeName(...$event)"
35
+ @check-name="emits('check-name', $event)"
36
+ />
37
+ <common-vm-actions-common-select-compute-resource
38
+ v-if="isSphere"
39
+ v-show="selectedStep.id === dynamicSteps.selectComputeResource"
40
+ v-model="computeResource"
41
+ :compute-resource-submit="computeResourceSubmit"
42
+ :data-center="vmForm.dataCenter"
43
+ :compute-resource="props.computeResource"
44
+ :compute-resource-tree="props.computeResourceTree"
45
+ @submit="onChangeComputeResource"
46
+ @select-compute-resource-tree="onSelectComputeResourceTree"
47
+ @get-compute-resource-tree="
48
+ emits('get-compute-resource-tree', $event)
49
+ "
50
+ @show-compute-resource-tree="
51
+ emits('show-compute-resource-tree', $event)
52
+ "
53
+ @clear-compute-resource-tree="emits('clear-compute-resource-tree')"
54
+ />
55
+ <common-vm-actions-common-select-storage
56
+ v-show="selectedStep.id === dynamicSteps.selectStorage"
57
+ :storage-submit="storageSubmit"
58
+ :datastore="props.datastore"
59
+ :is-datastore-loading="props.isDatastoreLoading"
60
+ :storage="vmForm.storage"
61
+ :get-datastore-table-func="props.getDatastoreTableFunc"
62
+ @submit="onChangeStorage"
63
+ />
64
+ <common-vm-actions-common-select-options
65
+ v-show="selectedStep.id === dynamicSteps.selectOptions"
66
+ :is-create-template="props.isNewVmFromTemplate"
67
+ @change="onChangeSelectOptions"
68
+ />
69
+ <common-vm-actions-common-select-os
70
+ v-show="selectedStep.id === dynamicSteps.selectGuestOSMachineType"
71
+ v-model:machine-type="vmForm.guestMachineType"
72
+ v-model:guest-os-family="vmForm.guestOsFamily"
73
+ v-model:guest-os-version="vmForm.guestOsVersion"
74
+ :families-options="guestOsFamilies"
75
+ :versions-options="guestOsVersions"
76
+ :machine-types-options="machineTypes"
77
+ :error-validation-fields="props.errorValidationFields"
78
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
79
+ />
80
+ <common-vm-actions-common-customize-hardware
81
+ v-show="selectedStep.id === dynamicSteps.customizeHardware"
82
+ v-model:vm-name="vmName"
83
+ v-model:guest-machine-type="vmSettings.guestMachineType"
84
+ v-model:guest-os-family="vmSettings.guestOsFamily"
85
+ v-model:guest-os-version="vmSettings.guestOsVersion"
86
+ :storage="vmForm.storage"
87
+ :hard-disks-for-boot-options="virtualHardwareHardDisksLocal"
88
+ :cd-dvd-drives-for-boot-options="virtualHardwareCdDvdDrivesLocal"
89
+ :networks-for-boot-options="virtualHardwareNetworksLocal"
90
+ :cd-dvd-drives="vmSettings.cdDvdDrives"
91
+ :hard-disks="vmSettings.hardDisks"
92
+ :networks="vmSettings.networks"
93
+ :customize-hardware-submit="customizeHardwareSubmit"
94
+ :max-cpus="vmSettings.maxCpus"
95
+ :max-memory="vmSettings.maxMemory"
96
+ :cpu-models="vmSettings.cpuModels"
97
+ :cpu="vmSettings.cpu"
98
+ :memory="vmSettings.memory"
99
+ :video-card="vmSettings.videoCard"
100
+ :usb-controller="vmSettings.usbController"
101
+ :pci-devices="vmSettings.pciDevices"
102
+ :selected-nav-item="selectedNavItem"
103
+ :hard-disks-for-edit="vmSettings.hardDisks"
104
+ :options="vmSettings.options"
105
+ :nodes="props.nodes"
106
+ :files="props.files"
107
+ :networks-table="props.networksTable"
108
+ :error-validation-fields="props.errorValidationFields"
109
+ :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
110
+ :passthrough-devices="props.passthroughDevices"
111
+ :mediated-devices="props.mediatedDevices"
112
+ :get-datastore-table-func="props.getDatastoreTableFunc"
113
+ :datastore="props.datastore"
114
+ :is-datastore-loading="props.isDatastoreLoading"
115
+ :project="props.project"
116
+ is-clone
117
+ @change-boot-order="onChangeBootOrder"
118
+ @send-data="onChangeCustomizeHardware"
119
+ @get-storage="emits('get-storage', $event)"
120
+ @get-folders-or-files="emits('get-folders-or-files', $event)"
121
+ @get-active-device-child="emits('get-active-device-child', $event)"
122
+ @show-datastore-child="emits('show-datastore-child', $event)"
123
+ @get-networks-table="emits('get-networks-table', $event)"
124
+ @get-pci-devices="emits('get-pci-devices')"
125
+ />
126
+ <common-ready-to-complete
127
+ v-show="selectedStep.id === dynamicSteps.readyComplete"
128
+ :data="props.readyCompleteTableInfo"
129
+ />
130
+ </div>
131
+ </template>
132
+ </atoms-wizard>
133
+ </div>
134
+ </template>
135
+
136
+ <script setup lang="ts">
137
+ import type {
138
+ UI_I_DatastoreTableItem,
139
+ UI_I_FolderOrFileTreePayload,
140
+ } from '~/lib/models/store/storage/interfaces'
141
+ import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
142
+ import type { API_UI_I_Error } from '~/lib/models/store/interfaces'
143
+ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
144
+ import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
145
+ import type {
146
+ UI_I_ArbitraryObject,
147
+ UI_I_Localization,
148
+ } from '~/lib/models/interfaces'
149
+ import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
150
+ import type { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
151
+ import type {
152
+ UI_I_SendDataCpu,
153
+ UI_I_SendDataMemory,
154
+ UI_I_SendDataNewCdDvdDrive,
155
+ UI_I_SendDataNewHardDisk,
156
+ UI_I_SendDataNewNetwork,
157
+ } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
158
+ import type { UI_T_SelectedNavItem } from '~/components/common/vm/actions/common/lib/models/types'
159
+ import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
160
+ import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/models/types'
161
+ import type { UI_T_Project } from '~/lib/models/types'
162
+ import type {
163
+ UI_I_MediatedDevice,
164
+ UI_I_PciDevice,
165
+ UI_I_VmSettings,
166
+ } from '~/lib/models/store/vm/interfaces'
167
+ import type { UI_I_VmForm } from '~/components/common/vm/actions/common/lib/models/interfaces'
168
+ import type {
169
+ UI_I_ValidationReturn,
170
+ UI_I_WizardStep,
171
+ } from '~/components/atoms/wizard/lib/models/interfaces'
172
+ import type { UI_I_Capabilities } from '~/components/common/vm/actions/common/lib/models/interfaces'
173
+ import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
174
+ import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
175
+ import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
176
+ import {
177
+ stepsSchemeInitial,
178
+ stepsFunc,
179
+ dynamicSteps,
180
+ } from '~/components/common/vm/actions/clone/lib/config/steps'
181
+ import Wizard from '~/components/atoms/wizard/lib/utils/utils'
182
+ import { mapCapabilities } from '~/components/common/vm/actions/common/lib/utils/capabilities'
183
+ import { scheduledTaskDefaultFormFunc } from '~/components/common/pages/scheduledTasks/modals/lib/config/createScheduledTask'
184
+ import { capabilities } from '~/components/common/vm/actions/common/lib/config/capabilities'
185
+
186
+ const props = defineProps<{
187
+ project: UI_T_Project
188
+ vmSettings: UI_I_VmSettings | null
189
+ nodes: UI_I_FileTreeNode[]
190
+ files: UI_I_FileTreeNode[]
191
+ networksTable: UI_I_NetworkTableItem[]
192
+ datastore: UI_I_DatastoreTableItem[]
193
+ isDatastoreLoading: boolean
194
+ errorValidationFields: UI_I_ErrorValidationField[]
195
+ readyCompleteTableInfo: UI_I_TableInfoItem[]
196
+ vmCpuHelpTextSecond: string
197
+ finishFunc: any
198
+ getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
199
+ validateSendDataFunc: any
200
+ passthroughDevices: UI_I_PciDevice[]
201
+ mediatedDevices: UI_I_MediatedDevice[]
202
+ vmNameInWizard: string
203
+ capabilities?: UI_I_Capabilities
204
+ schedulerTask?: any // TODO надо interface переместить глобално
205
+ selectedVirtualMachine?: UI_I_Capabilities
206
+ isNewVmFromTemplate?: boolean
207
+ dataCenter?: UI_I_TreeNode // для сферы
208
+ computeResource?: UI_I_TreeNode // для сферы
209
+ computeResourceTree?: UI_I_TreeNode[] // для сферы
210
+ }>()
211
+
212
+ const emits = defineEmits<{
213
+ (event: 'check-name', value: [string, (error: API_UI_I_Error) => void]): void
214
+ (event: 'get-storage', value: UI_I_TablePayload): void
215
+ (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
216
+ (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
217
+ (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
218
+ (event: 'remove-error-by-title', value: string): void
219
+ (event: 'get-networks-table', value: UI_I_TablePayload): void
220
+ (event: 'get-pci-devices'): void
221
+ (event: 'hide'): void
222
+ (
223
+ event: 'get-compute-resource-tree',
224
+ value: { id: string | number; cb: () => void }
225
+ ): void // для сферы
226
+ (event: 'show-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
227
+ (event: 'select-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
228
+ (event: 'clear-compute-resource-tree'): void // для сферы
229
+ }>()
230
+
231
+ const { $recursion } = useNuxtApp()
232
+
233
+ const localization = computed<UI_I_Localization>(() => useLocal())
234
+
235
+ const isSphere = computed<boolean>(() => props.project === 'sphere')
236
+
237
+ const isScheduledTasks = computed<boolean>(
238
+ () => props.schedulerTask?.isSchedulerTask
239
+ )
240
+
241
+ const title = computed<string>(() => {
242
+ const { scheduleNewTasks, scheduleTaskEdit, cloneExistingVirtualMachine } =
243
+ localization.value.common
244
+
245
+ let result = cloneExistingVirtualMachine
246
+ if (isScheduledTasks.value) {
247
+ const schedulerMode = props.schedulerTask.editTask
248
+ ? scheduleTaskEdit
249
+ : scheduleNewTasks
250
+
251
+ result = `${schedulerMode} (${cloneExistingVirtualMachine})`
252
+ }
253
+
254
+ if (props.isNewVmFromTemplate) {
255
+ result = localization.value.vmWizard.deployFromTemplate
256
+ }
257
+
258
+ return result
259
+ })
260
+
261
+ watch(
262
+ () => props.capabilities,
263
+ () => {
264
+ if (props.capabilities) {
265
+ mapCapabilities(props.capabilities)
266
+ }
267
+ },
268
+ { deep: true, immediate: true }
269
+ )
270
+
271
+ const wizard: Wizard = new Wizard(
272
+ stepsFunc(localization.value),
273
+ stepsSchemeInitial
274
+ )
275
+ watch(
276
+ isScheduledTasks,
277
+ (newValue) => {
278
+ if (newValue) {
279
+ wizard.changeScheme(isSphere.value ? 12 : 4)
280
+ } else {
281
+ wizard.changeScheme(isSphere.value ? 8 : 0)
282
+ wizard.selectStepHard(isSphere.value ? 2 : 1)
283
+ }
284
+ },
285
+ { immediate: true }
286
+ )
287
+
288
+ // TODO move to common
289
+ const newTaskForm = ref<UI_I_ScheduleNewTasksForm>(
290
+ useDeepCopy(scheduledTaskDefaultFormFunc())
291
+ )
292
+ watch(
293
+ newTaskForm,
294
+ (newValue: UI_I_ScheduleNewTasksForm) => {
295
+ if (isScheduledTasks.value) wizard.setDisabledNextButton(newValue.isValid)
296
+ },
297
+ { immediate: true, deep: true }
298
+ )
299
+
300
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
301
+
302
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
303
+ wizard.changeSteps(value, validationFunc, validateSendData)
304
+ }
305
+
306
+ const validationFunc = async (
307
+ value: UI_I_WizardStep[],
308
+ currentStep: UI_I_WizardStep,
309
+ nextStep: UI_I_WizardStep
310
+ ): Promise<UI_I_ValidationReturn> => {
311
+ let stepHasError = false
312
+ let stepShouldStop = {
313
+ ifOnCurrentStep: false,
314
+ ifFromAnyStep: false,
315
+ stoppageStepId: -1,
316
+ }
317
+
318
+ wizard.setLoader(true)
319
+ if (
320
+ wizard.isValidateForStep(
321
+ isSphere.value ? dynamicSteps.selectNameFolder : dynamicSteps.selectName,
322
+ currentStep.id,
323
+ nextStep.id
324
+ )
325
+ ) {
326
+ const nameValidation = await checkName(value)
327
+
328
+ value = nameValidation.newValue
329
+ stepHasError = stepHasError || nameValidation.stepHasError
330
+ } else if (
331
+ isSphere.value &&
332
+ wizard.isValidateForStep(
333
+ dynamicSteps.selectComputeResource,
334
+ currentStep.id,
335
+ nextStep.id
336
+ )
337
+ ) {
338
+ const computeResourceValidation = await checkComputeResource(value)
339
+
340
+ value = computeResourceValidation.newValue
341
+ stepHasError = stepHasError || computeResourceValidation.stepHasError
342
+ } else if (
343
+ wizard.isValidateForStep(
344
+ dynamicSteps.selectStorage,
345
+ currentStep.id,
346
+ nextStep.id
347
+ )
348
+ ) {
349
+ const storageValidation = await checkStorage(value)
350
+
351
+ value = storageValidation.newValue
352
+
353
+ stepHasError = stepHasError || storageValidation.stepHasError
354
+ } else if (
355
+ wizard.isValidateForStep(
356
+ dynamicSteps.customizeHardware,
357
+ currentStep.id,
358
+ nextStep.id
359
+ )
360
+ ) {
361
+ const customizeHardwareValidation = await checkCustomizeHardware(value)
362
+
363
+ value = customizeHardwareValidation.newValue
364
+
365
+ stepHasError = stepHasError || customizeHardwareValidation.stepHasError
366
+ }
367
+ wizard.setLoader(false)
368
+
369
+ return {
370
+ newValue: value,
371
+ stepHasError,
372
+ stepShouldStop,
373
+ }
374
+ }
375
+ const checkName = async (
376
+ value: UI_I_WizardStep[]
377
+ ): Promise<UI_I_ValidationReturn> => {
378
+ let stepHasError = false
379
+
380
+ return new Promise((resolve) => {
381
+ const step = isSphere.value
382
+ ? dynamicSteps.selectNameFolder
383
+ : dynamicSteps.selectName
384
+ nameFormSubmit.value = (isValid: boolean) => {
385
+ if (!isValid) {
386
+ stepHasError = wizard.setValidation(step, 'name', {
387
+ fieldMessage: 'aaa',
388
+ alertMessage: 'aaa',
389
+ })
390
+ } else if (wizard.hasMessage(step, 'name')) {
391
+ value = wizard.removeValidation(step, 'name', value)
392
+ }
393
+
394
+ resolve({
395
+ stepHasError,
396
+ newValue: value,
397
+ })
398
+ nameFormSubmit.value = null
399
+ }
400
+ })
401
+ }
402
+ const checkComputeResource = async (
403
+ value: UI_I_WizardStep[]
404
+ ): Promise<UI_I_ValidationReturn> => {
405
+ let stepHasError = false
406
+
407
+ return new Promise((resolve) => {
408
+ computeResourceSubmit.value = (isValid: boolean) => {
409
+ if (!isValid) {
410
+ stepHasError = wizard.setValidation(
411
+ dynamicSteps.selectComputeResource,
412
+ 'computeResource',
413
+ {
414
+ fieldMessage: 'aaa',
415
+ alertMessage: 'aaa',
416
+ }
417
+ )
418
+ } else if (
419
+ wizard.hasMessage(dynamicSteps.selectComputeResource, 'computeResource')
420
+ ) {
421
+ value = wizard.removeValidation(
422
+ dynamicSteps.selectComputeResource,
423
+ 'computeResource',
424
+ value
425
+ )
426
+ }
427
+
428
+ resolve({
429
+ stepHasError,
430
+ newValue: value,
431
+ })
432
+ computeResourceSubmit.value = null
433
+ }
434
+ })
435
+ }
436
+ const checkStorage = async (
437
+ value: UI_I_WizardStep[]
438
+ ): Promise<UI_I_ValidationReturn> => {
439
+ let stepHasError = false
440
+
441
+ return new Promise((resolve) => {
442
+ storageSubmit.value = (isValid: boolean) => {
443
+ if (!isValid) {
444
+ stepHasError = wizard.setValidation(
445
+ dynamicSteps.selectStorage,
446
+ 'storage',
447
+ {
448
+ fieldMessage: 'aaa',
449
+ alertMessage: 'aaa',
450
+ }
451
+ )
452
+ } else if (wizard.hasMessage(dynamicSteps.selectStorage, 'storage')) {
453
+ value = wizard.removeValidation(
454
+ dynamicSteps.selectStorage,
455
+ 'storage',
456
+ value
457
+ )
458
+ }
459
+
460
+ resolve({
461
+ stepHasError,
462
+ newValue: value,
463
+ })
464
+ storageSubmit.value = null
465
+ }
466
+ })
467
+ }
468
+ const checkCustomizeHardware = async (
469
+ value: UI_I_WizardStep[]
470
+ ): Promise<UI_I_ValidationReturn> => {
471
+ let stepHasError = false
472
+
473
+ return new Promise((resolve) => {
474
+ customizeHardwareSubmit.value = (isValid: boolean) => {
475
+ if (!isValid) {
476
+ stepHasError = wizard.setValidation(
477
+ dynamicSteps.customizeHardware,
478
+ 'customizeHardware',
479
+ {
480
+ fieldMessage: 'aaa',
481
+ alertMessage: 'aaa',
482
+ }
483
+ )
484
+ } else if (
485
+ wizard.hasMessage(dynamicSteps.customizeHardware, 'customizeHardware')
486
+ ) {
487
+ value = wizard.removeValidation(
488
+ dynamicSteps.customizeHardware,
489
+ 'customizeHardware',
490
+ value
491
+ )
492
+ }
493
+
494
+ resolve({
495
+ stepHasError,
496
+ newValue: value,
497
+ })
498
+ storageSubmit.value = null
499
+ }
500
+ })
501
+ }
502
+
503
+ const vmForm = ref<UI_I_VmForm>({
504
+ name: '',
505
+ compatibility: '',
506
+ guestMachineType: null,
507
+ guestOsFamily: null,
508
+ guestOsVersion: null,
509
+ computeResource: null,
510
+ storage: null,
511
+ locationPath: '',
512
+ dataCenter: null,
513
+ options: [],
514
+ })
515
+ const onChangeName = (name: string, node: UI_I_TreeNode): void => {
516
+ vmForm.value.name = name
517
+ if (isSphere.value) {
518
+ vmForm.value.locationPath = node.id
519
+ vmForm.value.dataCenter = $recursion.findParentByValue(
520
+ node,
521
+ 'datacenter',
522
+ 'type',
523
+ 'parent'
524
+ )
525
+ }
526
+ }
527
+ const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
528
+ if (!storage) return
529
+
530
+ vmForm.value.storage = storage
531
+ }
532
+ const onChangeSelectOptions = (options: string[]): void => {
533
+ vmForm.value.options = options
534
+ if (
535
+ options.includes('customize-os') &&
536
+ options.includes('customize-hardware')
537
+ ) {
538
+ let procuratorSchame = isScheduledTasks.value ? 7 : 3
539
+ let sphereSchame = isScheduledTasks.value ? 15 : 11
540
+ wizard.changeScheme(isSphere.value ? sphereSchame : procuratorSchame)
541
+ } else if (options.includes('customize-os')) {
542
+ let procuratorSchame = isScheduledTasks.value ? 5 : 1
543
+ let sphereSchame = isScheduledTasks.value ? 13 : 9
544
+ wizard.changeScheme(isSphere.value ? sphereSchame : procuratorSchame)
545
+ } else if (options.includes('customize-hardware')) {
546
+ let procuratorSchame = isScheduledTasks.value ? 6 : 2
547
+ let sphereSchame = isScheduledTasks.value ? 14 : 10
548
+ wizard.changeScheme(isSphere.value ? sphereSchame : procuratorSchame)
549
+ } else {
550
+ let procuratorSchame = isScheduledTasks.value ? 4 : 0
551
+ let sphereSchame = isScheduledTasks.value ? 12 : 8
552
+ wizard.changeScheme(isSphere.value ? sphereSchame : procuratorSchame)
553
+ }
554
+
555
+ // Change power on by default
556
+ isPowerOnByDefault.value = options.includes('power-on')
557
+ }
558
+ const customizeHardware = ref<UI_I_SendDataCustomizeHardware | null>(null)
559
+ const onChangeCustomizeHardware = (
560
+ data: UI_I_SendDataCustomizeHardware
561
+ ): void => {
562
+ customizeHardware.value = data
563
+ }
564
+
565
+ const virtualHardwareHardDisksLocal = computed<
566
+ UI_I_SendDataNewHardDisk[] | null
567
+ >(() => customizeHardware.value?.virtualHardware?.hardDisks || null)
568
+ const virtualHardwareNetworksLocal = computed<UI_I_SendDataNewNetwork[] | null>(
569
+ () => customizeHardware.value?.virtualHardware?.networks || null
570
+ )
571
+ const virtualHardwareCdDvdDrivesLocal = computed<
572
+ UI_I_SendDataNewCdDvdDrive[] | null
573
+ >(() => customizeHardware.value?.virtualHardware?.cdDvdDrives || null)
574
+
575
+ const virtualHardwareCpu = computed<UI_I_SendDataCpu | null>(
576
+ () => customizeHardware.value?.virtualHardware?.cpu || null
577
+ )
578
+ const virtualHardwareMemory = computed<UI_I_SendDataMemory | null>(
579
+ () => customizeHardware.value?.virtualHardware?.memory || null
580
+ )
581
+ const virtualHardwareHardDisks = ref<UI_I_SendDataNewHardDisk[] | null>(null)
582
+ const virtualHardwareCdDvdDrives = ref<UI_I_SendDataNewCdDvdDrive[] | null>(
583
+ null
584
+ )
585
+ const virtualHardwareNetworks = ref<UI_I_SendDataNewNetwork[] | null>(null)
586
+ const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
587
+ virtualHardwareHardDisks.value = data[0]
588
+ virtualHardwareCdDvdDrives.value = data[1]
589
+ virtualHardwareNetworks.value = data[2]
590
+ }
591
+
592
+ const isPowerOnByDefault = ref<boolean>(false)
593
+
594
+ watch(
595
+ () => props.vmNameInWizard,
596
+ (newValue) => {
597
+ vmForm.value.name = newValue
598
+ }
599
+ )
600
+
601
+ const validateSendData = async (
602
+ value: UI_I_WizardStep[]
603
+ ): Promise<UI_I_ValidationReturn> => {
604
+ wizard.setLoader(true)
605
+ let stepHasError = false
606
+
607
+ const data = await props.validateSendDataFunc(
608
+ vmForm.value,
609
+ virtualHardwareCpu.value,
610
+ virtualHardwareMemory.value,
611
+ customizeHardware.value,
612
+ virtualHardwareNetworks.value,
613
+ virtualHardwareHardDisks.value,
614
+ virtualHardwareCdDvdDrives.value,
615
+ isPowerOnByDefault.value,
616
+ localization.value,
617
+ vmForm.value.locationPath, // для сферы
618
+ // computeResourcePath.value // для сферы
619
+ vmSettings.value.host_id // для сферы // TODO rollback
620
+ )
621
+
622
+ wizard.setLoader(false)
623
+ if (data) {
624
+ stepHasError = true
625
+ selectedNavItem.value = data[0]
626
+ }
627
+
628
+ return {
629
+ stepHasError,
630
+ newValue: value,
631
+ }
632
+ }
633
+
634
+ const isLoading = ref<boolean>(false)
635
+ const onFinish = (): void => {
636
+ isLoading.value = true
637
+ wizard.setLoader(false)
638
+ props
639
+ .finishFunc(
640
+ vmForm.value,
641
+ virtualHardwareCpu.value,
642
+ virtualHardwareMemory.value,
643
+ customizeHardware.value,
644
+ virtualHardwareNetworks.value,
645
+ virtualHardwareHardDisks.value,
646
+ virtualHardwareCdDvdDrives.value,
647
+ isPowerOnByDefault.value,
648
+ localization.value,
649
+ vmForm.value.locationPath, // для сферы
650
+ // computeResourcePath.value, // для сферы
651
+ vmSettings.value.host_id, // для сферы // TODO rollback
652
+ false,
653
+ newTaskForm.value,
654
+ props.schedulerTask
655
+ )
656
+ .then(() => {
657
+ isLoading.value = false
658
+ onHideModal()
659
+ wizard.setLoader(false)
660
+ })
661
+ }
662
+
663
+ const selectedNavItem = ref<UI_T_SelectedNavItem>(0)
664
+
665
+ const nameFormSubmit = ref<null | Function>(null)
666
+ const computeResourceSubmit = ref<null | Function>(null)
667
+ const storageSubmit = ref<null | Function>(null)
668
+ const customizeHardwareSubmit = ref<null | Function>(null)
669
+
670
+ const vmSettings = computed<UI_I_VmSettings | null>(() => props.vmSettings)
671
+ const vmName = ref<string>(vmSettings.value?.name || '')
672
+
673
+ const guestOsFamilies = ref<UI_I_OptionItem[]>(
674
+ capabilities.value.guestOsFamilies
675
+ )
676
+ const guestOsVersions = ref<UI_I_ArbitraryObject<UI_I_OptionItem[]>>(
677
+ capabilities.value.guestOsVersions
678
+ )
679
+ const machineTypes = ref<UI_I_OptionItem[]>(capabilities.value.machineTypes)
680
+
681
+ const computeResource = ref<UI_I_TreeNode | null>(null)
682
+ const onChangeComputeResource = (node: UI_I_TreeNode): void => {
683
+ computeResource.value = node
684
+ }
685
+ // // Для сферы
686
+ const computeResourcePath = ref<string>('')
687
+ const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
688
+ emits('select-compute-resource-tree', node)
689
+ computeResourcePath.value = node.id
690
+ }
691
+
692
+ watch(vmSettings, (newValue) => {
693
+ vmName.value = newValue?.name || ''
694
+
695
+ if (newValue?.guestOsFamily)
696
+ vmForm.value.guestOsFamily = newValue.guestOsFamily
697
+ if (newValue?.guestMachineType)
698
+ vmForm.value.guestMachineType = newValue.guestMachineType
699
+ if (newValue?.guestOsVersion)
700
+ vmForm.value.guestOsVersion = newValue.guestOsVersion
701
+
702
+ if (newValue?.compatibility)
703
+ vmForm.value.compatibility = newValue.compatibility
704
+
705
+ if (newValue?.storage) {
706
+ const datastore = props.datastore.find(
707
+ (item) => item.id === newValue.storage.id
708
+ )
709
+ if (datastore) vmForm.value.storage = datastore
710
+ }
711
+ })
712
+
713
+ const onHideModal = (): void => {
714
+ emits('hide')
715
+ }
716
+ </script>
717
+
718
+ <style scoped lang="scss">
719
+ :deep(.has-solid.close-icon.clr-icon) {
720
+ width: 20px;
721
+ top: 0;
722
+ }
723
+ .vm-context {
724
+ padding: 16px 15px 10px 10px;
725
+ height: 100%;
726
+ display: flex;
727
+ flex-direction: column;
728
+
729
+ .context-title-wrap {
730
+ padding-bottom: 3px;
731
+ border-bottom: 1px solid #a6a6a6;
732
+
733
+ h4 {
734
+ font-weight: 700;
735
+ font-size: 13px;
736
+ color: var(--vm-context-title);
737
+ }
738
+ p {
739
+ font-weight: 400;
740
+ font-size: 13px;
741
+ color: var(--vm-context-sub-title);
742
+ }
743
+ }
744
+
745
+ .finish-block {
746
+ padding: 18px 24px 24px 24px;
747
+
748
+ .add-hosts-ready-to-complete-mt-12 {
749
+ margin-top: 12px;
750
+
751
+ .add-hosts-ready-to-complete-bold {
752
+ line-height: 18px;
753
+ font-weight: 700;
754
+ }
755
+ }
756
+ }
757
+
758
+ .vm-hardware-version {
759
+ align-self: flex-end;
760
+ margin-top: auto;
761
+ }
762
+ }
763
+
764
+ :deep(.modal .modal-dialog .modal-content .modal-footer) {
765
+ flex: unset;
766
+ height: unset;
767
+ min-height: unset;
768
+ }
769
+ :deep(.wizard-modal-titlebar h3) {
770
+ color: #000;
771
+ font-size: 24px;
772
+ font-weight: 200;
773
+ line-height: 27px;
774
+ margin: 0;
775
+ padding: 0;
776
+ }
777
+ :deep(.clr-wizard-stepnav-item) {
778
+ padding-left: 0;
779
+ }
780
+ :deep(.clr-wizard-stepnav
781
+ .clr-wizard-stepnav-item
782
+ button
783
+ .clr-wizard-stepnav-link-title) {
784
+ width: 189px;
785
+ font-weight: 700;
786
+ font-size: 13px;
787
+ }
788
+
789
+ #vm-wizard-notification {
790
+ h3 {
791
+ color: var(--global-font-color7);
792
+ margin-top: 6px;
793
+ }
794
+ p {
795
+ color: var(--global-font-color6);
796
+ line-height: 16px;
797
+ }
798
+ }
799
+
800
+ .power-on-by-default-wrap {
801
+ display: flex;
802
+ align-items: center;
803
+
804
+ input {
805
+ margin-right: 6px;
806
+ }
807
+ }
808
+
809
+ .new-task-form {
810
+ padding: 0 25px 0 5px;
811
+ }
812
+ </style>
813
+
814
+ <style>
815
+ :root {
816
+ --vm-context-title: #333;
817
+ --vm-context-sub-title: #000;
818
+ }
819
+ :root.dark-theme {
820
+ --vm-context-title: #adbbc4;
821
+ --vm-context-sub-title: #adbbc4;
822
+ }
823
+ </style>