bfg-common 1.5.554 → 1.5.555

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