bfg-common 1.4.736 → 1.4.737

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