bfg-common 1.5.555 → 1.5.557

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 (64) hide show
  1. package/assets/localization/local_be.json +20 -4
  2. package/assets/localization/local_en.json +20 -4
  3. package/assets/localization/local_hy.json +20 -4
  4. package/assets/localization/local_kk.json +20 -4
  5. package/assets/localization/local_ru.json +20 -4
  6. package/assets/localization/local_zh.json +21 -5
  7. package/components/common/modals/confirmByInput/ConfirmByInput.vue +9 -1
  8. package/components/common/modals/confirmByInput/ConfirmByInputNew.vue +7 -2
  9. package/components/common/pages/backups/modals/createBackup/New.vue +8 -2
  10. package/components/common/pages/backups/modals/restore/Restore.vue +9 -5
  11. package/components/common/pages/backups/modals/restore/RestoreNew.vue +13 -3
  12. package/components/common/pages/backups/modals/restore/RestoreOld.vue +6 -18
  13. package/components/common/vm/actions/add/Add.vue +119 -46
  14. package/components/common/vm/actions/add/New.vue +54 -16
  15. package/components/common/vm/actions/add/Old.vue +55 -16
  16. package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +78 -13
  17. package/components/common/vm/actions/common/customizeHardware/CustomizeHardwareNew.vue +52 -7
  18. package/components/common/vm/actions/common/customizeHardware/CustomizeHardwareOld.vue +52 -8
  19. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue +96 -62
  20. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardwareNew.vue +24 -13
  21. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardwareOld.vue +25 -14
  22. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Cpu.vue +159 -139
  23. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CpuNew.vue +15 -8
  24. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CpuOld.vue +13 -8
  25. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +75 -62
  26. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbController.vue +17 -6
  27. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbControllerNew.vue +3 -6
  28. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbControllerOld.vue +3 -6
  29. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCard.vue +39 -17
  30. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCardNew.vue +5 -6
  31. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCardOld.vue +5 -6
  32. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/lib/config/options.ts +4 -4
  33. package/components/common/vm/actions/common/customizeHardware/vmoptions/Vmoptions.vue +93 -6
  34. package/components/common/vm/actions/common/customizeHardware/vmoptions/VmoptionsNew.vue +62 -8
  35. package/components/common/vm/actions/common/customizeHardware/vmoptions/VmoptionsOld.vue +60 -8
  36. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptions.vue +69 -5
  37. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptionsNew.vue +32 -12
  38. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptionsOld.vue +33 -12
  39. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +132 -114
  40. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/OrderNew.vue +6 -41
  41. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/OrderOld.vue +6 -44
  42. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +23 -8
  43. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptionsNew.vue +31 -21
  44. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptionsOld.vue +34 -26
  45. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/New.vue +34 -28
  46. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/Old.vue +30 -24
  47. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/RemoteConsoleOptions.vue +112 -8
  48. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +3 -3
  49. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/{New.vue → KeymapNew.vue} +6 -6
  50. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/{Old.vue → KeymapOld.vue} +5 -5
  51. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/Password.vue +7 -6
  52. package/components/common/vm/actions/common/customizeHardware/vmoptions/tools/Tools.vue +38 -4
  53. package/components/common/vm/actions/common/customizeHardware/vmoptions/tools/ToolsNew.vue +26 -7
  54. package/components/common/vm/actions/common/customizeHardware/vmoptions/tools/ToolsOld.vue +50 -24
  55. package/components/common/vm/actions/common/lib/models/interfaces.ts +25 -57
  56. package/components/common/vm/actions/editSettings/EditSettings.vue +33 -10
  57. package/components/common/vm/actions/editSettings/EditSettingsOld.vue +30 -2
  58. package/components/common/vm/actions/editSettings/new/New.vue +30 -2
  59. package/components/common/vm/actions/lib/models/interfaces.ts +29 -4
  60. package/components/common/vm/actions/lib/utils.ts +32 -37
  61. package/package.json +3 -1
  62. package/store/tasks/mappers/recentTasks.ts +4 -0
  63. /package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/{New.vue → PasswordNew.vue} +0 -0
  64. /package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/{Old.vue → PasswordOld.vue} +0 -0
