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
@@ -12,24 +12,21 @@
12
12
  <div class="clr-component">
13
13
  <div class="stack-view">
14
14
  <common-vm-actions-common-customize-hardware-virtual-hardware-cpu
15
- :max-cpus="props.maxCpus"
15
+ v-model="model"
16
16
  :cpu-models="props.cpuModels"
17
- :cpu="props.cpu"
18
17
  :is-edit="props.isEdit"
19
18
  :state="props.state"
20
19
  :error-validation-fields="props.errorValidationFields"
21
20
  :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
22
- @send-data="emits('send-data-cpu-method', $event)"
23
21
  @remove-error-by-title="emits('remove-error-by-title', $event)"
24
22
  @invalid="cpuInvalid = $event"
25
23
  />
26
24
  <common-vm-actions-common-customize-hardware-virtual-hardware-memory
25
+ v-model="model"
27
26
  :max-memory="props.maxMemory"
28
27
  :is-edit="props.isEdit"
29
- :memory="props.memory"
30
28
  :state="props.state"
31
29
  :error-validation-fields="props.errorValidationFields"
32
- @send-data="emits('send-data-memory-method', $event)"
33
30
  @invalid="memoryInvalid = $event"
34
31
  @remove-error-by-title="emits('remove-error-by-title', $event)"
35
32
  />
@@ -117,12 +114,13 @@
117
114
  ])
118
115
  "
119
116
  />
120
- <common-vm-actions-common-customize-hardware-virtual-hardware-new-usb-controller
121
- :usb-controller="props.usbController"
122
- :is-edit="props.isEdit"
123
- :state="props.state"
124
- @send-data="emits('send-data-new-usb-controller-method', $event)"
125
- />
117
+ <div v-for="(item, key) in model.usb_controllers" :key="key">
118
+ <common-vm-actions-common-customize-hardware-virtual-hardware-new-usb-controller
119
+ v-model="item.type"
120
+ :is-edit="props.isEdit"
121
+ :state="props.state"
122
+ />
123
+ </div>
126
124
  <template v-if="props.passthroughDevices || props.mediatedDevices">
127
125
  <common-vm-actions-common-customize-hardware-virtual-hardware-new-pci-device
128
126
  v-for="(item, key) in props.pciDevices"
@@ -152,11 +150,11 @@
152
150
  />
153
151
  </template>
154
152
  <common-vm-actions-common-customize-hardware-virtual-hardware-video-card
153
+ v-model="model.video_card"
155
154
  :is-edit="props.isEdit"
156
155
  :video-card="props.videoCard"
157
156
  :error-validation-fields="props.errorValidationFields"
158
157
  :state="props.state"
159
- @send-data="emits('send-data-video-card-method', $event)"
160
158
  @invalid="videoCardInvalid = $event"
161
159
  @remove-error-by-title="emits('remove-error-by-title', $event)"
162
160
  />
@@ -189,8 +187,6 @@ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
189
187
  import type { UI_I_FolderOrFileTreePayload } from '~/lib/models/store/storage/interfaces'
190
188
  import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
