bfg-common 1.3.485 → 1.3.486

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 (67) hide show
  1. package/assets/img/icons/icons-sprite-dark-8.svg +190 -190
  2. package/assets/img/icons/icons-sprite-light-8.svg +190 -190
  3. package/assets/scss/common/normalize.scss +340 -340
  4. package/components/atoms/TheIcon2.vue +1353 -1353
  5. package/components/atoms/loader/Loader.vue +30 -30
  6. package/components/atoms/loader/PreLoader.vue +38 -38
  7. package/components/atoms/switch/Switch.vue +111 -111
  8. package/components/atoms/table/compact/Compact.vue +526 -526
  9. package/components/common/adapterManager/ui/table/Header.vue +93 -93
  10. package/components/common/adapterManager/ui/table/Table.vue +162 -162
  11. package/components/common/context/Context.vue +99 -99
  12. package/components/common/layout/theHeader/LanguageSwitch.vue +102 -102
  13. package/components/common/layout/theHeader/userMenu/modals/preferences/View.vue +129 -129
  14. package/components/common/lib/config/states.ts +160 -160
  15. package/components/common/mainNavigationPanel/MainNavigationPanel.vue +142 -142
  16. package/components/common/mainNavigationPanel/MainNavigationPanelNew.vue +248 -248
  17. package/components/common/mainNavigationPanel/MainNavigationPanelOld.vue +288 -288
  18. package/components/common/readyToComplete/ReadyToComplete.vue +15 -15
  19. package/components/common/resource/progressBlock/ProgressBlock.vue +142 -142
  20. package/components/common/split/horizontal/Horizontal.vue +70 -70
  21. package/components/common/vm/actions/clone/Clone.vue +511 -511
  22. package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +273 -273
  23. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue +697 -697
  24. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Cpu.vue +400 -400
  25. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +329 -329
  26. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +305 -305
  27. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDevice.vue +168 -168
  28. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbController.vue +82 -82
  29. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/Other.vue +32 -32
  30. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCard.vue +182 -182
  31. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptions.vue +114 -114
  32. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +192 -192
  33. package/components/common/vm/actions/common/customizeHardware/vmoptions/tools/Tools.vue +72 -72
  34. package/components/common/vm/actions/common/select/computeResource/ComputeResource.vue +164 -164
  35. package/components/common/vm/actions/common/select/name/Name.vue +235 -235
  36. package/components/common/vm/actions/common/select/storage/Storage.vue +198 -198
  37. package/components/common/vm/actions/editSettings/EditSettings.vue +316 -316
  38. package/components/common/weekSelect/lib/config/options.ts +10 -10
  39. package/components/common/wizards/datastore/add/Add.vue +436 -436
  40. package/components/common/wizards/datastore/add/lib/config/stepItems.ts +191 -191
  41. package/components/common/wizards/datastore/add/lib/models/interfaces.ts +38 -38
  42. package/components/common/wizards/datastore/add/lib/utils.ts +70 -70
  43. package/components/common/wizards/datastore/add/local/createName/CreateName.vue +160 -160
  44. package/components/common/wizards/datastore/add/nfs/Nfs.vue +112 -112
  45. package/components/common/wizards/datastore/add/nfs/accessibility/Accessibility.vue +104 -104
  46. package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/compatibleTable.ts +62 -62
  47. package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/hostsTableItems.ts +53 -53
  48. package/components/common/wizards/datastore/add/readyComplete/ReadyComplete.vue +86 -86
  49. package/components/common/wizards/datastore/add/readyComplete/lib/config/propertiesDetails.ts +184 -184
  50. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/DeviceSelection.vue +459 -459
  51. package/components/common/wizards/datastore/add/types/Types.vue +80 -80
  52. package/components/common/wizards/datastore/add/types/lib/config/typeOptions.ts +49 -49
  53. package/composables/useAppVersion.ts +22 -22
  54. package/composables/useEnvLanguage.ts +20 -20
  55. package/lib/utils/sendTask.ts +73 -73
  56. package/minify.js +146 -146
  57. package/package.json +1 -1
  58. package/plugins/spice-console/spice.console.ts +147 -147
  59. package/public/spice-console/application/codec.js +263 -263
  60. package/public/spice-console/lib/rasterEngine.js +907 -907
  61. package/public/spice-console/network/spicechannel.js +375 -375
  62. package/store/main/lib/interfaces.ts +9 -9
  63. package/store/tasks/actions.ts +133 -133
  64. package/store/tasks/getters.ts +25 -25
  65. package/store/tasks/lib/models/interfaces.ts +18 -18
  66. package/store/tasks/mutations.ts +58 -58
  67. package/store/tasks/state.ts +16 -16
