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