191
189
  import type {
192
- UI_I_SendDataCpu,
193
- UI_I_SendDataMemory,
194
190
  UI_I_SendDataNewHardDisk,
195
191
  UI_I_SendDataNewNetwork,
196
192
  UI_I_SendDataVideoCard,
@@ -211,11 +207,13 @@ import type {
211
207
  import type { UI_I_Localization } from '~/lib/models/interfaces'
212
208
  import type {
213
209
  API_UI_I_VmEditCpu,
214
- API_UI_I_VmEditMemory,
215
210
  UI_I_MediatedDevice,
216
211
  UI_I_PciDevice,
217
212
  } from '~/lib/models/store/vm/interfaces'
218
213
  import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
214
+ import type { UI_I_CreateVmData } from '~/components/common/vm/actions/common/lib/models/interfaces'
215
+
216
+ const model = defineModel<UI_I_CreateVmData>({ required: true })
219
217
 
220
218
  const cpuInvalid = defineModel<boolean>('cpuInvalid', { required: true })
221
219
  const memoryInvalid = defineModel<boolean>('memoryInvalid', { required: true })
@@ -230,7 +228,6 @@ const props = withDefaults(
230
228
  isEdit: boolean
231
229
  storage: UI_I_DatastoreTableItem | null
232
230
  project: UI_T_Project
233
- maxCpus: number
234
231
  maxMemory: number
235
232
  cpuModels: UI_I_OptionItem[]
236
233
  datastore: UI_I_DatastoreTableItem[]
@@ -246,17 +243,15 @@ const props = withDefaults(
246
243
  pciDevicesIndex: number[]
247
244
  cdDvdDrivesType: UI_T_NetworkType[]
248
245
  cdDvdDrivesIndex: number[]
249
- errorValidationFields: UI_I_ErrorValidationField<string>[]
246
+ errorValidationFields: UI_I_ErrorValidationField[]
250
247
  getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
251
248
  cpu?: API_UI_I_VmEditCpu
252
249
  state?: string | number
253
- memory?: API_UI_I_VmEditMemory
254
250
  networks?: UI_I_SendDataNewNetwork[] | null
255
251
  hardDisks?: UI_I_SendDataNewHardDisk[] | null
256
252
  videoCard?: UI_I_SendDataVideoCard
257
253
  pciDevices?: UI_I_SendDataNewPciDevice[]
258
254
  cdDvdDrives?: UI_I_SendDataNewCdDvdDrive[] | null
259
- usbController?: string
260
255
  guestMachineType?: UI_I_OptionItem | null
261
256
  passthroughDevices?: UI_I_PciDevice[]
262
257
  mediatedDevices?: UI_I_MediatedDevice[]
@@ -266,13 +261,11 @@ const props = withDefaults(
266
261
  {
267
262
  cpu: undefined,
268
263
  state: undefined,
269
- memory: undefined,
270
264
  networks: undefined,
271
265
  hardDisks: undefined,
272
266
  videoCard: undefined,
273
267
  pciDevices: undefined,
274
268
  cdDvdDrives: undefined,
275
- usbController: undefined,
276
269
  guestMachineType: undefined,
277
270
  passthroughDevices: undefined,
278
271
  mediatedDevices: undefined,
@@ -297,14 +290,11 @@ const emits = defineEmits<{
297
290
  ): void
298
291
  (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
299
292
  (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
300
- (event: 'send-data-cpu-method', value: UI_I_SendDataCpu): void
301
293
  (event: 'set-invalid-hard-disk', value: [boolean, number]): void
302
294
  (event: 'remove-error-by-title', value: string): void
303
295
  (event: 'roll-back-cd-dvd-drive', value: number): void
304
296
  (event: 'set-invalid-pci-device', value: [boolean, number]): void
305
297
  (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
306
- (event: 'send-data-memory-method', value: UI_I_SendDataMemory): void
307
- (event: 'send-data-video-card-method', value: UI_I_SendDataVideoCard): void
308
298
  (
309
299
  event: 'send-data-new-network-method',
310
300
  value: [UI_I_SendDataNewNetwork, number]
@@ -321,7 +311,6 @@ const emits = defineEmits<{
321
311
  event: 'send-data-new-cd-dvd-drive-method',
322
312
  value: [UI_I_SendDataNewCdDvdDrive, number]
323
313
  ): void
324
- (event: 'send-data-new-usb-controller-method', value: string): void
325
314
  }>()
326
315
 
327
316
  const localization = computed<UI_I_Localization>(() => useLocal())
@@ -1,10 +1,7 @@
1
1
  <template>
2
2
  <common-vm-actions-common-customize-hardware-virtual-hardware-cpu-new
3
3
  v-if="isNewView"
4
- v-model:selected-cpu="selectedCpu"
5
- v-model:selected-core-per-socket="selectedCorePerSocket"
6
- v-model:enable-cpu-hot-add="enableCpuHotAdd"
7
- v-model:selected-max-cpu="selectedMaxCpu"
4
+ v-model="model"
8
5
  v-model:reservation="reservation"
9
6
  v-model:reservation-type="reservationType"
10
7
  v-model:limit="limit"
@@ -14,7 +11,6 @@
14
11
  v-model:cpu-model="cpuModel"
15
12
  v-model:passthrough-host-cpu="passthroughHostCpu"
16
13
  v-model:host-model-cpu="hostModelCpu"
17
- :max-cpus="props.maxCpus"
18
14
  :cpu-models="props.cpuModels"
19
15
  :is-edit="props.isEdit"
20
16
  :error-validation-fields="props.errorValidationFields"
@@ -36,10 +32,7 @@
36
32
  />
37
33
  <common-vm-actions-common-customize-hardware-virtual-hardware-cpu-old
38
34
  v-else
39
- v-model:selected-cpu="selectedCpu"
40
- v-model:selected-core-per-socket="selectedCorePerSocket"
41
- v-model:enable-cpu-hot-add="enableCpuHotAdd"
42
- v-model:selected-max-cpu="selectedMaxCpu"
35
+ v-model="model"
43
36
  v-model:reservation="reservation"
44
37
  v-model:reservation-type="reservationType"
45
38
  v-model:limit="limit"
@@ -49,7 +42,6 @@
49
42
  v-model:cpu-model="cpuModel"
50
43
  v-model:passthrough-host-cpu="passthroughHostCpu"
51
44
  v-model:host-model-cpu="hostModelCpu"
52
- :max-cpus="props.maxCpus"
53
45
  :cpu-models="props.cpuModels"
54
46
  :is-edit="props.isEdit"
55
47
  :error-validation-fields="props.errorValidationFields"
@@ -72,30 +64,27 @@
72
64
  </template>
73
65
 
74
66
  <script setup lang="ts">
75
- import type { UI_I_SendDataCpu } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
76
67
  import type { UI_I_Localization } from '~/lib/models/interfaces'
77
68
  import type { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
78
69
  import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
79
- import type { API_UI_I_VmEditCpu } from '~/lib/models/store/vm/interfaces'
70
+ import type { UI_I_CreateVmData } from '~/components/common/vm/actions/common/lib/models/interfaces'
80
71
  import { cpuOptionsFunc } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/lib/config/cpuOptions'
81
72
 
73
+ const model = defineModel<UI_I_CreateVmData>({ required: true })
74
+
82
75
  const props = withDefaults(
83
76
  defineProps<{
84
- maxCpus: number
85
77
  cpuModels: UI_I_OptionItem[]
86
78
  isEdit: boolean
87
- errorValidationFields: UI_I_ErrorValidationField<string>[]
79
+ errorValidationFields: UI_I_ErrorValidationField[]
88
80
  vmCpuHelpTextSecond?: string
89
81
  state?: string | number
90
- cpu?: API_UI_I_VmEditCpu
91
82
  }>(),
92
83
  {
93
84
  state: undefined,
94
- cpu: undefined,
95
85
  }
96
86
  )
97
87
  const emits = defineEmits<{
98
- (event: 'send-data', value: UI_I_SendDataCpu): void
99
88
  (event: 'invalid', value: boolean): void
100
89
  (event: 'remove-error-by-title', value: string): void
101
90
  }>()
@@ -110,74 +99,85 @@ const isDisabled = computed<boolean>(() => {
110
99
  })
111
100
 
112
101
  const cpuOptions = computed<UI_I_OptionItem[]>(() =>
113
- cpuOptionsFunc(localization.value, 1, props.maxCpus)
102
+ cpuOptionsFunc(localization.value, 1, model.value.cpu.max_vcpus)
114
103
  )
115
104
 
116
- const enableCpuHotAdd = ref<boolean>(false)
105
+ // const enableCpuHotAdd = ref<boolean>(false)
106
+
117
107
  const enableCpuHotAddDisabled = computed<boolean>(
118
- // () => selectedCpu.value >= props.maxCpus || isDisabled.value
108
+ // () => model.value.cpu.vcpus >= model.value.cpu.max_vcpus || isDisabled.value
119
109
  () => isDisabled.value // pc-1766
120
110
  )
121
- watch(enableCpuHotAdd, (newValue) => {
122
- if (newValue) {
123
- selectedMaxCpu.value = Math.max(selectedCpu.value, selectedMaxCpu.value)
124
- return
111
+ watch(
112
+ () => model.value.cpu.hotplug,
113
+ (newValue) => {
114
+ if (newValue) {
115
+ model.value.cpu.max_vcpus = Math.max(
116
+ model.value.cpu.vcpus,
117
+ model.value.cpu.max_vcpus
118
+ )
119
+ return
120
+ }
121
+
122
+ maxCpuInvalid.value = false
123
+ model.value.cpu.max_vcpus = 1
125
124
  }
125
+ )
126
126
 
127
- maxCpuInvalid.value = false
128
- selectedMaxCpu.value = 1
129
- })
127
+ // const selectedCpu = ref<number>(
128
+ // isDisabled.value && model.value.cpu.hotplug ? model.value.cpu.max_vcpus : 2
129
+ // )
130
+ model.value.cpu.vcpus =
131
+ isDisabled.value && model.value.cpu.hotplug ? model.value.cpu.max_vcpus : 2
130
132
 
131
- const selectedCpu = ref<number>(
132
- isDisabled.value && enableCpuHotAdd.value ? props.maxCpus : 2
133
- )
134
133
  const isCpuDisabled = computed<boolean>(
135
- () => isDisabled.value && !enableCpuHotAdd.value
134
+ () => isDisabled.value && !model.value.cpu.hotplug
136
135
  )
137
- watch(selectedCpu, (newValue) => {
138
- selectedCpu.value = Math.floor(+newValue)
139
- if (!(selectedCpu.value % selectedCorePerSocket.value) || isDisabled.value)
140
- return
141
- selectedCorePerSocket.value = 1
142
- })
143
- // watch(selectedCpu, (newValue) => {
144
- // if (enableCpuHotAdd.value && enableCpuHotAddDisabled.value) return
145
-
146
- // if (newValue >= props.maxCpus) { // pc-1766
147
- // enableCpuHotAdd.value = false
148
- // }
149
- // selectedMaxCpu.value =
150
- // selectedMaxCpu.value <= newValue ? newValue + 1 : selectedMaxCpu.value
151
- // if (selectedMaxCpu.value > props.maxCpus) selectedMaxCpu.value = props.maxCpus
152
- // })
153
- const maxCpuOptions = computed<UI_I_OptionItem[]>(() =>
154
- cpuOptionsFunc(localization.value, selectedCpu.value, props.maxCpus)
155
- )
156
- const selectedMaxCpu = ref<number>(1)
157
136
  watch(
158
- () => props.maxCpus,
137
+ () => model.value.cpu.vcpus,
159
138
  (newValue) => {
160
- selectedMaxCpu.value = newValue
139
+ model.value.cpu.vcpus = Math.floor(+newValue)
140
+ if (
141
+ !(model.value.cpu.vcpus % model.value.cpu.core_per_socket) ||
142
+ isDisabled.value
143
+ )
144
+ return
145
+ model.value.cpu.core_per_socket = 1
161
146
  }
162
147
  )
163
148
 
149
+ const maxCpuOptions = computed<UI_I_OptionItem[]>(() =>
150
+ cpuOptionsFunc(
151
+ localization.value,
152
+ model.value.cpu.vcpus,
153
+ model.value.cpu.max_vcpus
154
+ )
155
+ )
156
+ // const selectedMaxCpu = ref<number>(1)
157
+ // watch(
158
+ // () => props.maxCpus,
159
+ // (newValue) => {
160
+ // model.value.cpu.max_vcpus = newValue
161
+ // }
162
+ // )
163
+
164
164
  const selectedCpus = computed<number[]>(() =>
165
- enableCpuHotAdd.value
166
- ? [selectedCpu.value, selectedMaxCpu.value]
167
- : [selectedCpu.value]
165
+ model.value.cpu.hotplug
166
+ ? [model.value.cpu.vcpus, model.value.cpu.max_vcpus]
167
+ : [model.value.cpu.vcpus]
168
168
  )
169
169
 
170
- const selectedCorePerSocket = ref<number>(1)
170
+ // const selectedCorePerSocket = ref<number>(1)
171
171
 
172
172
  const cpuErrorLocalText = computed<string>(() => {
173
- const validValue = /^\d+(\.\d+)?$/.test(selectedCpu.value + '')
173
+ const validValue = /^\d+(\.\d+)?$/.test(model.value.cpu.vcpus + '')
174
174
  if (!validValue) {
175
175
  return localization.value.common.inputContainsInvalidCharacters
176
176
  }
177
177
 
178
178
  const min = cpuOptions.value[0].value
179
179
  const max = cpuOptions.value[1].value
180
- if (selectedCpu.value < min || selectedCpu.value > max) {
180
+ if (model.value.cpu.vcpus < min || model.value.cpu.vcpus > max) {
181
181
  return localization.value.vmWizard.cpuMustBe
182
182
  .replace('{0}', min)
183
183
  .replace('{1}', max)
@@ -216,8 +216,8 @@ const cpuInvalid = computed<boolean>(
216
216
  reservationInvalid.value ||
217
217
  limitInvalid.value ||
218
218
  sharesInvalid.value ||
219
- (enableCpuHotAdd.value &&
220
- // selectedCpu.value < props.maxCpus && // pc-1766
219
+ (model.value.cpu.hotplug &&
220
+ // model.value.cpu.vcpus < model.value.cpu.max_vcpus && // pc-1766
221
221
  maxCpuInvalid.value)
222
222
  )
223
223
  watch(
@@ -230,12 +230,65 @@ watch(
230
230
 
231
231
  const reservation = ref<string>('1')
232
232
  const reservationType = ref<string>('mhz')
233
+ if (model.value.cpu.reservation_mhz !== 1) {
234
+ const reservationInGhz = $binary.mhzToGhz(model.value.cpu.reservation_mhz)
235
+ if (reservationInGhz < 1) {
236
+ reservation.value = model.value.cpu.reservation_mhz.toString()
237
+ reservationType.value = 'mhz'
238
+ } else {
239
+ reservation.value = reservationInGhz
240
+ reservationType.value = 'ghz'
241
+ }
242
+ }
243
+ watch(
244
+ [reservation, reservationType],
245
+ () => {
246
+ model.value.cpu.reservation_mhz =
247
+ reservationType.value === 'ghz'
248
+ ? $binary.ghzToMhz(+reservation.value)
249
+ : +reservation.value
250
+ },
251
+ { deep: true, immediate: true }
252
+ )
233
253
 
234
254
  const limit = ref<string>('Unlimited')
235
255
  const limitType = ref<string>('mhz')
256
+ if (model.value.cpu.limit_mhz !== null) {
257
+ if (typeof model.value.cpu.limit_mhz === 'string')
258
+ limit.value = model.value.cpu.limit_mhz
259
+ else {
260
+ const limitInGhz = $binary.mhzToGhz(model.value.cpu.limit_mhz)
261
+ if (limitInGhz < 1) {
262
+ limit.value = model.value.cpu.limit_mhz.toString()
263
+ limitType.value = 'mhz'
264
+ } else {
265
+ limit.value = limitInGhz
266
+ limitType.value = 'ghz'
267
+ }
268
+ }
269
+ }
270
+ watch(
271
+ [limit, limitType],
272
+ () => {
273
+ model.value.cpu.limit_mhz =
274
+ limit.value === 'Unlimited'
275
+ ? limit.value
276
+ : limitType.value === 'ghz'
277
+ ? $binary.ghzToMhz(+limit.value)
278
+ : +limit.value
279
+ },
280
+ { deep: true, immediate: true }
281
+ )
236
282
 
237
- const shares = ref<string>('2000')
238
- const sharesType = ref<string>('2000')
283
+ const shares = ref<string>(model.value.cpu.shares + '' || '2000')
284
+ const sharesType = ref<string>(model.value.cpu.shares + '' || '2000') // TODO check
285
+ watch(
286
+ shares,
287
+ () => {
288
+ model.value.cpu.shares = +shares.value
289
+ },
290
+ { deep: true, immediate: true }
291
+ )
239
292
 
240
293
  // const hardwareVirtualization = ref<boolean>(false)
241
294
  //
@@ -254,111 +307,38 @@ watch(
254
307
  }
255
308
  )
256
309
  const passthroughHostCpu = ref<boolean>(false)
257
- const hostModelCpu = ref<boolean>(true)
258
-
259
- // const isShowCpuHelp = ref<boolean>(false)
260
-
310
+ const hostModelCpu = ref<boolean>(false)
311
+ if (model.value.cpu.model) {
312
+ switch (model.value.cpu.model) {
313
+ case 'host-passthrough':
314
+ passthroughHostCpu.value = true
315
+ hostModelCpu.value = false
316
+ cpuModel.value = ''
317
+ break
318
+ case 'host-model':
319
+ passthroughHostCpu.value = false
320
+ hostModelCpu.value = true
321
+ cpuModel.value = ''
322
+ break
323
+ default:
324
+ cpuModel.value =
325
+ props.cpuModels.find((model) => model.value === model.value.cpu.model)
326
+ ?.value || cpuModel.value
327
+ }
328
+ }
261
329
  watch(
262
- [
263
- reservation,
264
- reservationType,
265
- limit,
266
- limitType,
267
- shares,
268
- selectedCpu,
269
- selectedMaxCpu,
270
- selectedCorePerSocket,
271
- enableCpuHotAdd,
272
- cpuModel,
273
- passthroughHostCpu,
274
- hostModelCpu,
275
- ],
330
+ [cpuModel, passthroughHostCpu, hostModelCpu],
276
331
  () => {
277
- const reservationInMhz =
278
- reservationType.value === 'ghz'
279
- ? $binary.ghzToMhz(+reservation.value)
280
- : +reservation.value
281
- const limitInMhz =
282
- limit.value === 'Unlimited'
283
- ? limit.value
284
- : limitType.value === 'ghz'
285
- ? $binary.ghzToMhz(+limit.value)
286
- : +limit.value
287
- const model = passthroughHostCpu.value
332
+ model.value.cpu.model = passthroughHostCpu.value
288
333
  ? 'host-passthrough'
289
334
  : hostModelCpu.value
290
335
  ? 'host-model'
291
336
  : cpuModel.value
292
-
293
- emits('send-data', {
294
- model,
295
- vcpus: selectedCpu.value,
296
- max_vcpus: enableCpuHotAdd.value ? selectedMaxCpu.value : 0,
297
- core_per_socket: selectedCorePerSocket.value,
298
- reservation_mhz: reservationInMhz,
299
- limit_mhz: limitInMhz,
300
- shares: +shares.value,
301
- hotplug: enableCpuHotAdd.value,
302
- })
303
337
  },
304
- {
305
- immediate: true,
306
- }
338
+ { deep: true, immediate: true }
307
339
  )
308
340
 
309
- // Добавляем данные для редактирования
310
- watch(
311
- () => props.cpu,
312
- (newValue) => {
313
- if (!newValue) return
314
-
315
- enableCpuHotAdd.value = newValue.hotplug
316
- selectedCpu.value = newValue.vcpus
317
- selectedMaxCpu.value = newValue.hotplug ? newValue.max_vcpus : 1
318
- selectedCorePerSocket.value = newValue.core_per_socket
319
- shares.value = '' + newValue.shares
320
- sharesType.value = '' + newValue.shares
321
-
322
- const reservationInGhz = $binary.mhzToGhz(newValue.reservation_mhz)
323
- if (reservationInGhz < 1) {
324
- reservation.value = newValue.reservation_mhz.toString()
325
- reservationType.value = 'mhz'
326
- } else {
327
- reservation.value = reservationInGhz
328
- reservationType.value = 'ghz'
329
- }
330
-
331
- if (typeof newValue.limit_mhz === 'string') limit.value = newValue.limit_mhz
332
- else {
333
- const limitInGhz = $binary.mhzToGhz(newValue.limit_mhz)
334
- if (limitInGhz < 1) {
335
- limit.value = newValue.limit_mhz.toString()
336
- limitType.value = 'mhz'
337
- } else {
338
- limit.value = limitInGhz
339
- limitType.value = 'ghz'
340
- }
341
- }
342
-
343
- switch (newValue.model) {
344
- case 'host-passthrough':
345
- passthroughHostCpu.value = true
346
- hostModelCpu.value = false
347
- cpuModel.value = ''
348
- break
349
- case 'host-model':
350
- passthroughHostCpu.value = false
351
- hostModelCpu.value = true
352
- cpuModel.value = ''
353
- break
354
- default:
355
- cpuModel.value =
356
- props.cpuModels.find((model) => model.value === newValue.model)
357
- ?.value || cpuModel.value
358
- }
359
- },
360
- { immediate: true }
361
- )
341
+ // const isShowCpuHelp = ref<boolean>(false)
362
342
 
363
343
  const onRemoveValidationError = (): void => {
364
344
  emits('remove-error-by-title', 'cpu.vcpus')
@@ -24,7 +24,7 @@
24
24
  <template #stackBlockContent>
25
25
  <div class="flex-align-center flex-space-between">
26
26
  <ui-combobox
27
- v-model.number="selectedCpu"
27
+ v-model.number="model.cpu.vcpus"
28
28
  :items="props.cpuOptions"
29
29
  :disabled="props.isCpuDisabled"
30
30
  :error-text="props.vcpusLocalAndApiErrorsTexts"
@@ -70,7 +70,7 @@
70
70
  </template>
71
71
  <template #stackChildren>
72
72
  <common-vm-actions-common-customize-hardware-virtual-hardware-cpu-cores-per-socket
73
- v-model:selected-core-per-socket="selectedCorePerSocket"
73
+ v-model:selected-core-per-socket="model.cpu.core_per_socket"
74
74
  :selected-cpus="props.selectedCpus"
75
75
  :cpu-options="props.cpuOptions"
76
76
  :is-edit="props.isEdit"
@@ -79,12 +79,12 @@
79
79
  @remove-error-by-title="emits('remove-error-by-title', $event)"
80
80
  />
81
81
  <common-vm-actions-common-customize-hardware-virtual-hardware-cpu-hot-plug
82
- v-model:enable-cpu-hot-add="enableCpuHotAdd"
82
+ v-model:enable-cpu-hot-add="model.cpu.hotplug"
83
83
  :disabled="props.enableCpuHotAddDisabled"
84
84
  />
85
85
  <common-vm-actions-common-customize-hardware-virtual-hardware-cpu-max-cpu
86
- v-show="enableCpuHotAdd"
87
- v-model:selected-max-cpu.number="selectedMaxCpu"
86
+ v-show="model.cpu.hotplug"
87
+ v-model:selected-max-cpu.number="model.cpu.max_vcpus"
88
88
  :cpu-options="props.maxCpuOptions"
89
89
  :error-validation-fields="props.errorValidationFields"
90
90
  :disabled="props.isDisabled"
@@ -150,17 +150,10 @@
150
150
  import type { UI_I_Localization } from '~/lib/models/interfaces'
151
151
  import type { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
152
152
  import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
153
+ import type { UI_I_CreateVmData } from '~/components/common/vm/actions/common/lib/models/interfaces'
154
+
155
+ const model = defineModel<UI_I_CreateVmData>({ required: true })
153
156
 
154
- const selectedCpu = defineModel<number>('selectedCpu', { required: true })
155
- const selectedCorePerSocket = defineModel<number>('selectedCorePerSocket', {
156
- required: true,
157
- })
158
- const enableCpuHotAdd = defineModel<boolean>('enableCpuHotAdd', {
159
- required: true,
160
- })
161
- const selectedMaxCpu = defineModel<number>('selectedMaxCpu', {
162
- required: true,
163
- })
164
157
  const reservation = defineModel<string>('reservation', { required: true })
165
158
  const reservationType = defineModel<string>('reservationType', {
166
159
  required: true,
@@ -28,7 +28,7 @@
28
28
  <template #elem>
29
29
  <atoms-combobox
30
30
  id="vm-wizard-vcpus-field"
31
- v-model.number="selectedCpu"
31
+ v-model.number="model.cpu.vcpus"
32
32
  :items="props.cpuOptions"
33
33
  :disabled="props.isCpuDisabled"
34
34
  class="input-text-color"
@@ -48,7 +48,7 @@
48
48
  </template>
49
49
  <template #stackChildren>
50
50
  <common-vm-actions-common-customize-hardware-virtual-hardware-cpu-cores-per-socket
51
- v-model:selected-core-per-socket="selectedCorePerSocket"
51
+ v-model:selected-core-per-socket="model.cpu.core_per_socket"
52
52
  :selected-cpus="props.selectedCpus"
53
53
  :cpu-options="props.cpuOptions"
54
54
  :is-edit="props.isEdit"
@@ -57,12 +57,12 @@
57
57
  @remove-error-by-title="emits('remove-error-by-title', $event)"
58
58
  />
59
59
  <common-vm-actions-common-customize-hardware-virtual-hardware-cpu-hot-plug
60
- v-model:enable-cpu-hot-add="enableCpuHotAdd"
60
+ v-model:enable-cpu-hot-add="model.cpu.hotplug"
61
61
  :disabled="props.enableCpuHotAddDisabled"
62
62
  />
63
63
  <common-vm-actions-common-customize-hardware-virtual-hardware-cpu-max-cpu
64
- v-show="enableCpuHotAdd"
65
- v-model:selected-max-cpu.number="selectedMaxCpu"
64
+ v-show="model.cpu.hotplug"
65
+ v-model:selected-max-cpu.number="model.cpu.max_vcpus"
66
66
  :cpu-options="props.maxCpuOptions"
67
67
  :error-validation-fields="props.errorValidationFields"
68
68
  :disabled="props.isDisabled"
@@ -129,15 +129,10 @@
129
129
  import type { UI_I_Localization } from '~/lib/models/interfaces'
130
130
  import type { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
131
131
  import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
132
+ import type { UI_I_CreateVmData } from '~/components/common/vm/actions/common/lib/models/interfaces'
133
+
134
+ const model = defineModel<UI_I_CreateVmData>({ required: true })
132
135
 
133
- const selectedCpu = defineModel<number>('selectedCpu', { required: true })
134
- const selectedCorePerSocket = defineModel<number>('selectedCorePerSocket', {
135
- required: true,
136
- })
137
- const enableCpuHotAdd = defineModel<boolean>('enableCpuHotAdd', {
138
- required: true,
139
- })
140
- const selectedMaxCpu = defineModel<number>('selectedMaxCpu', { required: true })
141
136
  const reservation = defineModel<string>('reservation', { required: true })
142
137
  const reservationType = defineModel<string>('reservationType', {
143
138
  required: true,