@@ -1,7 +1,6 @@
1
1
  <template>
2
2
  <common-vm-actions-common-customize-hardware-virtual-hardware-new
3
3
  v-if="isNewView"
4
- v-model="model"
5
4
  v-model:cpu-invalid="cpuInvalid"
6
5
  v-model:memory-invalid="memoryInvalid"
7
6
  v-model:video-card-invalid="videoCardInvalid"
@@ -10,6 +9,7 @@
10
9
  :is-edit="props.isEdit"
11
10
  :storage="props.storage"
12
11
  :project="props.project"
12
+ :max-cpus="props.maxCpus"
13
13
  :max-memory="props.maxMemory"
14
14
  :cpu-models="props.cpuModels"
15
15
  :datastore="props.datastore"
@@ -27,12 +27,15 @@
27
27
  :cd-dvd-drives-index="cdDvdDrivesIndex"
28
28
  :error-validation-fields="errorValidationFields"
29
29
  :get-datastore-table-func="getDatastoreTableFunc"
30
+ :cpu="cpu"
30
31
  :state="state"
32
+ :memory="memory"
31
33
  :networks="networksLocal"
32
34
  :hard-disks="hardDisksLocal"
33
35
  :video-card="videoCard"
34
36
  :pci-devices="pciDevicesLocal"
35
37
  :cd-dvd-drives="cdDvdDrivesLocal"
38
+ :usb-controller="usbController"
36
39
  :guest-machine-type="guestMachineType"
37
40
  :passthrough-devices="passthroughDevices"
38
41
  :mediated-devices="mediatedDevices"
@@ -52,19 +55,22 @@
52
55
  @remove-cd-dvd-drive="onRemoveCdDvdDrive(...$event)"
53
56
  @show-datastore-child="emits('show-datastore-child', $event)"
54
57
  @get-folders-or-files="emits('get-folders-or-files', $event)"
58
+ @send-data-cpu-method="onSendDataCpuMethod"
55
59
  @set-invalid-hard-disk="onSetInvalidHardDisk(...$event)"
56
60
  @remove-error-by-title="emits('remove-error-by-title', $event)"
57
61
  @roll-back-cd-dvd-drive="onRollBackCdDvdDrive"
58
62
  @set-invalid-pci-device="onSetInvalidPciDevice(...$event)"
59
63
  @get-active-device-child="emits('get-active-device-child', $event)"
64
+ @send-data-memory-method="onSendDataMemoryMethod"
65
+ @send-data-video-card-method="onSendDataVideoCardMethod"
60
66
  @send-data-new-network-method="sendDataNewNetworkMethod(...$event)"
61
67
  @send-data-pci-devices-method="onSendDataPciDevicesMethod(...$event)"
62
68
  @send-data-new-hard-disk-method="onSendDataNewHardDiskMethod(...$event)"
63
69
  @send-data-new-cd-dvd-drive-method="sendDataNewCdDvdDriveMethod(...$event)"
70
+ @send-data-new-usb-controller-method="onSendDataNewUsbControllerMethod"
64
71
  />
65
72
  <common-vm-actions-common-customize-hardware-virtual-hardware-old
66
73
  v-else
67
- v-model="model"
68
74
  v-model:cpu-invalid="cpuInvalid"
69
75
  v-model:memory-invalid="memoryInvalid"
70
76
  v-model:video-card-invalid="videoCardInvalid"
@@ -73,6 +79,7 @@
73
79
  :is-edit="props.isEdit"
74
80
  :storage="props.storage"
75
81
  :project="props.project"
82
+ :max-cpus="props.maxCpus"
76
83
  :max-memory="props.maxMemory"
77
84
  :cpu-models="props.cpuModels"
78
85
  :datastore="props.datastore"
@@ -90,12 +97,15 @@
90
97
  :cd-dvd-drives-index="cdDvdDrivesIndex"
91
98
  :error-validation-fields="errorValidationFields"
92
99
  :get-datastore-table-func="getDatastoreTableFunc"
100
+ :cpu="cpu"
93
101
  :state="state"
