bfg-common 1.2.44 → 1.2.45

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/tools/Tools.vue +1 -1
  38. package/components/common/monitor/overview/filters/Filters.vue +17 -10
  39. package/components/common/monitor/overview/filters/customIntervalModal/CustomIntervalModal.vue +29 -8
  40. package/components/common/monitor/overview/filters/customIntervalModal/config/dateChecker.ts +18 -16
  41. package/components/common/perPage/PerPage.vue +51 -51
  42. package/components/common/recursionTree/RecursionTree.vue +201 -201
  43. package/components/common/vm/actions/add/config/capabilities.ts +338 -338
  44. package/components/common/vm/actions/add/customizeHardware/virtualHardware/VirtualHardware.vue +657 -657
  45. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/CoresPerSocket.vue +109 -109
  46. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/Cpu.vue +383 -383
  47. package/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/Limit.vue +234 -234
  48. package/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/config/options.ts +28 -28
  49. package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/Memory.vue +316 -316
  50. package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/config/memoryOptions.ts +35 -35
  51. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +445 -445
  52. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +288 -288
  53. package/components/common/vm/actions/add/customizeHardware/virtualHardware/reservation/Reservation.vue +235 -235
  54. package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/VideoCard.vue +177 -177
  55. package/components/common/vm/actions/add/customizeHardware/vmoptions/bootOptions/order/Order.vue +197 -197
  56. package/components/common/vm/actions/add/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +181 -181
  57. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/CopyPaste.vue +51 -51
  58. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/RemoteConsoleOptions.vue +253 -253
  59. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +55 -55
  60. package/components/common/vm/actions/add/select/storage/config/config.ts +154 -154
  61. package/components/common/vm/actions/clone/Clone.vue +545 -545
  62. package/components/common/vm/actions/clone/select/options/Options.vue +65 -65
  63. package/components/common/vm/actions/clone/utils.ts +43 -43
  64. package/components/common/wizards/datastore/add/nfs/Nfs.vue +94 -94
  65. package/components/common/wizards/datastore/add/nfs/configuration/Configuration.vue +377 -377
  66. package/components/common/wizards/datastore/add/nfs/configuration/serversList/ServersList.vue +123 -123
  67. package/components/common/wizards/datastore/add/nfs/kerberosAuthentication/KerberosAuthentication.vue +54 -54
  68. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/hostTable/HostTable.vue +131 -131
  69. package/components/common/wizards/datastore/add/sharedStorm/partitionConfiguration/PartitionConfiguration.vue +230 -230
  70. package/composables/useLocal.ts +38 -38
  71. package/minify.js +146 -146
  72. package/models/store/interfaces.ts +37 -37
  73. package/models/store/storage/interfaces.ts +32 -32
  74. package/models/store/types.ts +32 -32
  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,545 +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="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>
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>