bfg-common 1.2.19 → 1.2.21

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 (75) 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 +58 -0
  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/perPage/PerPage.vue +51 -51
  38. package/components/common/recursionTree/RecursionTree.vue +201 -201
  39. package/components/common/vm/actions/add/config/capabilities.ts +338 -338
  40. package/components/common/vm/actions/add/customizeHardware/virtualHardware/VirtualHardware.vue +657 -657
  41. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/CoresPerSocket.vue +109 -109
  42. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/Cpu.vue +383 -383
  43. package/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/Limit.vue +234 -234
  44. package/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/config/options.ts +28 -28
  45. package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/Memory.vue +316 -316
  46. package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/config/memoryOptions.ts +35 -35
  47. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +445 -445
  48. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +288 -288
  49. package/components/common/vm/actions/add/customizeHardware/virtualHardware/reservation/Reservation.vue +235 -235
  50. package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/VideoCard.vue +177 -177
  51. package/components/common/vm/actions/add/customizeHardware/vmoptions/bootOptions/order/Order.vue +197 -197
  52. package/components/common/vm/actions/add/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +181 -181
  53. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/CopyPaste.vue +51 -51
  54. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/RemoteConsoleOptions.vue +253 -253
  55. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +55 -55
  56. package/components/common/vm/actions/add/select/storage/config/config.ts +154 -154
  57. package/components/common/vm/actions/clone/Clone.vue +544 -544
  58. package/components/common/vm/actions/clone/select/options/Options.vue +65 -65
  59. package/components/common/vm/actions/clone/utils.ts +43 -43
  60. package/components/common/wizards/datastore/add/nfs/configuration/Configuration.vue +373 -373
  61. package/components/common/wizards/datastore/add/nfs/configuration/serversList/ServersList.vue +123 -123
  62. package/components/common/wizards/datastore/add/nfs/kerberosAuthentication/KerberosAuthentication.vue +54 -54
  63. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/hostTable/HostTable.vue +131 -131
  64. package/components/common/wizards/datastore/add/sharedStorm/partitionConfiguration/PartitionConfiguration.vue +230 -230
  65. package/composables/useLocal.ts +38 -38
  66. package/minify.js +146 -146
  67. package/models/store/interfaces.ts +37 -37
  68. package/models/store/storage/interfaces.ts +32 -32
  69. package/models/store/types.ts +32 -32
  70. package/modules/fixContentBuild/utils/methods.ts +114 -114
  71. package/package.json +1 -1
  72. package/public/spice-console/application/codec.js +257 -257
  73. package/public/spice-console/lib/rasterEngine.js +907 -907
  74. package/public/spice-console/network/spicechannel.js +369 -369
  75. package/utils/contentBuild.ts +34 -34
@@ -1,544 +1,544 @@
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="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>