102
+ :memory="memory"
94
103
  :networks="networksLocal"
95
104
  :hard-disks="hardDisksLocal"
96
105
  :video-card="videoCard"
97
106
  :pci-devices="pciDevicesLocal"
98
107
  :cd-dvd-drives="cdDvdDrivesLocal"
108
+ :usb-controller="usbController"
99
109
  :guest-machine-type="guestMachineType"
100
110
  :passthrough-devices="passthroughDevices"
101
111
  :mediated-devices="mediatedDevices"
@@ -114,15 +124,19 @@
114
124
  @remove-cd-dvd-drive="onRemoveCdDvdDrive(...$event)"
115
125
  @show-datastore-child="emits('show-datastore-child', $event)"
116
126
  @get-folders-or-files="emits('get-folders-or-files', $event)"
127
+ @send-data-cpu-method="onSendDataCpuMethod"
117
128
  @set-invalid-hard-disk="onSetInvalidHardDisk(...$event)"
118
129
  @remove-error-by-title="emits('remove-error-by-title', $event)"
119
130
  @roll-back-cd-dvd-drive="onRollBackCdDvdDrive"
120
131
  @set-invalid-pci-device="onSetInvalidPciDevice(...$event)"
121
132
  @get-active-device-child="emits('get-active-device-child', $event)"
133
+ @send-data-memory-method="onSendDataMemoryMethod"
134
+ @send-data-video-card-method="onSendDataVideoCardMethod"
122
135
  @send-data-new-network-method="sendDataNewNetworkMethod(...$event)"
123
136
  @send-data-pci-devices-method="onSendDataPciDevicesMethod(...$event)"
124
137
  @send-data-new-hard-disk-method="onSendDataNewHardDiskMethod(...$event)"
125
138
  @send-data-new-cd-dvd-drive-method="sendDataNewCdDvdDriveMethod(...$event)"
139
+ @send-data-new-usb-controller-method="onSendDataNewUsbControllerMethod"
126
140
  />
127
141
  </template>
128
142
 
@@ -134,10 +148,13 @@ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
134
148
  import type { UI_I_FolderOrFileTreePayload } from '~/lib/models/store/storage/interfaces'
135
149
  import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
