bfg-common 1.2.39 → 1.2.42

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 (80) hide show
  1. package/components/atoms/alert/Notification.vue +167 -167
  2. package/components/atoms/autocomplete/Autocomplete.vue +236 -236
  3. package/components/atoms/datepicker/Datepicker.vue +612 -612
  4. package/components/atoms/list/SelectList.vue +62 -62
  5. package/components/atoms/nav/NavBar.vue +116 -116
  6. package/components/atoms/nav/VerticalNavBar.vue +89 -89
  7. package/components/atoms/notificationBar/NotificationBar.vue +175 -175
  8. package/components/atoms/perPage/PerPage.vue +52 -52
  9. package/components/atoms/popup/SimplePopup.vue +90 -90
  10. package/components/atoms/step/VerticalStep.vue +104 -104
  11. package/components/atoms/switch/Switch.vue +107 -107
  12. package/components/atoms/table/dataGrid/DataGridColumnSwitch.vue +206 -206
  13. package/components/atoms/table/dataGrid/DataGridPage.vue +189 -189
  14. package/components/atoms/tabs/Tabs.vue +189 -189
  15. package/components/atoms/tooltip/Signpost.vue +224 -224
  16. package/components/common/BadBrowser.vue +114 -114
  17. package/components/common/adapterManager/AddAdapterWarningModal.vue +82 -82
  18. package/components/common/adapterManager/NoActiveAdaptersModal.vue +62 -62
  19. package/components/common/adapterManager/NoConnectedActiveAdaptersModal.vue +62 -62
  20. package/components/common/browse/Browse.vue +182 -182
  21. package/components/common/browse/blocks/Title.vue +66 -66
  22. package/components/common/diagramMain/Diagram.vue +186 -186
  23. package/components/common/diagramMain/DiagramMain.vue +986 -986
  24. package/components/common/diagramMain/adapter/AdapterItem.vue +227 -227
  25. package/components/common/diagramMain/adapter/AdapterItems.vue +57 -57
  26. package/components/common/diagramMain/modals/editSettings/tabs/port/IpvFourSettings.vue +339 -339
  27. package/components/common/diagramMain/modals/editSettings/tabs/port/PortProperties.vue +202 -202
  28. package/components/common/diagramMain/modals/remove/RemoveModal.vue +226 -226
  29. package/components/common/diagramMain/network/Contents.vue +238 -238
  30. package/components/common/feedback/Buttons.vue +232 -232
  31. package/components/common/feedback/Message.vue +468 -468
  32. package/components/common/feedback/VisitPortal.vue +54 -54
  33. package/components/common/help/navbar/left/Left.vue +159 -159
  34. package/components/common/help/navbar/left/utils/constructAccordion.ts +27 -27
  35. package/components/common/mainNavigationPanel/MainNavigationPanel.vue +359 -359
  36. package/components/common/modals/Rename.vue +165 -165
  37. package/components/common/monitor/advanced/Advanced.vue +235 -235
  38. package/components/common/monitor/advanced/tools/chartOptionsModal/models/interfaces.ts +19 -19
  39. package/components/common/perPage/PerPage.vue +51 -51
  40. package/components/common/recursionTree/RecursionTree.vue +201 -201
  41. package/components/common/vm/actions/add/config/capabilities.ts +338 -338
  42. package/components/common/vm/actions/add/customizeHardware/virtualHardware/VirtualHardware.vue +657 -657
  43. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/CoresPerSocket.vue +109 -109
  44. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/Cpu.vue +383 -383
  45. package/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/Limit.vue +234 -234
  46. package/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/config/options.ts +28 -28
  47. package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/Memory.vue +316 -316
  48. package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/config/memoryOptions.ts +35 -35
  49. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +445 -445
  50. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +288 -288
  51. package/components/common/vm/actions/add/customizeHardware/virtualHardware/reservation/Reservation.vue +235 -235
  52. package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/VideoCard.vue +177 -177
  53. package/components/common/vm/actions/add/customizeHardware/vmoptions/bootOptions/order/Order.vue +197 -197
  54. package/components/common/vm/actions/add/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +181 -181
  55. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/CopyPaste.vue +51 -51
  56. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/RemoteConsoleOptions.vue +253 -253
  57. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +55 -55
  58. package/components/common/vm/actions/add/select/storage/config/config.ts +154 -154
  59. package/components/common/vm/actions/clone/Clone.vue +545 -544
  60. package/components/common/vm/actions/clone/readyToComplete/ReadyToComplete.vue +15 -0
  61. package/components/common/vm/actions/clone/select/options/Options.vue +65 -65
  62. package/components/common/vm/actions/clone/utils.ts +43 -43
  63. package/components/common/wizards/datastore/add/nfs/Nfs.vue +94 -94
  64. package/components/common/wizards/datastore/add/nfs/configuration/Configuration.vue +377 -377
  65. package/components/common/wizards/datastore/add/nfs/configuration/serversList/ServersList.vue +123 -123
  66. package/components/common/wizards/datastore/add/nfs/kerberosAuthentication/KerberosAuthentication.vue +54 -54
  67. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/hostTable/HostTable.vue +131 -131
  68. package/components/common/wizards/datastore/add/sharedStorm/partitionConfiguration/PartitionConfiguration.vue +230 -230
  69. package/composables/useLocal.ts +38 -38
  70. package/minify.js +146 -146
  71. package/models/store/interfaces.ts +37 -37
  72. package/models/store/storage/interfaces.ts +32 -32
  73. package/models/store/types.ts +32 -32
  74. package/models/store/vm/interfaces.ts +6 -0
  75. package/modules/fixContentBuild/utils/methods.ts +114 -114
  76. package/package.json +1 -1
  77. package/public/spice-console/application/codec.js +257 -257
  78. package/public/spice-console/lib/rasterEngine.js +907 -907
  79. package/public/spice-console/network/spicechannel.js +369 -369
  80. package/utils/contentBuild.ts +34 -34