@@ -1,511 +1,511 @@
1
- <template>
2
- <div class="clone-vm">
3
- <atoms-wizard
4
- show
5
- :wizard="wizard"
6
- :selected-scheme="selectedScheme"
7
- :title="localization.cloneExistingVirtualMachine"
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-vm-actions-common-select-name
17
- v-show="selectedStep.id === 0"
18
- :show="selectedStep.id === 0"
19
- :name-form-submit="nameFormSubmit"
20
- :project="props.project"
21
- @submit="onChangeName(...$event)"
22
- @check-name="emits('check-name', $event)"
23
- />
24
- <common-vm-actions-common-select-storage
25
- v-show="selectedStep.id === 1"
26
- :storage-submit="storageSubmit"
27
- :datastore="props.datastore"
28
- :storage="vmSettings.storage"
29
- :get-datastore-table-func="props.getDatastoreTableFunc"
30
- @submit="onChangeStorage"
31
- />
32
- <common-vm-actions-clone-select-options
33
- v-show="selectedStep.id === 2"
34
- :select-options-submit="selectOptionsSubmit"
35
- @submit="onChangeSelectOptions"
36
- />
37
- <common-vm-actions-common-customize-hardware
38
- v-show="selectedStep.id === 3"
39
- v-model:vm-name="vmName"
40
- v-model:guest-machine-type="vmSettings.guestMachineType"
41
- v-model:guest-os-family="vmSettings.guestOsFamily"
42
- v-model:guest-os-version="vmSettings.guestOsVersion"
43
- :storage="vmSettings.storage"
44
- :hard-disks-for-boot-options="virtualHardwareHardDisksLocal"
45
- :cd-dvd-drives-for-boot-options="virtualHardwareCdDvdDrivesLocal"
46
- :networks-for-boot-options="virtualHardwareNetworksLocal"
47
- :cd-dvd-drives="vmSettings.cdDvdDrives"
48
- :hard-disks="vmSettings.hardDisks"
49
- :networks="vmSettings.networks"
50
- :customize-hardware-submit="customizeHardwareSubmit"
51
- :max-cpus="vmSettings.maxCpus"
52
- :max-memory="vmSettings.maxMemory"
53
- :cpu-models="vmSettings.cpuModels"
54
- :cpu="vmSettings.cpu"
55
- :memory="vmSettings.memory"
56
- :video-card="vmSettings.videoCard"
57
- :usb-controller="vmSettings.usbController"
58
- :pci-devices="vmSettings.pciDevices"
59
- :selected-nav-item="selectedNavItem"
60
- :hard-disks-for-edit="vmSettings.hardDisks"
61
- :options="vmSettings.options"
62
- :nodes="props.nodes"
63
- :files="props.files"
64
- :networks-table="props.networksTable"
65
- :error-validation-fields="props.errorValidationFields"
66
- :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
67
- :passthrough-devices="props.passthroughDevices"
68
- :get-datastore-table-func="props.getDatastoreTableFunc"
69
- :datastore="props.datastore"
70
- :project="props.project"
71
- is-clone
72
- @change-boot-order="onChangeBootOrder"
73
- @send-data="onChangeCustomizeHardware"
74
- @get-storage="emits('get-storage', $event)"
75
- @get-folders-or-files="emits('get-folders-or-files', $event)"
76
- @get-active-device-child="emits('get-active-device-child', $event)"
77
- @show-datastore-child="emits('show-datastore-child', $event)"
78
- @get-networks-table="emits('get-networks-table', $event)"
79
- @get-pci-devices="emits('get-pci-devices')"
80
- />
81
- <common-ready-to-complete
82
- v-show="selectedStep.id === 4"
83
- :data="props.readyCompleteTableInfo"
84
- />
85
- </div>
86
- </template>
87
- </atoms-wizard>
88
- </div>
89
- </template>
90
-
91
- <script setup lang="ts">
92
- import type {
93
- UI_I_DatastoreTableItem,
94
- UI_I_FolderOrFileTreePayload,
95
- } from '~/lib/models/store/storage/interfaces'
96
- import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
97
- import type { API_UI_I_Error } from '~/lib/models/store/interfaces'
98
- import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
99
- import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
100
- import type { UI_I_Localization } from '~/lib/models/interfaces'
101
- import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
102
- import type { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
103
- import type {
104
- UI_I_SendDataCpu,
105
- UI_I_SendDataMemory,
106
- UI_I_SendDataNewCdDvdDrive,
107
- UI_I_SendDataNewHardDisk,
108
- UI_I_SendDataNewNetwork,
109
- } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
110
- import type { UI_T_SelectedNavItem } from '~/components/common/vm/actions/common/lib/models/types'
111
- import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
112
- import type { UI_I_ConfigurePciDevicesTable } from '~/lib/models/store/host/interfaces'
113
- import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/models/types'
114
- import type { UI_T_Project } from '~/lib/models/types'
115
- import type { UI_I_VmSettings } from '~/lib/models/store/vm/interfaces'
116
- import type { UI_I_VmForm } from '~/components/common/vm/actions/clone/lib/models/interfaces'
117
- import {
118
- UI_I_ValidationReturn,
119
- UI_I_WizardStep,
120
- } from '~/components/atoms/wizard/lib/models/interfaces'
121
- import {
122
- stepsSchemeInitial,
123
- stepsFunc,
124
- } from '~/components/common/vm/actions/clone/lib/config/steps'
125
- import Wizard from '~/components/atoms/wizard/lib/utils/utils'
126
-
127
- const props = defineProps<{
128
- project: UI_T_Project
129
- vmSettings: UI_I_VmSettings | null
130
- nodes: UI_I_FileTreeNode[]
131
- files: UI_I_FileTreeNode[]
132
- networksTable: UI_I_NetworkTableItem[]
133
- datastore: UI_I_DatastoreTableItem[]
134
- errorValidationFields: UI_I_ErrorValidationField[]
135
- readyCompleteTableInfo: UI_I_TableInfoItem[]
136
- vmCpuHelpTextSecond: string
137
- finishFunc: any
138
- getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
139
- validateSendDataFunc: any
140
- passthroughDevices: UI_I_ConfigurePciDevicesTable | null
141
- vmNameInWizard: string
142
- }>()
143
-
144
- const emits = defineEmits<{
145
- (event: 'check-name', value: [string, (error: API_UI_I_Error) => void]): void
146
- (event: 'get-storage', value: UI_I_TablePayload): void
147
- (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
148
- (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
149
- (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
150
- (event: 'remove-error-by-title', value: string): void
151
- (event: 'get-networks-table', value: UI_I_TablePayload): void
152
- (event: 'get-pci-devices'): void
153
- (event: 'hide'): void
154
- }>()
155
-
156
- const localization = computed<UI_I_Localization>(() => useLocal())
157
-
158
- const wizard: Wizard = new Wizard(
159
- stepsFunc(localization.value),
160
- stepsSchemeInitial
161
- )
162
- const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
163
-
164
- const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
165
- wizard.changeSteps(value, validationFunc, validateSendData)
166
- }
167
-
168
- const validationFunc = async (
169
- value: UI_I_WizardStep[],
170
- currentStep: UI_I_WizardStep,
171
- nextStep: UI_I_WizardStep
172
- ): Promise<UI_I_ValidationReturn> => {
173
- let stepHasError = false
174
- let stepShouldStop = {
175
- ifOnCurrentStep: false,
176
- ifFromAnyStep: false,
177
- stoppageStepId: -1,
178
- }
179
-
180
- wizard.setLoader(true)
181
- if (wizard.isValidateForStep(0, currentStep.id, nextStep.id)) {
182
- const nameValidation = await checkName(value)
183
-
184
- value = nameValidation.newValue
185
- stepHasError = stepHasError || nameValidation.stepHasError
186
- } else if (wizard.isValidateForStep(1, currentStep.id, nextStep.id)) {
187
- const storageValidation = await checkStorage(value)
188
-
189
- value = storageValidation.newValue
190
-
191
- stepHasError = stepHasError || storageValidation.stepHasError
192
- } else if (wizard.isValidateForStep(2, currentStep.id, nextStep.id)) {
193
- selectOptionsSubmit.value++
194
- } else if (wizard.isValidateForStep(3, currentStep.id, nextStep.id)) {
195
- const storageValidation = await checkCustomizeHardware(value)
196
-
197
- value = storageValidation.newValue
198
-
199
- stepHasError = stepHasError || storageValidation.stepHasError
200
- }
201
- wizard.setLoader(false)
202
-
203
- return {
204
- newValue: value,
205
- stepHasError,
206
- stepShouldStop,
207
- }
208
- }
209
- const checkName = async (
210
- value: UI_I_WizardStep[]
211
- ): Promise<UI_I_ValidationReturn> => {
212
- let stepHasError = false
213
-
214
- return new Promise((resolve) => {
215
- nameFormSubmit.value = (isValid: boolean) => {
216
- if (!isValid) {
217
- stepHasError = wizard.setValidation(0, 'name', {
218
- fieldMessage: 'aaa',
219
- alertMessage: 'aaa',
220
- })
221
- } else if (wizard.hasMessage(0, 'name')) {
222
- value = wizard.removeValidation(0, 'name', value)
223
- }
224
-
225
- resolve({
226
- stepHasError,
227
- newValue: value,
228
- })
229
- nameFormSubmit.value = null
230
- }
231
- })
232
- }
233
- const checkStorage = async (
234
- value: UI_I_WizardStep[]
235
- ): Promise<UI_I_ValidationReturn> => {
236
- let stepHasError = false
237
-
238
- return new Promise((resolve) => {
239
- storageSubmit.value = (isValid: boolean) => {
240
- if (!isValid) {
241
- stepHasError = wizard.setValidation(1, 'storage', {
242
- fieldMessage: 'aaa',
243
- alertMessage: 'aaa',
244
- })
245
- } else if (wizard.hasMessage(1, 'storage')) {
246
- value = wizard.removeValidation(1, 'storage', value)
247
- }
248
-
249
- resolve({
250
- stepHasError,
251
- newValue: value,
252
- })
253
- storageSubmit.value = null
254
- }
255
- })
256
- }
257
- const checkCustomizeHardware = async (
258
- value: UI_I_WizardStep[]
259
- ): Promise<UI_I_ValidationReturn> => {
260
- let stepHasError = false
261
-
262
- return new Promise((resolve) => {
263
- customizeHardwareSubmit.value = (isValid: boolean) => {
264
- if (!isValid) {
265
- stepHasError = wizard.setValidation(3, 'customizeHardware', {
266
- fieldMessage: 'aaa',
267
- alertMessage: 'aaa',
268
- })
269
- } else if (wizard.hasMessage(3, 'customizeHardware')) {
270
- value = wizard.removeValidation(3, 'customizeHardware', value)
271
- }
272
-
273
- resolve({
274
- stepHasError,
275
- newValue: value,
276
- })
277
- storageSubmit.value = null
278
- }
279
- })
280
- }
281
-
282
- const storageIdCash = ref<string | null>(null)
283
- const vmForm = ref<UI_I_VmForm>({
284
- name: '',
285
- storage: null,
286
- options: [],
287
- })
288
- const onChangeName = (name: string): void => {
289
- vmForm.value.name = name
290
- }
291
- const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
292
- if (!storage) return
293
-
294
- vmForm.value.storage = storage
295
- storageIdCash.value = storage.id
296
- }
297
- const onChangeSelectOptions = (options: string[]): void => {
298
- vmForm.value.options = options
299
- }
300
- const customizeHardware = ref<UI_I_SendDataCustomizeHardware | null>(null)
301
- const onChangeCustomizeHardware = (
302
- data: UI_I_SendDataCustomizeHardware
303
- ): void => {
304
- customizeHardware.value = data
305
- }
306
-
307
- const virtualHardwareHardDisksLocal = computed<
308
- UI_I_SendDataNewHardDisk[] | null
309
- >(() => customizeHardware.value?.virtualHardware?.hardDisks || null)
310
- const virtualHardwareNetworksLocal = computed<UI_I_SendDataNewNetwork[] | null>(
311
- () => customizeHardware.value?.virtualHardware?.networks || null
312
- )
313
- const virtualHardwareCdDvdDrivesLocal = computed<
314
- UI_I_SendDataNewCdDvdDrive[] | null
315
- >(() => customizeHardware.value?.virtualHardware?.cdDvdDrives || null)
316
-
317
- const virtualHardwareCpu = computed<UI_I_SendDataCpu | null>(
318
- () => customizeHardware.value?.virtualHardware?.cpu || null
319
- )
320
- const virtualHardwareMemory = computed<UI_I_SendDataMemory | null>(
321
- () => customizeHardware.value?.virtualHardware?.memory || null
322
- )
323
- const virtualHardwareHardDisks = ref<UI_I_SendDataNewHardDisk[] | null>(null)
324
- const virtualHardwareCdDvdDrives = ref<UI_I_SendDataNewCdDvdDrive[] | null>(
325
- null
326
- )
327
- const virtualHardwareNetworks = ref<UI_I_SendDataNewNetwork[] | null>(null)
328
- const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
329
- virtualHardwareHardDisks.value = data[0]
330
- virtualHardwareCdDvdDrives.value = data[1]
331
- virtualHardwareNetworks.value = data[2]
332
- }
333
-
334
- const isPowerOnByDefault = ref<boolean>(true)
335
-
336
- watch(
337
- () => props.vmNameInWizard,
338
- (newValue) => {
339
- vmForm.value.name = newValue
340
- }
341
- )
342
-
343
- const validateSendData = async (
344
- value: UI_I_WizardStep[]
345
- ): Promise<UI_I_ValidationReturn> => {
346
- wizard.setLoader(true)
347
- let stepHasError = false
348
-
349
- const data = await props.validateSendDataFunc(
350
- vmForm.value,
351
- virtualHardwareCpu.value,
352
- virtualHardwareMemory.value,
353
- customizeHardware.value,
354
- virtualHardwareNetworks.value,
355
- virtualHardwareHardDisks.value,
356
- virtualHardwareCdDvdDrives.value,
357
- isPowerOnByDefault.value,
358
- localization.value
359
- )
360
-
361
- wizard.setLoader(false)
362
- if (data) {
363
- stepHasError = true
364
- selectedNavItem.value = data[0]
365
- }
366
-
367
- return {
368
- stepHasError,
369
- newValue: value,
370
- }
371
- }
372
- const onFinish = (): void => {
373
- wizard.setLoader(false)
374
- props
375
- .finishFunc(
376
- vmForm.value,
377
- virtualHardwareCpu.value,
378
- virtualHardwareMemory.value,
379
- customizeHardware.value,
380
- virtualHardwareNetworks.value,
381
- virtualHardwareHardDisks.value,
382
- virtualHardwareCdDvdDrives.value,
383
- isPowerOnByDefault.value,
384
- localization.value
385
- )
386
- .then(() => {
387
- onHideModal()
388
- wizard.setLoader(false)
389
- })
390
- }
391
-
392
- const selectedNavItem = ref<UI_T_SelectedNavItem>(0)
393
-
394
- const nameFormSubmit = ref<null | Function>(null)
395
- const storageSubmit = ref<null | Function>(null)
396
- const selectOptionsSubmit = ref<number>(0)
397
- const customizeHardwareSubmit = ref<null | Function>(null)
398
-
399
- const vmSettings = computed<UI_I_VmSettings | null>(() => props.vmSettings)
400
- const vmName = ref<string>(vmSettings.value?.name || '')
401
- watch(vmSettings, (newValue) => {
402
- vmName.value = newValue?.name || ''
403
- })
404
-
405
- const onHideModal = (): void => {
406
- emits('hide')
407
- }
408
- </script>
409
-
410
- <style scoped lang="scss">
411
- :deep(.has-solid.close-icon.clr-icon) {
412
- width: 20px;
413
- top: 0;
414
- }
415
- .vm-context {
416
- padding: 16px 15px 10px 10px;
417
- height: 100%;
418
- display: flex;
419
- flex-direction: column;
420
-
421
- .context-title-wrap {
422
- padding-bottom: 3px;
423
- border-bottom: 1px solid #a6a6a6;
424
-
425
- h4 {
426
- font-weight: 700;
427
- font-size: 13px;
428
- color: var(--vm-context-title);
429
- }
430
- p {
431
- font-weight: 400;
432
- font-size: 13px;
433
- color: var(--vm-context-sub-title);
434
- }
435
- }
436
-
437
- .finish-block {
438
- padding: 18px 24px 24px 24px;
439
-
440
- .add-hosts-ready-to-complete-mt-12 {
441
- margin-top: 12px;
442
-
443
- .add-hosts-ready-to-complete-bold {
444
- line-height: 18px;
445
- font-weight: 700;
446
- }
447
- }
448
- }
449
-
450
- .vm-hardware-version {
451
- align-self: flex-end;
452
- margin-top: auto;
453
- }
454
- }
455
-
456
- :deep(.modal .modal-dialog .modal-content .modal-footer) {
457
- flex: unset;
458
- height: unset;
459
- min-height: unset;
460
- }
461
- :deep(.wizard-modal-titlebar h3) {
462
- color: #000;
463
- font-size: 24px;
464
- font-weight: 200;
465
- line-height: 27px;
466
- margin: 0;
467
- padding: 0;
468
- }
469
- :deep(.clr-wizard-stepnav-item) {
470
- padding-left: 0;
471
- }
472
- :deep(.clr-wizard-stepnav
473
- .clr-wizard-stepnav-item
474
- button
475
- .clr-wizard-stepnav-link-title) {
476
- width: 189px;
477
- font-weight: 700;
478
- font-size: 13px;
479
- }
480
-
481
- #vm-wizard-notification {
482
- h3 {
483
- color: var(--global-font-color7);
484
- margin-top: 6px;
485
- }
486
- p {
487
- color: var(--global-font-color6);
488
- line-height: 16px;
489
- }
490
- }
491
-
492
- .power-on-by-default-wrap {
493
- display: flex;
494
- align-items: center;
495
-
496
- input {
497
- margin-right: 6px;
498
- }
499
- }
500
- </style>
501
-
502
- <style>
503
- :root {
504
- --vm-context-title: #333;
505
- --vm-context-sub-title: #000;
506
- }
507
- :root.dark-theme {
508
- --vm-context-title: #adbbc4;
509
- --vm-context-sub-title: #adbbc4;
510
- }
511
- </style>
1
+ <template>
2
+ <div class="clone-vm">
3
+ <atoms-wizard
4
+ show
5
+ :wizard="wizard"
6
+ :selected-scheme="selectedScheme"
7
+ :title="localization.cloneExistingVirtualMachine"
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-vm-actions-common-select-name
17
+ v-show="selectedStep.id === 0"
18
+ :show="selectedStep.id === 0"
19
+ :name-form-submit="nameFormSubmit"
20
+ :project="props.project"
21
+ @submit="onChangeName(...$event)"
22
+ @check-name="emits('check-name', $event)"
23
+ />
24
+ <common-vm-actions-common-select-storage
25
+ v-show="selectedStep.id === 1"
26
+ :storage-submit="storageSubmit"
27
+ :datastore="props.datastore"
28
+ :storage="vmSettings.storage"
29
+ :get-datastore-table-func="props.getDatastoreTableFunc"
30
+ @submit="onChangeStorage"
31
+ />
32
+ <common-vm-actions-clone-select-options
33
+ v-show="selectedStep.id === 2"
34
+ :select-options-submit="selectOptionsSubmit"
35
+ @submit="onChangeSelectOptions"
36
+ />
37
+ <common-vm-actions-common-customize-hardware
38
+ v-show="selectedStep.id === 3"
39
+ v-model:vm-name="vmName"
40
+ v-model:guest-machine-type="vmSettings.guestMachineType"
41
+ v-model:guest-os-family="vmSettings.guestOsFamily"
42
+ v-model:guest-os-version="vmSettings.guestOsVersion"
43
+ :storage="vmSettings.storage"
44
+ :hard-disks-for-boot-options="virtualHardwareHardDisksLocal"
45
+ :cd-dvd-drives-for-boot-options="virtualHardwareCdDvdDrivesLocal"
46
+ :networks-for-boot-options="virtualHardwareNetworksLocal"
47
+ :cd-dvd-drives="vmSettings.cdDvdDrives"
48
+ :hard-disks="vmSettings.hardDisks"
49
+ :networks="vmSettings.networks"
50
+ :customize-hardware-submit="customizeHardwareSubmit"
51
+ :max-cpus="vmSettings.maxCpus"
52
+ :max-memory="vmSettings.maxMemory"
53
+ :cpu-models="vmSettings.cpuModels"
54
+ :cpu="vmSettings.cpu"
55
+ :memory="vmSettings.memory"
56
+ :video-card="vmSettings.videoCard"
57
+ :usb-controller="vmSettings.usbController"
58
+ :pci-devices="vmSettings.pciDevices"
59
+ :selected-nav-item="selectedNavItem"
60
+ :hard-disks-for-edit="vmSettings.hardDisks"
61
+ :options="vmSettings.options"
62
+ :nodes="props.nodes"
63
+ :files="props.files"
64
+ :networks-table="props.networksTable"
65
+ :error-validation-fields="props.errorValidationFields"
66
+ :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
67
+ :passthrough-devices="props.passthroughDevices"
68
+ :get-datastore-table-func="props.getDatastoreTableFunc"
69
+ :datastore="props.datastore"
70
+ :project="props.project"
71
+ is-clone
72
+ @change-boot-order="onChangeBootOrder"
73
+ @send-data="onChangeCustomizeHardware"
74
+ @get-storage="emits('get-storage', $event)"
75
+ @get-folders-or-files="emits('get-folders-or-files', $event)"
76
+ @get-active-device-child="emits('get-active-device-child', $event)"
77
+ @show-datastore-child="emits('show-datastore-child', $event)"
78
+ @get-networks-table="emits('get-networks-table', $event)"
79
+ @get-pci-devices="emits('get-pci-devices')"
80
+ />
81
+ <common-ready-to-complete
82
+ v-show="selectedStep.id === 4"
83
+ :data="props.readyCompleteTableInfo"
84
+ />
85
+ </div>
86
+ </template>
87
+ </atoms-wizard>
88
+ </div>
89
+ </template>
90
+
91
+ <script setup lang="ts">
92
+ import type {
93
+ UI_I_DatastoreTableItem,
94
+ UI_I_FolderOrFileTreePayload,
95
+ } from '~/lib/models/store/storage/interfaces'
96
+ import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
97
+ import type { API_UI_I_Error } from '~/lib/models/store/interfaces'
98
+ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
99
+ import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
100
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
101
+ import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
102
+ import type { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
103
+ import type {
104
+ UI_I_SendDataCpu,
105
+ UI_I_SendDataMemory,
106
+ UI_I_SendDataNewCdDvdDrive,
107
+ UI_I_SendDataNewHardDisk,
108
+ UI_I_SendDataNewNetwork,
109
+ } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
110
+ import type { UI_T_SelectedNavItem } from '~/components/common/vm/actions/common/lib/models/types'
111
+ import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
112
+ import type { UI_I_ConfigurePciDevicesTable } from '~/lib/models/store/host/interfaces'
113
+ import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/models/types'
114
+ import type { UI_T_Project } from '~/lib/models/types'
115
+ import type { UI_I_VmSettings } from '~/lib/models/store/vm/interfaces'
116
+ import type { UI_I_VmForm } from '~/components/common/vm/actions/clone/lib/models/interfaces'
117
+ import {
118
+ UI_I_ValidationReturn,
119
+ UI_I_WizardStep,
120
+ } from '~/components/atoms/wizard/lib/models/interfaces'
121
+ import {
122
+ stepsSchemeInitial,
123
+ stepsFunc,
124
+ } from '~/components/common/vm/actions/clone/lib/config/steps'
125
+ import Wizard from '~/components/atoms/wizard/lib/utils/utils'
126
+
127
+ const props = defineProps<{
128
+ project: UI_T_Project
129
+ vmSettings: UI_I_VmSettings | null
130
+ nodes: UI_I_FileTreeNode[]
131
+ files: UI_I_FileTreeNode[]
132
+ networksTable: UI_I_NetworkTableItem[]
133
+ datastore: UI_I_DatastoreTableItem[]
134
+ errorValidationFields: UI_I_ErrorValidationField[]
135
+ readyCompleteTableInfo: UI_I_TableInfoItem[]
136
+ vmCpuHelpTextSecond: string
137
+ finishFunc: any
138
+ getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
139
+ validateSendDataFunc: any
140
+ passthroughDevices: UI_I_ConfigurePciDevicesTable | null
141
+ vmNameInWizard: string
142
+ }>()
143
+
144
+ const emits = defineEmits<{
145
+ (event: 'check-name', value: [string, (error: API_UI_I_Error) => void]): void
146
+ (event: 'get-storage', value: UI_I_TablePayload): void
147
+ (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
148
+ (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
149
+ (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
150
+ (event: 'remove-error-by-title', value: string): void
151
+ (event: 'get-networks-table', value: UI_I_TablePayload): void
152
+ (event: 'get-pci-devices'): void
153
+ (event: 'hide'): void
154
+ }>()
155
+
156
+ const localization = computed<UI_I_Localization>(() => useLocal())
157
+
158
+ const wizard: Wizard = new Wizard(
159
+ stepsFunc(localization.value),
160
+ stepsSchemeInitial
161
+ )
162
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
163
+
164
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
165
+ wizard.changeSteps(value, validationFunc, validateSendData)
166
+ }
167
+
168
+ const validationFunc = async (
169
+ value: UI_I_WizardStep[],
170
+ currentStep: UI_I_WizardStep,
171
+ nextStep: UI_I_WizardStep
172
+ ): Promise<UI_I_ValidationReturn> => {
173
+ let stepHasError = false
174
+ let stepShouldStop = {
175
+ ifOnCurrentStep: false,
176
+ ifFromAnyStep: false,
177
+ stoppageStepId: -1,
178
+ }
179
+
180
+ wizard.setLoader(true)
181
+ if (wizard.isValidateForStep(0, currentStep.id, nextStep.id)) {
182
+ const nameValidation = await checkName(value)
183
+
184
+ value = nameValidation.newValue
185
+ stepHasError = stepHasError || nameValidation.stepHasError
186
+ } else if (wizard.isValidateForStep(1, currentStep.id, nextStep.id)) {
187
+ const storageValidation = await checkStorage(value)
188
+
189
+ value = storageValidation.newValue
190
+
191
+ stepHasError = stepHasError || storageValidation.stepHasError
192
+ } else if (wizard.isValidateForStep(2, currentStep.id, nextStep.id)) {
193
+ selectOptionsSubmit.value++
194
+ } else if (wizard.isValidateForStep(3, currentStep.id, nextStep.id)) {
195
+ const storageValidation = await checkCustomizeHardware(value)
196
+
197
+ value = storageValidation.newValue
198
+
199
+ stepHasError = stepHasError || storageValidation.stepHasError
200
+ }
201
+ wizard.setLoader(false)
202
+
203
+ return {
204
+ newValue: value,
205
+ stepHasError,
206
+ stepShouldStop,
207
+ }
208
+ }
209
+ const checkName = async (
210
+ value: UI_I_WizardStep[]
211
+ ): Promise<UI_I_ValidationReturn> => {
212
+ let stepHasError = false
213
+
214
+ return new Promise((resolve) => {
215
+ nameFormSubmit.value = (isValid: boolean) => {
216
+ if (!isValid) {
217
+ stepHasError = wizard.setValidation(0, 'name', {
218
+ fieldMessage: 'aaa',
219
+ alertMessage: 'aaa',
220
+ })
221
+ } else if (wizard.hasMessage(0, 'name')) {
222
+ value = wizard.removeValidation(0, 'name', value)
223
+ }
224
+
225
+ resolve({
226
+ stepHasError,
227
+ newValue: value,
228
+ })
229
+ nameFormSubmit.value = null
230
+ }
231
+ })
232
+ }
233
+ const checkStorage = async (
234
+ value: UI_I_WizardStep[]
235
+ ): Promise<UI_I_ValidationReturn> => {
236
+ let stepHasError = false
237
+
238
+ return new Promise((resolve) => {
239
+ storageSubmit.value = (isValid: boolean) => {
240
+ if (!isValid) {
241
+ stepHasError = wizard.setValidation(1, 'storage', {
242
+ fieldMessage: 'aaa',
243
+ alertMessage: 'aaa',
244
+ })
245
+ } else if (wizard.hasMessage(1, 'storage')) {
246
+ value = wizard.removeValidation(1, 'storage', value)
247
+ }
248
+
249
+ resolve({
250
+ stepHasError,
251
+ newValue: value,
252
+ })
253
+ storageSubmit.value = null
254
+ }
255
+ })
256
+ }
257
+ const checkCustomizeHardware = async (
258
+ value: UI_I_WizardStep[]
259
+ ): Promise<UI_I_ValidationReturn> => {
260
+ let stepHasError = false
261
+
262
+ return new Promise((resolve) => {
263
+ customizeHardwareSubmit.value = (isValid: boolean) => {
264
+ if (!isValid) {
265
+ stepHasError = wizard.setValidation(3, 'customizeHardware', {
266
+ fieldMessage: 'aaa',
267
+ alertMessage: 'aaa',
268
+ })
269
+ } else if (wizard.hasMessage(3, 'customizeHardware')) {
270
+ value = wizard.removeValidation(3, 'customizeHardware', value)
271
+ }
272
+
273
+ resolve({
274
+ stepHasError,
275
+ newValue: value,
276
+ })
277
+ storageSubmit.value = null
278
+ }
279
+ })
280
+ }
281
+
282
+ const storageIdCash = ref<string | null>(null)
283
+ const vmForm = ref<UI_I_VmForm>({
284
+ name: '',
285
+ storage: null,
286
+ options: [],
287
+ })
288
+ const onChangeName = (name: string): void => {
289
+ vmForm.value.name = name
290
+ }
291
+ const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
292
+ if (!storage) return
293
+
294
+ vmForm.value.storage = storage
295
+ storageIdCash.value = storage.id
296
+ }
297
+ const onChangeSelectOptions = (options: string[]): void => {
298
+ vmForm.value.options = options
299
+ }
300
+ const customizeHardware = ref<UI_I_SendDataCustomizeHardware | null>(null)
301
+ const onChangeCustomizeHardware = (
302
+ data: UI_I_SendDataCustomizeHardware
303
+ ): void => {
304
+ customizeHardware.value = data
305
+ }
306
+
307
+ const virtualHardwareHardDisksLocal = computed<
308
+ UI_I_SendDataNewHardDisk[] | null
309
+ >(() => customizeHardware.value?.virtualHardware?.hardDisks || null)
310
+ const virtualHardwareNetworksLocal = computed<UI_I_SendDataNewNetwork[] | null>(
311
+ () => customizeHardware.value?.virtualHardware?.networks || null
312
+ )
313
+ const virtualHardwareCdDvdDrivesLocal = computed<
314
+ UI_I_SendDataNewCdDvdDrive[] | null
315
+ >(() => customizeHardware.value?.virtualHardware?.cdDvdDrives || null)
316
+
317
+ const virtualHardwareCpu = computed<UI_I_SendDataCpu | null>(
318
+ () => customizeHardware.value?.virtualHardware?.cpu || null
319
+ )
320
+ const virtualHardwareMemory = computed<UI_I_SendDataMemory | null>(
321
+ () => customizeHardware.value?.virtualHardware?.memory || null
322
+ )
323
+ const virtualHardwareHardDisks = ref<UI_I_SendDataNewHardDisk[] | null>(null)
324
+ const virtualHardwareCdDvdDrives = ref<UI_I_SendDataNewCdDvdDrive[] | null>(
325
+ null
326
+ )
327
+ const virtualHardwareNetworks = ref<UI_I_SendDataNewNetwork[] | null>(null)
328
+ const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
329
+ virtualHardwareHardDisks.value = data[0]
330
+ virtualHardwareCdDvdDrives.value = data[1]
331
+ virtualHardwareNetworks.value = data[2]
332
+ }
333
+
334
+ const isPowerOnByDefault = ref<boolean>(true)
335
+
336
+ watch(
337
+ () => props.vmNameInWizard,
338
+ (newValue) => {
339
+ vmForm.value.name = newValue
340
+ }
341
+ )
342
+
343
+ const validateSendData = async (
344
+ value: UI_I_WizardStep[]
345
+ ): Promise<UI_I_ValidationReturn> => {
346
+ wizard.setLoader(true)
347
+ let stepHasError = false
348
+
349
+ const data = await props.validateSendDataFunc(
350
+ vmForm.value,
351
+ virtualHardwareCpu.value,
352
+ virtualHardwareMemory.value,
353
+ customizeHardware.value,
354
+ virtualHardwareNetworks.value,
355
+ virtualHardwareHardDisks.value,
356
+ virtualHardwareCdDvdDrives.value,
357
+ isPowerOnByDefault.value,
358
+ localization.value
359
+ )
360
+
361
+ wizard.setLoader(false)
362
+ if (data) {
363
+ stepHasError = true
364
+ selectedNavItem.value = data[0]
365
+ }
366
+
367
+ return {
368
+ stepHasError,
369
+ newValue: value,
370
+ }
371
+ }
372
+ const onFinish = (): void => {
373
+ wizard.setLoader(false)
374
+ props
375
+ .finishFunc(
376
+ vmForm.value,
377
+ virtualHardwareCpu.value,
378
+ virtualHardwareMemory.value,
379
+ customizeHardware.value,
380
+ virtualHardwareNetworks.value,
381
+ virtualHardwareHardDisks.value,
382
+ virtualHardwareCdDvdDrives.value,
383
+ isPowerOnByDefault.value,
384
+ localization.value
385
+ )
386
+ .then(() => {
387
+ onHideModal()
388
+ wizard.setLoader(false)
389
+ })
390
+ }
391
+
392
+ const selectedNavItem = ref<UI_T_SelectedNavItem>(0)
393
+
394
+ const nameFormSubmit = ref<null | Function>(null)
395
+ const storageSubmit = ref<null | Function>(null)
396
+ const selectOptionsSubmit = ref<number>(0)
397
+ const customizeHardwareSubmit = ref<null | Function>(null)
398
+
399
+ const vmSettings = computed<UI_I_VmSettings | null>(() => props.vmSettings)
400
+ const vmName = ref<string>(vmSettings.value?.name || '')
401
+ watch(vmSettings, (newValue) => {
402
+ vmName.value = newValue?.name || ''
403
+ })
404
+
405
+ const onHideModal = (): void => {
406
+ emits('hide')
407
+ }
408
+ </script>
409
+
410
+ <style scoped lang="scss">
411
+ :deep(.has-solid.close-icon.clr-icon) {
412
+ width: 20px;
413
+ top: 0;
414
+ }
415
+ .vm-context {
416
+ padding: 16px 15px 10px 10px;
417
+ height: 100%;
418
+ display: flex;
419
+ flex-direction: column;
420
+
421
+ .context-title-wrap {
422
+ padding-bottom: 3px;
423
+ border-bottom: 1px solid #a6a6a6;
424
+
425
+ h4 {
426
+ font-weight: 700;
427
+ font-size: 13px;
428
+ color: var(--vm-context-title);
429
+ }
430
+ p {
431
+ font-weight: 400;
432
+ font-size: 13px;
433
+ color: var(--vm-context-sub-title);
434
+ }
435
+ }
436
+
437
+ .finish-block {
438
+ padding: 18px 24px 24px 24px;
439
+
440
+ .add-hosts-ready-to-complete-mt-12 {
441
+ margin-top: 12px;
442
+
443
+ .add-hosts-ready-to-complete-bold {
444
+ line-height: 18px;
445
+ font-weight: 700;
446
+ }
447
+ }
448
+ }
449
+
450
+ .vm-hardware-version {
451
+ align-self: flex-end;
452
+ margin-top: auto;
453
+ }
454
+ }
455
+
456
+ :deep(.modal .modal-dialog .modal-content .modal-footer) {
457
+ flex: unset;
458
+ height: unset;
459
+ min-height: unset;
460
+ }
461
+ :deep(.wizard-modal-titlebar h3) {
462
+ color: #000;
463
+ font-size: 24px;
464
+ font-weight: 200;
465
+ line-height: 27px;
466
+ margin: 0;
467
+ padding: 0;
468
+ }
469
+ :deep(.clr-wizard-stepnav-item) {
470
+ padding-left: 0;
471
+ }
472
+ :deep(.clr-wizard-stepnav
473
+ .clr-wizard-stepnav-item
474
+ button
475
+ .clr-wizard-stepnav-link-title) {
476
+ width: 189px;
477
+ font-weight: 700;
478
+ font-size: 13px;
479
+ }
480
+
481
+ #vm-wizard-notification {
482
+ h3 {
483
+ color: var(--global-font-color7);
484
+ margin-top: 6px;
485
+ }
486
+ p {
487
+ color: var(--global-font-color6);
488
+ line-height: 16px;
489
+ }
490
+ }
491
+
492
+ .power-on-by-default-wrap {
493
+ display: flex;
494
+ align-items: center;
495
+
496
+ input {
497
+ margin-right: 6px;
498
+ }
499
+ }
500
+ </style>
501
+
502
+ <style>
503
+ :root {
504
+ --vm-context-title: #333;
505
+ --vm-context-sub-title: #000;
506
+ }
507
+ :root.dark-theme {
508
+ --vm-context-title: #adbbc4;
509
+ --vm-context-sub-title: #adbbc4;
510
+ }
511
+ </style>