136
150
  import type {
151
+ UI_I_SendDataCpu,
152
+ UI_I_SendDataMemory,
137
153
  UI_I_SendDataNewHardDisk,
138
154
  UI_I_SendDataNewNetwork,
139
155
  UI_I_SendDataVideoCard,
140
156
  UI_I_InvalidKeys,
157
+ UI_I_SendDataVirtualHardware,
141
158
  UI_I_SendDataNewCdDvdDrive,
142
159
  // UI_I_HardDisk,
143
160
  UI_I_SendDataNewPciDevice,
@@ -155,23 +172,23 @@ import type {
155
172
  } from '~/components/atoms/dropdown/tree/lib/models/interfaces'
156
173
  import type { UI_I_Localization } from '~/lib/models/interfaces'
157
174
  import type {
175
+ API_UI_I_VmEditCpu,
176
+ API_UI_I_VmEditMemory,
158
177
  UI_I_MediatedDevice,
159
178
  UI_I_PciDevice,
160
179
  } from '~/lib/models/store/vm/interfaces'
161
180
  import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
162
- import type { UI_I_CreateVmData } from '~/components/common/vm/actions/common/lib/models/interfaces'
163
181
  import { dropdownItemsFunc } from './lib/config/dropdownItems'
164
182
 
165
- const model = defineModel<UI_I_CreateVmData>({ required: true })
166
-
167
183
  const props = withDefaults(
168
184
  defineProps<{
169
185
  storage: UI_I_DatastoreTableItem | null
170
186
  cpuModels: UI_I_OptionItem[]
187
+ maxCpus: number
171
188
  maxMemory: number
172
189
  isEdit: boolean
173
190
  isClone: boolean
174
- errorValidationFields: UI_I_ErrorValidationField[]
191
+ errorValidationFields: UI_I_ErrorValidationField<string>[]
175
192
  nodes: UI_I_FileTreeNode[]
176
193
  files: UI_I_FileTreeNode[]
177
194
  networksTable: UI_I_NetworkTableItem[]
@@ -180,11 +197,14 @@ const props = withDefaults(
180
197
  isDatastoreLoading: boolean
181
198
  project: UI_T_Project
182
199
  state?: string | number
200
+ cpu?: API_UI_I_VmEditCpu
201
+ memory?: API_UI_I_VmEditMemory
183
202
  vmCpuHelpTextSecond?: string
184
203
  hardDisks?: UI_I_SendDataNewHardDisk[] | null
185
204
  cdDvdDrives?: UI_I_SendDataNewCdDvdDrive[] | null
186
205
  networks?: UI_I_SendDataNewNetwork[] | null
187
206
  videoCard?: UI_I_SendDataVideoCard
207
+ usbController?: string
188
208
  pciDevices?: UI_I_SendDataNewPciDevice[]
189
209
  passthroughDevices?: UI_I_PciDevice[]
190
210
  mediatedDevices?: UI_I_MediatedDevice[]
@@ -194,11 +214,14 @@ const props = withDefaults(
194
214
  }>(),
195
215
  {
196
216
  state: undefined,
217
+ cpu: undefined,
218
+ memory: undefined,
197
219
  vmCpuHelpTextSecond: undefined,
198
220
  hardDisks: undefined,
199
221
  cdDvdDrives: undefined,
200
222
  networks: undefined,
201
223
  videoCard: undefined,
224
+ usbController: undefined,
202
225
  pciDevices: undefined,
203
226
  passthroughDevices: undefined,
204
227
  mediatedDevices: undefined,
@@ -208,6 +231,7 @@ const props = withDefaults(
208
231
  }
209
232
  )
210
233
  const emits = defineEmits<{
234
+ (event: 'send-data', value: UI_I_SendDataVirtualHardware): void
211
235
  (event: 'invalid', value: string[]): void
212
236
  (event: 'get-storage', value: UI_I_TablePayload): void
213
237
  (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
@@ -277,18 +301,6 @@ const addHardDisk = (
277
301
  let provisionType = 'thick'
278
302
  if (provisioned_type === 1) provisionType = 'thin'
279
303
 
280
- model.value.disk_devices = [
281
- ...model.value.disk_devices.filter((disk) => disk.device_type !== 'cdrom'),
282
- {
283
- create,
284
- size,
285
- source,
286
- attach: true,
287
- boot_order: 0, // Убираем галочку
288
- provision_type: provisionType,
289
- },
290
- ...model.value.disk_devices.filter((disk) => disk.device_type === 'cdrom'),
291
- ]
292
304
  hardDisksLocal.value.push({
293
305
  create,
294
306
  size,
@@ -297,6 +309,7 @@ const addHardDisk = (
297
309
  boot_order: 0, // Убираем галочку
298
310
  provision_type: provisionType,
299
311
  })
312
+ sendData()
300
313
  }
301
314
  const onAddExistHardDisk = (file: UI_I_FileTreeNode): void => {
302
315
  addHardDisk(
@@ -318,6 +331,7 @@ const onRemoveHardDisk = (
318
331
  if (key === removeIndex) return 'removed'
319
332
  return item
320
333
  })
334
+ sendData()
321
335
  return
322
336
  }
323
337
 
@@ -326,11 +340,6 @@ const onRemoveHardDisk = (
326
340
  (_item, key) => key !== removeIndex
327
341
  )
328
342
 
329
- model.value.disk_devices = model.value.disk_devices.filter(
330
- (_hardDisk, key: number) => {
331
- return removeIndex !== key
332
- }
333
- )
334
343
  hardDisksLocal.value = hardDisksLocal.value.filter(
335
344
  (_hardDisk, key: number) => {
336
345
  return removeIndex !== key
@@ -338,6 +347,8 @@ const onRemoveHardDisk = (
338
347
  )
339
348
 
340
349
  delete newHardDiskInvalidKeys.value[index]
350
+ delete sendDataNewHardDisk.value[index]
351
+ sendData()
341
352
  }
342
353
  const onRollBackHardDisk = (index: number): void => {
343
354
  const removeIndex = hardDisksIndex.value.indexOf(index)
@@ -389,10 +400,6 @@ const addNetwork = (): void => {
389
400
  networksIndex.value.push(index)
390
401
  networksType.value.push('new')
391
402
 
392
- model.value.network_devices.push({
393
- ...useDeepCopy(defaultNetwork),
394
- boot_order: 0, // Убираем галочку
395
- })
396
403
  networksLocal.value.push({
397
404
  ...useDeepCopy(defaultNetwork),
398
405
  boot_order: 0, // Убираем галочку
@@ -404,14 +411,13 @@ const onRemoveNetwork = (index: number): void => {
404
411
  networksType.value = networksType.value.filter(
405
412
  (_item, key) => key !== removeIndex
406
413
  )
407
- model.value.network_devices = model.value.network_devices.filter(
408
- (_network, key: number) => removeIndex !== key
409
- )
410
414
  networksLocal.value = networksLocal.value.filter(
411
415
  (_network, key: number) => removeIndex !== key
412
416
  )
413
417
 
414
418
  delete newNetworkInvalidKeys.value[index]
419
+ delete sendDataNewNetwork.value[index]
420
+ sendData()
415
421
  }
416
422
 
417
423
  const defaultCdDvdDriver: UI_I_SendDataNewCdDvdDrive = {
@@ -449,11 +455,6 @@ const addCdDvdDrive = (): void => {
449
455
  const value = (cdDvdDrivesIndex.value.at(-1) ?? -1) + 1
450
456
  cdDvdDrivesIndex.value.push(value)
451
457
  cdDvdDrivesType.value.push('new')
452
- model.value.disk_devices.push({
453
- ...useDeepCopy(defaultCdDvdDriver),
454
- attach: true,
455
- boot_order: 0, // Убираем галочку
456
- })
457
458
  cdDvdDrivesLocal.value.push({
458
459
  ...useDeepCopy(defaultCdDvdDriver),
459
460
  attach: true,
@@ -472,6 +473,7 @@ const onRemoveCdDvdDrive = (
472
473
  if (key === removeIndex) return 'removed'
473
474
  return item
474
475
  })
476
+ sendData()
475
477
  return
476
478
  }
477
479
 
@@ -481,12 +483,12 @@ const onRemoveCdDvdDrive = (
481
483
  cdDvdDrivesType.value = cdDvdDrivesType.value.filter(
482
484
  (_item, key) => key !== index
483
485
  )
484
- model.value.disk_devices = model.value.disk_devices.filter(
485
- (_cdDvdDrive, key: number) => removeIndex !== key
486
- )
487
486
  cdDvdDrivesLocal.value = cdDvdDrivesLocal.value.filter(
488
487
  (_cdDvdDrive, key: number) => removeIndex !== key
489
488
  )
489
+
490
+ delete sendDataNewCdDvdDrive.value[index]
491
+ sendData()
490
492
  }
491
493
  const onRollBackCdDvdDrive = (index: number): void => {
492
494
  const removeIndex = cdDvdDrivesIndex.value.indexOf(index)
@@ -528,7 +530,6 @@ const addPciDevice = (): void => {
528
530
  pciDevicesType.value.push('new')
529
531
 
530
532
  pciDevicesLocal.value.push(useDeepCopy(defaultPciDevice))
531
- model.value.passthrough_pci_devices.push(useDeepCopy(defaultPciDevice))
532
533
  }
533
534
  const onRemovePciDevice = (index: number): void => {
534
535
  const removeIndex = pciDevicesIndex.value.indexOf(index)
@@ -537,11 +538,6 @@ const onRemovePciDevice = (index: number): void => {
537
538
  (_item, key) => key !== removeIndex
538
539
  )
539
540
 
540
- model.value.passthrough_pci_devices = model.value.passthrough_pci_devices.filter(
541
- (_pciDevice, key: number) => {
542
- return removeIndex !== key
543
- }
544
- )
545
541
  pciDevicesLocal.value = pciDevicesLocal.value.filter(
546
542
  (_pciDevice, key: number) => {
547
543
  return removeIndex !== key
@@ -549,6 +545,8 @@ const onRemovePciDevice = (index: number): void => {
549
545
  )
550
546
 
551
547
  delete newPciDeviceInvalidKeys.value[index]
548
+ delete sendDataNewPciDevices.value[index]
549
+ sendData()
552
550
  }
553
551
 
554
552
  const isShowFileModal = ref<boolean>(false)
@@ -573,44 +571,80 @@ const onAddDevice = (item: UI_I_DropdownTreeItemChild): void => {
573
571
  }
574
572
 
575
573
  const cpuInvalid = ref<boolean>(false)
574
+ const sendDataCpu = ref<UI_I_SendDataCpu | null>(null)
575
+ const onSendDataCpuMethod = (data: UI_I_SendDataCpu): void => {
576
+ sendDataCpu.value = data
577
+ sendData()
578
+ }
579
+ const sendDataMemory = ref<UI_I_SendDataMemory | null>(null)
580
+ const onSendDataMemoryMethod = (data: UI_I_SendDataMemory): void => {
581
+ sendDataMemory.value = data
582
+ sendData()
583
+ }
584
+ const sendDataNewHardDisk = ref<UI_I_SendDataNewHardDisk[]>([])
576
585
  const onSendDataNewHardDiskMethod = (
577
586
  data: UI_I_SendDataNewHardDisk,
578
587
  index: number
579
588
  ): void => {
580
- model.value.disk_devices[index] = {
581
- ...data,
582
- boot_order: model.value.disk_devices[index]?.boot_order || 0,
583
- }
589
+ sendDataNewHardDisk.value[index] = data
590
+ sendData()
584
591
  }
592
+ const sendDataNewNetwork = ref<UI_I_SendDataNewNetwork[]>([])
585
593
  const sendDataNewNetworkMethod = (
586
594
  data: UI_I_SendDataNewNetwork,
587
595
  index: number
588
596
  ): void => {
589
- model.value.network_devices[index] = {
590
- ...data,
591
- boot_order: model.value.network_devices[index]?.boot_order || 0,
592
- }
597
+ sendDataNewNetwork.value[index] = data
598
+ sendData()
593
599
  }
600
+ const sendDataNewCdDvdDrive = ref<UI_I_SendDataNewCdDvdDrive[]>([])
594
601
  const sendDataNewCdDvdDriveMethod = (
595
602
  data: UI_I_SendDataNewCdDvdDrive,
596
603
  index: number
597
604
  ): void => {
598
- const cdromIndexStart = model.value.disk_devices.findIndex(
599
- (disk) => disk.device_type === 'cdrom'
600
- )
601
- model.value.disk_devices[cdromIndexStart + index] = {
602
- ...data,
603
- boot_order:
604
- model.value.disk_devices[cdromIndexStart + index]?.boot_order || 0,
605
- }
605
+ sendDataNewCdDvdDrive.value[index] = data
606
+ sendData()
607
+ }
608
+ const sendDataNewUsbController = ref<string | null>(null)
609
+ const onSendDataNewUsbControllerMethod = (data: string): void => {
610
+ sendDataNewUsbController.value = data
611
+ sendData()
606
612
  }
613
+ const sendDataNewPciDevices = ref<UI_I_SendDataNewPciDevice[]>([])
607
614
  const onSendDataPciDevicesMethod = (
608
615
  data: UI_I_SendDataNewPciDevice,
609
616
  index: number
610
617
  ): void => {
611
- model.value.passthrough_pci_devices[index] = {
612
- ...data,
618
+ sendDataNewPciDevices.value[index] = data
619
+ sendData()
620
+ }
621
+ const sendDataVideoCard = ref<UI_I_SendDataVideoCard | null>(null)
622
+ const onSendDataVideoCardMethod = (data: UI_I_SendDataVideoCard): void => {
623
+ sendDataVideoCard.value = data
624
+ sendData()
625
+ }
626
+
627
+ const sendData = (): void => {
628
+ const cpu = sendDataCpu.value
629
+ const memory = sendDataMemory.value
630
+ const hardDisks = sendDataNewHardDisk.value.flat(2)
631
+ const networks = sendDataNewNetwork.value.flat(2)
632
+ const cdDvdDrives = sendDataNewCdDvdDrive.value.flat(2)
633
+ const pciDevices = sendDataNewPciDevices.value.flat()
634
+ const usbController = sendDataNewUsbController.value
635
+ const videoCard = sendDataVideoCard.value
636
+
637
+ const sendData: UI_I_SendDataVirtualHardware = {
638
+ cpu,
639
+ memory,
640
+ usbController,
641
+ pciDevices,
642
+ networks,
643
+ hardDisks,
644
+ cdDvdDrives,
645
+ videoCard,
613
646
  }
647
+ emits('send-data', sendData)
614
648
  }
615
649
 
616
650
  const onSetInvalidHardDisk = (invalid: boolean, index: number): void => {
@@ -34,21 +34,24 @@
34
34
  <div class="overflow-auto virtual-hardware-content-block">
35
35
  <div class="stack-view">
36
36
  <common-vm-actions-common-customize-hardware-virtual-hardware-cpu
37
- v-model="model"
37
+ :max-cpus="props.maxCpus"
38
38
  :cpu-models="props.cpuModels"
39
+ :cpu="props.cpu"
39
40
  :is-edit="props.isEdit"
40
41
  :state="props.state"
41
42
  :error-validation-fields="props.errorValidationFields"
42
43
  :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
44
+ @send-data="emits('send-data-cpu-method', $event)"
43
45
  @remove-error-by-title="emits('remove-error-by-title', $event)"
44
46
  @invalid="cpuInvalid = $event"
45
47
  />
46
48
  <common-vm-actions-common-customize-hardware-virtual-hardware-memory
47
- v-model="model"
48
49
  :max-memory="props.maxMemory"
49
50
  :is-edit="props.isEdit"
51
+ :memory="props.memory"
50
52
  :state="props.state"
51
53
  :error-validation-fields="props.errorValidationFields"
54
+ @send-data="emits('send-data-memory-method', $event)"
52
55
  @invalid="memoryInvalid = $event"
53
56
  @remove-error-by-title="emits('remove-error-by-title', $event)"
54
57
  />
@@ -136,13 +139,12 @@
136
139
  ])
137
140
  "
138
141
  />
139
- <div v-for="(item, key) in model.usb_controllers" :key="key">
140
- <common-vm-actions-common-customize-hardware-virtual-hardware-new-usb-controller
141
- v-model="item.type"
142
- :is-edit="props.isEdit"
143
- :state="props.state"
144
- />
145
- </div>
142
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-usb-controller
143
+ :usb-controller="props.usbController"
144
+ :is-edit="props.isEdit"
145
+ :state="props.state"
146
+ @send-data="emits('send-data-new-usb-controller-method', $event)"
147
+ />
146
148
  <template v-if="props.passthroughDevices || props.mediatedDevices">
147
149
  <common-vm-actions-common-customize-hardware-virtual-hardware-new-pci-device
148
150
  v-for="(item, key) in props.pciDevices"
@@ -172,11 +174,11 @@
172
174
  />
173
175
  </template>
174
176
  <common-vm-actions-common-customize-hardware-virtual-hardware-video-card
175
- v-model="model.video_card"
176
177
  :is-edit="props.isEdit"
177
178
  :video-card="props.videoCard"
178
179
  :error-validation-fields="props.errorValidationFields"
179
180
  :state="props.state"
181
+ @send-data="emits('send-data-video-card-method', $event)"
180
182
  @invalid="videoCardInvalid = $event"
181
183
  @remove-error-by-title="emits('remove-error-by-title', $event)"
182
184
  />
@@ -218,6 +220,8 @@ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
218
220
  import type { UI_I_FolderOrFileTreePayload } from '~/lib/models/store/storage/interfaces'
219
221
  import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
220
222
  import type {
223
+ UI_I_SendDataCpu,
224
+ UI_I_SendDataMemory,
221
225
  UI_I_SendDataNewHardDisk,
222
226
  UI_I_SendDataNewNetwork,
223
227
  UI_I_SendDataVideoCard,
@@ -233,15 +237,13 @@ import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
233
237
  import type { UI_I_Localization } from '~/lib/models/interfaces'
234
238
  import type {
235
239
  API_UI_I_VmEditCpu,
240
+ API_UI_I_VmEditMemory,
236
241
  UI_I_MediatedDevice,
237
242
  UI_I_PciDevice,
238
243
  } from '~/lib/models/store/vm/interfaces'
239
244
  import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
240
- import type { UI_I_CreateVmData } from '~/components/common/vm/actions/common/lib/models/interfaces'
241
245
  import { dropdownItemsNewFunc } from './lib/config/dropdownItems'
242
246
 
243
- const model = defineModel<UI_I_CreateVmData>({ required: true })
244
-
245
247
  const cpuInvalid = defineModel<boolean>('cpuInvalid', { required: true })
246
248
  const memoryInvalid = defineModel<boolean>('memoryInvalid', { required: true })
247
249
  const videoCardInvalid = defineModel<boolean>('videoCardInvalid', {
@@ -255,6 +257,7 @@ const props = withDefaults(
255
257
  isEdit: boolean
256
258
  storage: UI_I_DatastoreTableItem | null
257
259
  project: UI_T_Project
260
+ maxCpus: number
258
261
  maxMemory: number
259
262
  cpuModels: UI_I_OptionItem[]
260
263
  datastore: UI_I_DatastoreTableItem[]
@@ -274,11 +277,13 @@ const props = withDefaults(
274
277
  getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
275
278
  cpu?: API_UI_I_VmEditCpu
276
279
  state?: string | number
280
+ memory?: API_UI_I_VmEditMemory
277
281
  networks?: UI_I_SendDataNewNetwork[] | null
278
282
  hardDisks?: UI_I_SendDataNewHardDisk[] | null
279
283
  videoCard?: UI_I_SendDataVideoCard
280
284
  pciDevices?: UI_I_SendDataNewPciDevice[]
281
285
  cdDvdDrives?: UI_I_SendDataNewCdDvdDrive[] | null
286
+ usbController?: string
282
287
  guestMachineType?: UI_I_OptionItem | null
283
288
  passthroughDevices?: UI_I_PciDevice[]
284
289
  mediatedDevices?: UI_I_MediatedDevice[]
@@ -289,11 +294,13 @@ const props = withDefaults(
289
294
  {
290
295
  cpu: undefined,
291
296
  state: undefined,
297
+ memory: undefined,
292
298
  networks: undefined,
293
299
  hardDisks: undefined,
294
300
  videoCard: undefined,
295
301
  pciDevices: undefined,
296
302
  cdDvdDrives: undefined,
303
+ usbController: undefined,
297
304
  guestMachineType: undefined,
298
305
  passthroughDevices: undefined,
299
306
  mediatedDevices: undefined,
@@ -319,11 +326,14 @@ const emits = defineEmits<{
319
326
  ): void
320
327
  (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
321
328
  (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
329
+ (event: 'send-data-cpu-method', value: UI_I_SendDataCpu): void
322
330
  (event: 'set-invalid-hard-disk', value: [boolean, number]): void
323
331
  (event: 'remove-error-by-title', value: string): void
324
332
  (event: 'roll-back-cd-dvd-drive', value: number): void
325
333
  (event: 'set-invalid-pci-device', value: [boolean, number]): void
326
334
  (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
335
+ (event: 'send-data-memory-method', value: UI_I_SendDataMemory): void
336
+ (event: 'send-data-video-card-method', value: UI_I_SendDataVideoCard): void
327
337
  (
328
338
  event: 'send-data-new-network-method',
329
339
  value: [UI_I_SendDataNewNetwork, number]
@@ -340,6 +350,7 @@ const emits = defineEmits<{
340
350
  event: 'send-data-new-cd-dvd-drive-method',
341
351
  value: [UI_I_SendDataNewCdDvdDrive, number]
342
352
  ): void
353
+ (event: 'send-data-new-usb-controller-method', value: string): void
343
354
  }>()
344
355
 
345
356
  const { $text } = useNuxtApp()