@@ -1,544 +1,545 @@
1
- <template>
2
- <div class="clone-vm">
3
- <atoms-modal-by-steps
4
- test-id="clone-vm-wizard"
5
- :show="true"
6
- :title="localization.cloneExistingVirtualMachine"
7
- :step-items="stepItems"
8
- :step-position="stepPosition"
9
- :loading="loading"
10
- @change-step="onChangeStep"
11
- @hide="onHideModal"
12
- >
13
- <template #modalBody>
14
- <atoms-loader v-show="!vmSettings || loading" id="loader" />
15
- <div v-if="vmSettings" class="vm-context">
16
- <div class="context-title-wrap">
17
- <p>{{ stepSubTitle }}</p>
18
- </div>
19
-
20
- <common-vm-actions-add-select-name
21
- v-show="stepPosition === 0"
22
- :show="stepPosition === 0"
23
- :name-form-submit="nameFormSubmit"
24
- :project="props.project"
25
- @submit="onChangeNameAndNext(...$event)"
26
- @check-name="emits('check-name', $event)"
27
- @loading="loading = $event"
28
- />
29
- <common-vm-actions-add-select-storage
30
- v-show="stepPosition === 1"
31
- :storage-submit="storageSubmit"
32
- :datastore="props.datastore"
33
- :get-datastore-table-func="props.getDatastoreTableFunc"
34
- @submit="onChangeStorageAndNext"
35
- />
36
- <common-vm-actions-clone-select-options
37
- v-show="stepPosition === 2"
38
- :select-options-submit="selectOptionsSubmit"
39
- @submit="onChangeSelectOptionsAndNext"
40
- />
41
- <common-vm-actions-add-customize-hardware
42
- v-show="stepPosition === 3"
43
- v-model:vm-name="vmName"
44
- v-model:guest-machine-type="vmSettings.guestMachineType"
45
- v-model:guest-os-family="vmSettings.guestOsFamily"
46
- v-model:guest-os-version="vmSettings.guestOsVersion"
47
- :storage="vmSettings.storage"
48
- :hard-disks-for-boot-options="virtualHardwareHardDisksLocal"
49
- :cd-dvd-drives-for-boot-options="virtualHardwareCdDvdDrivesLocal"
50
- :networks-for-boot-options="virtualHardwareNetworksLocal"
51
- :cd-dvd-drives="vmSettings.cdDvdDrives"
52
- :hard-disks="vmSettings.hardDisks"
53
- :networks="vmSettings.networks"
54
- :customize-hardware-submit="0"
55
- :max-cpus="vmSettings.maxCpus"
56
- :max-memory="vmSettings.maxMemory"
57
- :cpu-models="vmSettings.cpuModels"
58
- :cpu="vmSettings.cpu"
59
- :memory="vmSettings.memory"
60
- :video-card="vmSettings.videoCard"
61
- :usb-controller="vmSettings.usbController"
62
- :pci-devices="vmSettings.pciDevices"
63
- :selected-nav-item="selectedNavItem"
64
- :hard-disks-for-edit="vmSettings.hardDisks"
65
- :options="vmSettings.options"
66
- :nodes="props.nodes"
67
- :files="props.files"
68
- :networks-table="props.networksTable"
69
- :error-validation-fields="props.errorValidationFields"
70
- :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
71
- :passthrough-devices="props.passthroughDevices"
72
- :get-datastore-table-func="props.getDatastoreTableFunc"
73
- :datastore="props.datastore"
74
- is-clone
75
- @get-storage="emits('get-storage', $event)"
76
- @get-folders-or-files="emits('get-folders-or-files', $event)"
77
- @get-active-device-child="emits('get-active-device-child', $event)"
78
- @show-datastore-child="emits('show-datastore-child', $event)"
79
- @get-networks-table="emits('get-networks-table', $event)"
80
- @get-pci-devices="emits('get-pci-devices')"
81
- @change-boot-order="onChangeBootOrder"
82
- @send-data="onChangeCustomizeHardware"
83
- />
84
- <common-vm-actions-clone-ready-to-complete
85
- v-if="stepPosition === 4"
86
- :ready-complete-table-info="props.readyCompleteTableInfo"
87
- />
88
- </div>
89
- </template>
90
-
91
- <template #modalFooter>
92
- <div class="flex-align-center flex-space-between w-100">
93
- <div class="power-on-by-default-wrap">
94
- <template v-if="stepPosition === 4">
95
- <input
96
- id="power-on-by-default"
97
- v-model="isPowerOnByDefault"
98
- type="checkbox"
99
- />
100
- <label for="power-on-by-default" class="label-text-normal">{{
101
- localization.powerOnByDefault
102
- }}</label>
103
- </template>
104
- </div>
105
- <div class="flex-align-center">
106
- <button
107
- id="vm-wizard-cancel-button"
108
- class="btn btn-link"
109
- @click="onHideModal"
110
- >
111
- {{ localization.cancel }}
112
- </button>
113
- <button
114
- v-show="stepPosition > 0"
115
- id="vm-wizard-back-button"
116
- class="btn btn-outline"
117
- @click="onBack"
118
- >
119
- {{ localization.back }}
120
- </button>
121
- <button
122
- v-if="stepPosition === stepItems.length - 1"
123
- id="vm-wizard-finish-button"
124
- class="btn btn-success"
125
- @click="onFinish"
126
- >
127
- {{ localization.finish }}
128
- </button>
129
- <button
130
- v-else
131
- id="vm-wizard-next-button"
132
- class="btn btn-primary"
133
- @click="onNext(false)"
134
- >
135
- {{ localization.next }}
136
- </button>
137
- </div>
138
- </div>
139
- </template>
140
- </atoms-modal-by-steps>
141
- </div>
142
- </template>
143
-
144
- <script setup lang="ts">
145
- import type {
146
- UI_I_DatastoreTableItem,
147
- UI_I_FolderOrFileTreePayload,
148
- } from '~/models/store/storage/interfaces'
149
- import type { UI_I_NetworkTableItem } from '~/models/store/network/interfaces'
150
- import type {
151
- API_UI_I_Error,
152
- UI_I_TablePayload,
153
- } from '~/models/store/interfaces'
154
- import type { UI_I_FileTreeNode } from '~/components/models/interfaces'
155
- import type { UI_I_Localization } from '~/models/interfaces'
156
- import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/add/customizeHardware/models/interfaces'
157
- import type { UI_I_ErrorValidationField } from '~/models/store/interfaces'
158
- import type {
159
- UI_I_SendDataCpu,
160
- UI_I_SendDataMemory,
161
- UI_I_SendDataNewCdDvdDrive,
162
- UI_I_SendDataNewHardDisk,
163
- UI_I_SendDataNewNetwork,
164
- } from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/models/interfaces'
165
- import type {
166
- UI_T_AddVmFinishFunc,
167
- UI_T_SelectedNavItem,
168
- } from '~/components/common/vm/actions/add/models/types'
169
- import type {
170
- UI_I_OptionItem,
171
- UI_I_VerticalStepItem,
172
- } from '~/components/atoms/models/interfaces'
173
- import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/models/interfaces'
174
- import type { UI_I_ConfigurePciDevicesTable } from '~/models/store/host/interfaces'
175
- import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/models/types'
176
- import type { UI_T_Project } from '~/models/types'
177
- import type { UI_I_VmSettings } from '~/models/store/vm/interfaces'
178
- import type { UI_I_VmForm } from '~/components/common/vm/actions/clone/models/interfaces'
179
- import { capabilities } from '~/components/common/vm/actions/add/config/capabilities'
180
- import {
181
- stepItemsFunc,
182
- subTitleFunc,
183
- } from '~/components/common/vm/actions/clone/utils'
184
-
185
- const props = defineProps<{
186
- project: UI_T_Project
187
- vmSettings: UI_I_VmSettings | null
188
- nodes: UI_I_FileTreeNode[]
189
- files: UI_I_FileTreeNode[]
190
- networksTable: UI_I_NetworkTableItem[]
191
- datastore: UI_I_DatastoreTableItem[]
192
- errorValidationFields: UI_I_ErrorValidationField[]
193
- readyCompleteTableInfo: UI_I_TableInfoItem[]
194
- vmCpuHelpTextSecond: string
195
- finishFunc: any
196
- getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
197
- validateSendDataFunc: any
198
- passthroughDevices: UI_I_ConfigurePciDevicesTable | null
199
- vmNameInWizard: string
200
- }>()
201
-
202
- const emits = defineEmits<{
203
- (event: 'check-name', value: [string, (error: API_UI_I_Error) => void]): void
204
- (event: 'get-storage', value: UI_I_TablePayload): void
205
- (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
206
- (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
207
- (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
208
- (event: 'remove-error-by-title', value: string): void
209
- (event: 'get-networks-table', value: UI_I_TablePayload): void
210
- (event: 'get-pci-devices'): void
211
- (event: 'hide'): void
212
- }>()
213
-
214
- const localization = computed<UI_I_Localization>(() => useLocal())
215
-
216
- const stepPosition = ref<number>(0)
217
- watch(stepPosition, (newValue) => {
218
- if (newValue === 4) validateSendData()
219
- })
220
- const stepItems = ref<UI_I_VerticalStepItem[]>([])
221
- stepItems.value = stepItemsFunc(localization.value, props.project)
222
-
223
- const subTitle: string[] = subTitleFunc(localization.value, props.project)
224
- const stepSubTitle = computed<string>(() => subTitle[stepPosition.value])
225
-
226
- const storageIdCash = ref<string | null>(null)
227
- const vmForm = ref<UI_I_VmForm>({
228
- name: '',
229
- storage: null,
230
- options: [],
231
- })
232
-
233
- const isPowerOnByDefault = ref<boolean>(true)
234
-
235
- const onChangeNameAndNext = (name: string): void => {
236
- checkLocalChangeAndChangeStepStatus()
237
-
238
- vmForm.value.name = name
239
- onNext(true)
240
- }
241
-
242
- const onChangeStorageAndNext = (
243
- storage: UI_I_DatastoreTableItem | null
244
- ): void => {
245
- if (!storage) return
246
-
247
- const hasChanges = storage.id !== storageIdCash.value
248
- if (hasChanges) checkLocalChangeAndChangeStepStatus()
249
-
250
- vmForm.value.storage = storage
251
- storageIdCash.value = storage.id
252
-
253
- onNext(true)
254
- }
255
-
256
- const onChangeSelectOptionsAndNext = (options: string[]): void => {
257
- vmForm.value.options = options
258
-
259
- onNext(true)
260
- }
261
-
262
- const customizeHardware = ref<UI_I_SendDataCustomizeHardware | null>(null)
263
- const onChangeCustomizeHardware = (
264
- data: UI_I_SendDataCustomizeHardware
265
- ): void => {
266
- customizeHardware.value = data
267
- }
268
-
269
- const virtualHardwareHardDisksLocal = computed<
270
- UI_I_SendDataNewHardDisk[] | null
271
- >(() => customizeHardware.value?.virtualHardware?.hardDisks || null)
272
- const virtualHardwareNetworksLocal = computed<UI_I_SendDataNewNetwork[] | null>(
273
- () => customizeHardware.value?.virtualHardware?.networks || null
274
- )
275
- const virtualHardwareCdDvdDrivesLocal = computed<
276
- UI_I_SendDataNewCdDvdDrive[] | null
277
- >(() => customizeHardware.value?.virtualHardware?.cdDvdDrives || null)
278
-
279
- const virtualHardwareCpu = computed<UI_I_SendDataCpu | null>(
280
- () => customizeHardware.value?.virtualHardware?.cpu || null
281
- )
282
- const virtualHardwareMemory = computed<UI_I_SendDataMemory | null>(
283
- () => customizeHardware.value?.virtualHardware?.memory || null
284
- )
285
- const virtualHardwareHardDisks = ref<UI_I_SendDataNewHardDisk[] | null>(null)
286
- const virtualHardwareCdDvdDrives = ref<UI_I_SendDataNewCdDvdDrive[] | null>(
287
- null
288
- )
289
- const virtualHardwareNetworks = ref<UI_I_SendDataNewNetwork[] | null>(null)
290
- const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
291
- virtualHardwareHardDisks.value = data[0]
292
- virtualHardwareCdDvdDrives.value = data[1]
293
- virtualHardwareNetworks.value = data[2]
294
- }
295
-
296
- watch(
297
- () => props.vmNameInWizard,
298
- (newValue) => {
299
- vmForm.value.name = newValue
300
- }
301
- )
302
-
303
- const loading = ref<boolean>(false)
304
- const validateSendData = (): void => {
305
- loading.value = true
306
- props
307
- .validateSendDataFunc(
308
- vmForm.value,
309
- virtualHardwareCpu.value,
310
- virtualHardwareMemory.value,
311
- customizeHardware.value,
312
- virtualHardwareNetworks.value,
313
- virtualHardwareHardDisks.value,
314
- virtualHardwareCdDvdDrives.value,
315
- isPowerOnByDefault.value,
316
- localization.value
317
- )
318
- .then((data) => {
319
- loading.value = false
320
- if (!data) return
321
-
322
- selectedNavItem.value = data[0]
323
- data[1] !== null && (stepPosition.value = data[1])
324
- })
325
- }
326
- const onFinish = (): void => {
327
- loading.value = true
328
- props
329
- .finishFunc(
330
- vmForm.value,
331
- virtualHardwareCpu.value,
332
- virtualHardwareMemory.value,
333
- customizeHardware.value,
334
- virtualHardwareNetworks.value,
335
- virtualHardwareHardDisks.value,
336
- virtualHardwareCdDvdDrives.value,
337
- isPowerOnByDefault.value,
338
- localization.value
339
- )
340
- .then(() => {
341
- onHideModal()
342
- loading.value = false
343
- })
344
- }
345
-
346
- const selectedNavItem = ref<UI_T_SelectedNavItem>(0)
347
-
348
- const nameFormSubmit = ref<number>(0)
349
- const storageSubmit = ref<number>(0)
350
- const selectOptionsSubmit = ref<number>(0)
351
- const customizeHardwareSubmit = ref<number>(0)
352
-
353
- const onNext = (force = false): void => {
354
- const isValid = checkSubmit(force)
355
- if (!isValid) {
356
- return
357
- }
358
-
359
- const isDisabled = stepItems.value[cashStep]?.disabled
360
- if (cashStep !== -1 && !isDisabled) {
361
- stepPosition.value = cashStep
362
- cashStep = -1
363
- return
364
- }
365
-
366
- stepItems.value[stepPosition.value].complete = true
367
- stepItems.value[stepPosition.value + 1].disabled = false
368
- stepPosition.value++
369
- }
370
- const checkLocalChangeAndChangeStepStatus = (): void => {
371
- stepItems.value = stepItems.value.map((step, index) => {
372
- if (index > stepPosition.value) {
373
- step.complete = false
374
- step.disabled = index > stepPosition.value + 1
375
- }
376
-
377
- return step
378
- })
379
- }
380
-
381
- const checkSubmit = (force = false): boolean => {
382
- if (stepPosition.value === 0 && !force) {
383
- nameFormSubmit.value++
384
- return false
385
- }
386
- if (stepPosition.value === 1 && !force) {
387
- storageSubmit.value++
388
- return false
389
- }
390
- if (stepPosition.value === 2 && !force) {
391
- selectOptionsSubmit.value++
392
- return false
393
- }
394
- if (stepPosition.value === 3 && !force) {
395
- customizeHardwareSubmit.value++
396
- return false
397
- }
398
- return true
399
- }
400
- const checkSubmitByManual = (step: number): boolean => {
401
- if (stepPosition.value === 0) {
402
- nameFormSubmit.value++
403
- return false
404
- }
405
- if (stepPosition.value === 1) {
406
- storageSubmit.value++
407
- return false
408
- }
409
- if (step === 5) {
410
- customizeHardwareSubmit.value++
411
- return false
412
- }
413
- return true
414
- }
415
- const onBack = (): void => {
416
- stepPosition.value--
417
- }
418
- let cashStep = -1
419
- const onChangeStep = (key: number): void => {
420
- const isValid = checkSubmitByManual(key)
421
- if (!isValid) {
422
- cashStep = key
423
- return
424
- }
425
-
426
- stepPosition.value = key
427
- }
428
-
429
- const compatibility = ref<UI_I_OptionItem[]>(capabilities.compatibility)
430
- const maxMemory = ref<number>(capabilities.maxMemory)
431
-
432
- const vmSettings = computed<UI_I_VmSettings | null>(() => props.vmSettings)
433
- const vmName = ref<string>(vmSettings.value?.name || '')
434
- watch(vmSettings, (newValue) => {
435
- vmName.value = newValue?.name || ''
436
- })
437
-
438
- const onHideModal = (): void => {
439
- emits('hide')
440
- }
441
- </script>
442
-
443
- <style scoped lang="scss">
444
- :deep(.has-solid.close-icon.clr-icon) {
445
- width: 20px;
446
- top: 0;
447
- }
448
- .vm-context {
449
- padding: 16px 15px 10px 10px;
450
- height: 100%;
451
- display: flex;
452
- flex-direction: column;
453
-
454
- .context-title-wrap {
455
- padding-bottom: 3px;
456
- border-bottom: 1px solid #a6a6a6;
457
-
458
- h4 {
459
- font-weight: 700;
460
- font-size: 13px;
461
- color: var(--vm-context-title);
462
- }
463
- p {
464
- font-weight: 400;
465
- font-size: 13px;
466
- color: var(--vm-context-sub-title);
467
- }
468
- }
469
-
470
- .finish-block {
471
- padding: 18px 24px 24px 24px;
472
-
473
- .add-hosts-ready-to-complete-mt-12 {
474
- margin-top: 12px;
475
-
476
- .add-hosts-ready-to-complete-bold {
477
- line-height: 18px;
478
- font-weight: 700;
479
- }
480
- }
481
- }
482
-
483
- .vm-hardware-version {
484
- align-self: flex-end;
485
- margin-top: auto;
486
- }
487
- }
488
-
489
- :deep(.modal .modal-dialog .modal-content .modal-footer) {
490
- flex: unset;
491
- height: unset;
492
- min-height: unset;
493
- }
494
- :deep(.wizard-modal-titlebar h3) {
495
- color: #000;
496
- font-size: 24px;
497
- font-weight: 200;
498
- line-height: 27px;
499
- margin: 0;
500
- padding: 0;
501
- }
502
- :deep(.clr-wizard-stepnav-item) {
503
- padding-left: 0;
504
- }
505
- :deep(.clr-wizard-stepnav
506
- .clr-wizard-stepnav-item
507
- button
508
- .clr-wizard-stepnav-link-title) {
509
- width: 189px;
510
- font-weight: 700;
511
- font-size: 13px;
512
- }
513
-
514
- #vm-wizard-notification {
515
- h3 {
516
- color: var(--global-font-color7);
517
- margin-top: 6px;
518
- }
519
- p {
520
- color: var(--global-font-color6);
521
- line-height: 16px;
522
- }
523
- }
524
-
525
- .power-on-by-default-wrap {
526
- display: flex;
527
- align-items: center;
528
-
529
- input {
530
- margin-right: 6px;
531
- }
532
- }
533
- </style>
534
-
535
- <style>
536
- :root {
537
- --vm-context-title: #333;
538
- --vm-context-sub-title: #000;
539
- }
540
- :root.dark-theme {
541
- --vm-context-title: #adbbc4;
542
- --vm-context-sub-title: #adbbc4;
543
- }
544
- </style>
1
+ <template>
2
+ <div class="clone-vm">
3
+ <atoms-modal-by-steps
4
+ test-id="clone-vm-wizard"
5
+ :show="true"
6
+ :title="localization.cloneExistingVirtualMachine"
7
+ :step-items="stepItems"
8
+ :step-position="stepPosition"
9
+ :loading="loading"
10
+ @change-step="onChangeStep"
11
+ @hide="onHideModal"
12
+ >
13
+ <template #modalBody>
14
+ <atoms-loader v-show="!vmSettings || loading" id="loader" />
15
+ <div v-if="vmSettings" class="vm-context">
16
+ <div class="context-title-wrap">
17
+ <p>{{ stepSubTitle }}</p>
18
+ </div>
19
+
20
+ <common-vm-actions-add-select-name
21
+ v-show="stepPosition === 0"
22
+ :show="stepPosition === 0"
23
+ :name-form-submit="nameFormSubmit"
24
+ :project="props.project"
25
+ @submit="onChangeNameAndNext(...$event)"
26
+ @check-name="emits('check-name', $event)"
27
+ @loading="loading = $event"
28
+ />
29
+ <common-vm-actions-add-select-storage
30
+ v-show="stepPosition === 1"
31
+ :storage-submit="storageSubmit"
32
+ :datastore="props.datastore"
33
+ :get-datastore-table-func="props.getDatastoreTableFunc"
34
+ @submit="onChangeStorageAndNext"
35
+ />
36
+ <common-vm-actions-clone-select-options
37
+ v-show="stepPosition === 2"
38
+ :select-options-submit="selectOptionsSubmit"
39
+ @submit="onChangeSelectOptionsAndNext"
40
+ />
41
+ <common-vm-actions-add-customize-hardware
42
+ v-show="stepPosition === 3"
43
+ v-model:vm-name="vmName"
44
+ v-model:guest-machine-type="vmSettings.guestMachineType"
45
+ v-model:guest-os-family="vmSettings.guestOsFamily"
46
+ v-model:guest-os-version="vmSettings.guestOsVersion"
47
+ :storage="vmSettings.storage"
48
+ :hard-disks-for-boot-options="virtualHardwareHardDisksLocal"
49
+ :cd-dvd-drives-for-boot-options="virtualHardwareCdDvdDrivesLocal"
50
+ :networks-for-boot-options="virtualHardwareNetworksLocal"
51
+ :cd-dvd-drives="vmSettings.cdDvdDrives"
52
+ :hard-disks="vmSettings.hardDisks"
53
+ :networks="vmSettings.networks"
54
+ :customize-hardware-submit="customizeHardwareSubmit"
55
+ :max-cpus="vmSettings.maxCpus"
56
+ :max-memory="vmSettings.maxMemory"
57
+ :cpu-models="vmSettings.cpuModels"
58
+ :cpu="vmSettings.cpu"
59
+ :memory="vmSettings.memory"
60
+ :video-card="vmSettings.videoCard"
61
+ :usb-controller="vmSettings.usbController"
62
+ :pci-devices="vmSettings.pciDevices"
63
+ :selected-nav-item="selectedNavItem"
64
+ :hard-disks-for-edit="vmSettings.hardDisks"
65
+ :options="vmSettings.options"
66
+ :nodes="props.nodes"
67
+ :files="props.files"
68
+ :networks-table="props.networksTable"
69
+ :error-validation-fields="props.errorValidationFields"
70
+ :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
71
+ :passthrough-devices="props.passthroughDevices"
72
+ :get-datastore-table-func="props.getDatastoreTableFunc"
73
+ :datastore="props.datastore"
74
+ is-clone
75
+ @change-boot-order="onChangeBootOrder"
76
+ @send-data="onChangeCustomizeHardware"
77
+ @get-storage="emits('get-storage', $event)"
78
+ @get-folders-or-files="emits('get-folders-or-files', $event)"
79
+ @get-active-device-child="emits('get-active-device-child', $event)"
80
+ @show-datastore-child="emits('show-datastore-child', $event)"
81
+ @get-networks-table="emits('get-networks-table', $event)"
82
+ @get-pci-devices="emits('get-pci-devices')"
83
+ @next="onNext(true)"
84
+ />
85
+ <common-vm-actions-clone-ready-to-complete
86
+ v-if="stepPosition === 4"
87
+ :ready-complete-table-info="props.readyCompleteTableInfo"
88
+ />
89
+ </div>
90
+ </template>
91
+
92
+ <template #modalFooter>
93
+ <div class="flex-align-center flex-space-between w-100">
94
+ <div class="power-on-by-default-wrap">
95
+ <template v-if="stepPosition === 4">
96
+ <input
97
+ id="power-on-by-default"
98
+ v-model="isPowerOnByDefault"
99
+ type="checkbox"
100
+ />
101
+ <label for="power-on-by-default" class="label-text-normal">{{
102
+ localization.powerOnByDefault
103
+ }}</label>
104
+ </template>
105
+ </div>
106
+ <div class="flex-align-center">
107
+ <button
108
+ id="vm-wizard-cancel-button"
109
+ class="btn btn-link"
110
+ @click="onHideModal"
111
+ >
112
+ {{ localization.cancel }}
113
+ </button>
114
+ <button
115
+ v-show="stepPosition > 0"
116
+ id="vm-wizard-back-button"
117
+ class="btn btn-outline"
118
+ @click="onBack"
119
+ >
120
+ {{ localization.back }}
121
+ </button>
122
+ <button
123
+ v-if="stepPosition === stepItems.length - 1"
124
+ id="vm-wizard-finish-button"
125
+ class="btn btn-success"
126
+ @click="onFinish"
127
+ >
128
+ {{ localization.finish }}
129
+ </button>
130
+ <button
131
+ v-else
132
+ id="vm-wizard-next-button"
133
+ class="btn btn-primary"
134
+ @click="onNext(false)"
135
+ >
136
+ {{ localization.next }}
137
+ </button>
138
+ </div>
139
+ </div>
140
+ </template>
141
+ </atoms-modal-by-steps>
142
+ </div>
143
+ </template>
144
+
145
+ <script setup lang="ts">
146
+ import type {
147
+ UI_I_DatastoreTableItem,
148
+ UI_I_FolderOrFileTreePayload,
149
+ } from '~/models/store/storage/interfaces'
150
+ import type { UI_I_NetworkTableItem } from '~/models/store/network/interfaces'
151
+ import type {
152
+ API_UI_I_Error,
153
+ UI_I_TablePayload,
154
+ } from '~/models/store/interfaces'
155
+ import type { UI_I_FileTreeNode } from '~/components/models/interfaces'
156
+ import type { UI_I_Localization } from '~/models/interfaces'
157
+ import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/add/customizeHardware/models/interfaces'
158
+ import type { UI_I_ErrorValidationField } from '~/models/store/interfaces'
159
+ import type {
160
+ UI_I_SendDataCpu,
161
+ UI_I_SendDataMemory,
162
+ UI_I_SendDataNewCdDvdDrive,
163
+ UI_I_SendDataNewHardDisk,
164
+ UI_I_SendDataNewNetwork,
165
+ } from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/models/interfaces'
166
+ import type {
167
+ UI_T_AddVmFinishFunc,
168
+ UI_T_SelectedNavItem,
169
+ } from '~/components/common/vm/actions/add/models/types'
170
+ import type {
171
+ UI_I_OptionItem,
172
+ UI_I_VerticalStepItem,
173
+ } from '~/components/atoms/models/interfaces'
174
+ import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/models/interfaces'
175
+ import type { UI_I_ConfigurePciDevicesTable } from '~/models/store/host/interfaces'
176
+ import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/models/types'
177
+ import type { UI_T_Project } from '~/models/types'
178
+ import type { UI_I_VmSettings } from '~/models/store/vm/interfaces'
179
+ import type { UI_I_VmForm } from '~/components/common/vm/actions/clone/models/interfaces'
180
+ import { capabilities } from '~/components/common/vm/actions/add/config/capabilities'
181
+ import {
182
+ stepItemsFunc,
183
+ subTitleFunc,
184
+ } from '~/components/common/vm/actions/clone/utils'
185
+
186
+ const props = defineProps<{
187
+ project: UI_T_Project
188
+ vmSettings: UI_I_VmSettings | null
189
+ nodes: UI_I_FileTreeNode[]
190
+ files: UI_I_FileTreeNode[]
191
+ networksTable: UI_I_NetworkTableItem[]
192
+ datastore: UI_I_DatastoreTableItem[]
193
+ errorValidationFields: UI_I_ErrorValidationField[]
194
+ readyCompleteTableInfo: UI_I_TableInfoItem[]
195
+ vmCpuHelpTextSecond: string
196
+ finishFunc: any
197
+ getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
198
+ validateSendDataFunc: any
199
+ passthroughDevices: UI_I_ConfigurePciDevicesTable | null
200
+ vmNameInWizard: string
201
+ }>()
202
+
203
+ const emits = defineEmits<{
204
+ (event: 'check-name', value: [string, (error: API_UI_I_Error) => void]): void
205
+ (event: 'get-storage', value: UI_I_TablePayload): void
206
+ (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
207
+ (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
208
+ (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
209
+ (event: 'remove-error-by-title', value: string): void
210
+ (event: 'get-networks-table', value: UI_I_TablePayload): void
211
+ (event: 'get-pci-devices'): void
212
+ (event: 'hide'): void
213
+ }>()
214
+
215
+ const localization = computed<UI_I_Localization>(() => useLocal())
216
+
217
+ const stepPosition = ref<number>(0)
218
+ watch(stepPosition, (newValue) => {
219
+ if (newValue === 4) validateSendData()
220
+ })
221
+ const stepItems = ref<UI_I_VerticalStepItem[]>([])
222
+ stepItems.value = stepItemsFunc(localization.value, props.project)
223
+
224
+ const subTitle: string[] = subTitleFunc(localization.value, props.project)
225
+ const stepSubTitle = computed<string>(() => subTitle[stepPosition.value])
226
+
227
+ const storageIdCash = ref<string | null>(null)
228
+ const vmForm = ref<UI_I_VmForm>({
229
+ name: '',
230
+ storage: null,
231
+ options: [],
232
+ })
233
+
234
+ const isPowerOnByDefault = ref<boolean>(true)
235
+
236
+ const onChangeNameAndNext = (name: string): void => {
237
+ checkLocalChangeAndChangeStepStatus()
238
+
239
+ vmForm.value.name = name
240
+ onNext(true)
241
+ }
242
+
243
+ const onChangeStorageAndNext = (
244
+ storage: UI_I_DatastoreTableItem | null
245
+ ): void => {
246
+ if (!storage) return
247
+
248
+ const hasChanges = storage.id !== storageIdCash.value
249
+ if (hasChanges) checkLocalChangeAndChangeStepStatus()
250
+
251
+ vmForm.value.storage = storage
252
+ storageIdCash.value = storage.id
253
+
254
+ onNext(true)
255
+ }
256
+
257
+ const onChangeSelectOptionsAndNext = (options: string[]): void => {
258
+ vmForm.value.options = options
259
+
260
+ onNext(true)
261
+ }
262
+
263
+ const customizeHardware = ref<UI_I_SendDataCustomizeHardware | null>(null)
264
+ const onChangeCustomizeHardware = (
265
+ data: UI_I_SendDataCustomizeHardware
266
+ ): void => {
267
+ customizeHardware.value = data
268
+ }
269
+
270
+ const virtualHardwareHardDisksLocal = computed<
271
+ UI_I_SendDataNewHardDisk[] | null
272
+ >(() => customizeHardware.value?.virtualHardware?.hardDisks || null)
273
+ const virtualHardwareNetworksLocal = computed<UI_I_SendDataNewNetwork[] | null>(
274
+ () => customizeHardware.value?.virtualHardware?.networks || null
275
+ )
276
+ const virtualHardwareCdDvdDrivesLocal = computed<
277
+ UI_I_SendDataNewCdDvdDrive[] | null
278
+ >(() => customizeHardware.value?.virtualHardware?.cdDvdDrives || null)
279
+
280
+ const virtualHardwareCpu = computed<UI_I_SendDataCpu | null>(
281
+ () => customizeHardware.value?.virtualHardware?.cpu || null
282
+ )
283
+ const virtualHardwareMemory = computed<UI_I_SendDataMemory | null>(
284
+ () => customizeHardware.value?.virtualHardware?.memory || null
285
+ )
286
+ const virtualHardwareHardDisks = ref<UI_I_SendDataNewHardDisk[] | null>(null)
287
+ const virtualHardwareCdDvdDrives = ref<UI_I_SendDataNewCdDvdDrive[] | null>(
288
+ null
289
+ )
290
+ const virtualHardwareNetworks = ref<UI_I_SendDataNewNetwork[] | null>(null)
291
+ const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
292
+ virtualHardwareHardDisks.value = data[0]
293
+ virtualHardwareCdDvdDrives.value = data[1]
294
+ virtualHardwareNetworks.value = data[2]
295
+ }
296
+
297
+ watch(
298
+ () => props.vmNameInWizard,
299
+ (newValue) => {
300
+ vmForm.value.name = newValue
301
+ }
302
+ )
303
+
304
+ const loading = ref<boolean>(false)
305
+ const validateSendData = (): void => {
306
+ loading.value = true
307
+ props
308
+ .validateSendDataFunc(
309
+ vmForm.value,
310
+ virtualHardwareCpu.value,
311
+ virtualHardwareMemory.value,
312
+ customizeHardware.value,
313
+ virtualHardwareNetworks.value,
314
+ virtualHardwareHardDisks.value,
315
+ virtualHardwareCdDvdDrives.value,
316
+ isPowerOnByDefault.value,
317
+ localization.value
318
+ )
319
+ .then((data) => {
320
+ loading.value = false
321
+ if (!data) return
322
+
323
+ selectedNavItem.value = data[0]
324
+ data[1] !== null && (stepPosition.value = data[1])
325
+ })
326
+ }
327
+ const onFinish = (): void => {
328
+ loading.value = true
329
+ props
330
+ .finishFunc(
331
+ vmForm.value,
332
+ virtualHardwareCpu.value,
333
+ virtualHardwareMemory.value,
334
+ customizeHardware.value,
335
+ virtualHardwareNetworks.value,
336
+ virtualHardwareHardDisks.value,
337
+ virtualHardwareCdDvdDrives.value,
338
+ isPowerOnByDefault.value,
339
+ localization.value
340
+ )
341
+ .then(() => {
342
+ onHideModal()
343
+ loading.value = false
344
+ })
345
+ }
346
+
347
+ const selectedNavItem = ref<UI_T_SelectedNavItem>(0)
348
+
349
+ const nameFormSubmit = ref<number>(0)
350
+ const storageSubmit = ref<number>(0)
351
+ const selectOptionsSubmit = ref<number>(0)
352
+ const customizeHardwareSubmit = ref<number>(0)
353
+
354
+ const onNext = (force = false): void => {
355
+ const isValid = checkSubmit(force)
356
+ if (!isValid) {
357
+ return
358
+ }
359
+
360
+ const isDisabled = stepItems.value[cashStep]?.disabled
361
+ if (cashStep !== -1 && !isDisabled) {
362
+ stepPosition.value = cashStep
363
+ cashStep = -1
364
+ return
365
+ }
366
+
367
+ stepItems.value[stepPosition.value].complete = true
368
+ stepItems.value[stepPosition.value + 1].disabled = false
369
+ stepPosition.value++
370
+ }
371
+ const checkLocalChangeAndChangeStepStatus = (): void => {
372
+ stepItems.value = stepItems.value.map((step, index) => {
373
+ if (index > stepPosition.value) {
374
+ step.complete = false
375
+ step.disabled = index > stepPosition.value + 1
376
+ }
377
+
378
+ return step
379
+ })
380
+ }
381
+
382
+ const checkSubmit = (force = false): boolean => {
383
+ if (stepPosition.value === 0 && !force) {
384
+ nameFormSubmit.value++
385
+ return false
386
+ }
387
+ if (stepPosition.value === 1 && !force) {
388
+ storageSubmit.value++
389
+ return false
390
+ }
391
+ if (stepPosition.value === 2 && !force) {
392
+ selectOptionsSubmit.value++
393
+ return false
394
+ }
395
+ if (stepPosition.value === 3 && !force) {
396
+ customizeHardwareSubmit.value++
397
+ return false
398
+ }
399
+ return true
400
+ }
401
+ const checkSubmitByManual = (step: number): boolean => {
402
+ if (stepPosition.value === 0) {
403
+ nameFormSubmit.value++
404
+ return false
405
+ }
406
+ if (stepPosition.value === 1) {
407
+ storageSubmit.value++
408
+ return false
409
+ }
410
+ if (step === 3) {
411
+ customizeHardwareSubmit.value++
412
+ return false
413
+ }
414
+ return true
415
+ }
416
+ const onBack = (): void => {
417
+ stepPosition.value--
418
+ }
419
+ let cashStep = -1
420
+ const onChangeStep = (key: number): void => {
421
+ const isValid = checkSubmitByManual(key)
422
+ if (!isValid) {
423
+ cashStep = key
424
+ return
425
+ }
426
+
427
+ stepPosition.value = key
428
+ }
429
+
430
+ const compatibility = ref<UI_I_OptionItem[]>(capabilities.compatibility)
431
+ const maxMemory = ref<number>(capabilities.maxMemory)
432
+
433
+ const vmSettings = computed<UI_I_VmSettings | null>(() => props.vmSettings)
434
+ const vmName = ref<string>(vmSettings.value?.name || '')
435
+ watch(vmSettings, (newValue) => {
436
+ vmName.value = newValue?.name || ''
437
+ })
438
+
439
+ const onHideModal = (): void => {
440
+ emits('hide')
441
+ }
442
+ </script>
443
+
444
+ <style scoped lang="scss">
445
+ :deep(.has-solid.close-icon.clr-icon) {
446
+ width: 20px;
447
+ top: 0;
448
+ }
449
+ .vm-context {
450
+ padding: 16px 15px 10px 10px;
451
+ height: 100%;
452
+ display: flex;
453
+ flex-direction: column;
454
+
455
+ .context-title-wrap {
456
+ padding-bottom: 3px;
457
+ border-bottom: 1px solid #a6a6a6;
458
+
459
+ h4 {
460
+ font-weight: 700;
461
+ font-size: 13px;
462
+ color: var(--vm-context-title);
463
+ }
464
+ p {
465
+ font-weight: 400;
466
+ font-size: 13px;
467
+ color: var(--vm-context-sub-title);
468
+ }
469
+ }
470
+
471
+ .finish-block {
472
+ padding: 18px 24px 24px 24px;
473
+
474
+ .add-hosts-ready-to-complete-mt-12 {
475
+ margin-top: 12px;
476
+
477
+ .add-hosts-ready-to-complete-bold {
478
+ line-height: 18px;
479
+ font-weight: 700;
480
+ }
481
+ }
482
+ }
483
+
484
+ .vm-hardware-version {
485
+ align-self: flex-end;
486
+ margin-top: auto;
487
+ }
488
+ }
489
+
490
+ :deep(.modal .modal-dialog .modal-content .modal-footer) {
491
+ flex: unset;
492
+ height: unset;
493
+ min-height: unset;
494
+ }
495
+ :deep(.wizard-modal-titlebar h3) {
496
+ color: #000;
497
+ font-size: 24px;
498
+ font-weight: 200;
499
+ line-height: 27px;
500
+ margin: 0;
501
+ padding: 0;
502
+ }
503
+ :deep(.clr-wizard-stepnav-item) {
504
+ padding-left: 0;
505
+ }
506
+ :deep(.clr-wizard-stepnav
507
+ .clr-wizard-stepnav-item
508
+ button
509
+ .clr-wizard-stepnav-link-title) {
510
+ width: 189px;
511
+ font-weight: 700;
512
+ font-size: 13px;
513
+ }
514
+
515
+ #vm-wizard-notification {
516
+ h3 {
517
+ color: var(--global-font-color7);
518
+ margin-top: 6px;
519
+ }
520
+ p {
521
+ color: var(--global-font-color6);
522
+ line-height: 16px;
523
+ }
524
+ }
525
+
526
+ .power-on-by-default-wrap {
527
+ display: flex;
528
+ align-items: center;
529
+
530
+ input {
531
+ margin-right: 6px;
532
+ }
533
+ }
534
+ </style>
535
+
536
+ <style>
537
+ :root {
538
+ --vm-context-title: #333;
539
+ --vm-context-sub-title: #000;
540
+ }
541
+ :root.dark-theme {
542
+ --vm-context-title: #adbbc4;
543
+ --vm-context-sub-title: #adbbc4;
544
+ }
545
+ </style>