bfg-common 1.5.59 → 1.5.61

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.
@@ -41,6 +41,7 @@
41
41
  :data-center="props.dataCenter"
42
42
  :compute-resource="props.computeResource"
43
43
  :compute-resource-tree="props.computeResourceTree"
44
+ :vmt-settings="props.vmtSettings"
44
45
  @check-name="onCheckName"
45
46
  @get-storage="emits('get-storage', $event)"
46
47
  @get-folders-or-files="emits('get-folders-or-files', $event)"
@@ -107,6 +108,7 @@
107
108
  :data-center="props.dataCenter"
108
109
  :compute-resource="props.computeResource"
109
110
  :compute-resource-tree="props.computeResourceTree"
111
+ :vmt-settings="props.vmtSettings"
110
112
  @check-name="onCheckName"
111
113
  @get-storage="emits('get-storage', $event)"
112
114
  @get-folders-or-files="emits('get-folders-or-files', $event)"
@@ -178,6 +180,7 @@ import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/mo
178
180
  import type {
179
181
  UI_I_MediatedDevice,
180
182
  UI_I_PciDevice,
183
+ UI_I_VmSettings,
181
184
  } from '~/lib/models/store/vm/interfaces'
182
185
  import { capabilities } from '~/components/common/vm/actions/common/lib/config/capabilities'
183
186
  import {
@@ -208,6 +211,7 @@ const props = defineProps<{
208
211
  vmNameInWizard: string
209
212
  templatesTree: UI_I_TreeNode[]
210
213
  capabilities?: UI_I_Capabilities
214
+ vmtSettings?: UI_I_VmSettings | null
211
215
  dataCenter?: UI_I_TreeNode // для сферы
212
216
  computeResource?: UI_I_TreeNode // для сферы
213
217
  computeResourceTree?: UI_I_TreeNode[] // для сферы
@@ -224,6 +228,7 @@ const emits = defineEmits<{
224
228
  (event: 'get-pci-devices'): void
225
229
  (event: 'get-pci-devices'): void
226
230
  (event: 'hide'): void
231
+ (event: 'select-template', value: string): void
227
232
  (
228
233
  event: 'get-compute-resource-tree',
229
234
  value: { id: string | number; cb: () => void }
@@ -344,11 +349,23 @@ const validationFunc = async (
344
349
  nextStep.id
345
350
  )
346
351
  ) {
347
- const storageValidation = await checkCustomizeHardware(value)
352
+ const validation = await checkCustomizeHardware(value)
348
353
 
349
- value = storageValidation.newValue
354
+ value = validation.newValue
350
355
 
351
- stepHasError = stepHasError || storageValidation.stepHasError
356
+ stepHasError = stepHasError || validation.stepHasError
357
+ } else if (
358
+ wizard.isValidateForStep(
359
+ dynamicSteps.customizeHardwareTemplate,
360
+ currentStep.id,
361
+ nextStep.id
362
+ )
363
+ ) {
364
+ const validation = await checkCustomizeHardware(value, true)
365
+
366
+ value = validation.newValue
367
+
368
+ stepHasError = stepHasError || validation.stepHasError
352
369
  }
353
370
  wizard.setLoader(false)
354
371
 
@@ -485,7 +502,8 @@ const checkStorage = async (
485
502
  })
486
503
  }
487
504
  const checkCustomizeHardware = async (
488
- value: UI_I_WizardStep[]
505
+ value: UI_I_WizardStep[],
506
+ forTemplate = false
489
507
  ): Promise<UI_I_ValidationReturn> => {
490
508
  let stepHasError = false
491
509
 
@@ -493,7 +511,9 @@ const checkCustomizeHardware = async (
493
511
  customizeHardwareSubmit.value = (isValid: boolean) => {
494
512
  if (!isValid) {
495
513
  stepHasError = wizard.setValidation(
496
- dynamicSteps.customizeHardware,
514
+ forTemplate
515
+ ? dynamicSteps.customizeHardwareTemplate
516
+ : dynamicSteps.customizeHardware,
497
517
  'customizeHardware',
498
518
  {
499
519
  fieldMessage: 'aaa',
@@ -501,10 +521,17 @@ const checkCustomizeHardware = async (
501
521
  }
502
522
  )
503
523
  } else if (
504
- wizard.hasMessage(dynamicSteps.customizeHardware, 'customizeHardware')
524
+ wizard.hasMessage(
525
+ forTemplate
526
+ ? dynamicSteps.customizeHardwareTemplate
527
+ : dynamicSteps.customizeHardware,
528
+ 'customizeHardware'
529
+ )
505
530
  ) {
506
531
  value = wizard.removeValidation(
507
- dynamicSteps.customizeHardware,
532
+ forTemplate
533
+ ? dynamicSteps.customizeHardwareTemplate
534
+ : dynamicSteps.customizeHardware,
508
535
  'customizeHardware',
509
536
  value
510
537
  )
@@ -699,8 +726,9 @@ const maxCpus = ref<number>(capabilities.maxCpus)
699
726
  const maxMemory = ref<number>(capabilities.maxMemory)
700
727
 
701
728
  const selectedTemplate = ref<string>('')
702
- const onChangeTemplate = (id: string): void => {
703
- selectedTemplate.value = id
729
+ const onChangeTemplate = (node: UI_I_TreeNode): void => {
730
+ selectedTemplate.value = node.id.toString()
731
+ emits('select-template', node.id.toString())
704
732
  }
705
733
  const selectedOptions = ref<string[]>([])
706
734
  const onChangeSelectOptions = (options: string[]) => {
@@ -717,11 +745,40 @@ const onChangeSelectOptions = (options: string[]) => {
717
745
  } else {
718
746
  wizard.changeScheme(2)
719
747
  }
748
+
749
+ isPowerOnByDefault.value = options.includes('power-on')
720
750
  }
721
751
 
722
752
  const onHideModal = (): void => {
723
753
  emits('hide')
724
754
  }
755
+
756
+ watch(
757
+ () => props.vmtSettings,
758
+ (newValue) => {
759
+ if (newValue) {
760
+ vmForm.value.name = newValue.name
761
+ vmForm.value.compatibility =
762
+ newValue.compatibility || vmForm.value.compatibility
763
+ vmForm.value.storage = newValue.storage
764
+ if (customizeHardware.value?.virtualHardware) {
765
+ customizeHardware.value.virtualHardware.cdDvdDrives =
766
+ newValue.cdDvdDrives
767
+ customizeHardware.value.virtualHardware.hardDisks = newValue.hardDisks
768
+ customizeHardware.value.virtualHardware.networks = newValue.networks
769
+ customizeHardware.value.virtualHardware.cpu = newValue.cpu
770
+ customizeHardware.value.virtualHardware.memory = newValue.memory
771
+ customizeHardware.value.virtualHardware.videoCard = newValue.videoCard
772
+ customizeHardware.value.virtualHardware.usbController =
773
+ newValue.usbController
774
+ customizeHardware.value.virtualHardware.pciDevices = newValue.pciDevices
775
+ customizeHardware.value.vmOptions = newValue.options
776
+ }
777
+ maxCpus.value = newValue.cpu.max_vcpus
778
+ cpuModels.value = newValue.cpu.model
779
+ }
780
+ }
781
+ )
725
782
  </script>
726
783
 
727
784
  <style scoped lang="scss"></style>
@@ -102,6 +102,7 @@
102
102
  :storage-submit="props.storageSubmit"
103
103
  :datastore="props.datastore"
104
104
  :get-datastore-table-func="props.getDatastoreTableFunc"
105
+ :storage="props.vmtSettings?.storage"
105
106
  @submit="emits('change-storage', $event)"
106
107
  />
107
108
  </template>
@@ -184,6 +185,57 @@
184
185
  @get-networks-table="emits('get-networks-table', $event)"
185
186
  @get-pci-devices="emits('get-pci-devices')"
186
187
  />
188
+ </template> </ui-wizard-block
189
+ ><ui-wizard-block
190
+ v-if="selectedStep.id === dynamicSteps.customizeHardwareTemplate && props.vmtSettings"
191
+ >
192
+ <template #content>
193
+ <common-vm-actions-common-customize-hardware
194
+ :project="props.project"
195
+ :vm-name="vmForm.name"
196
+ :guest-machine-type="vmForm.guestMachineType"
197
+ :guest-os-family="vmForm.guestOsFamily"
198
+ :guest-os-version="vmForm.guestOsVersion"
199
+ :storage="vmForm.storage"
200
+ :hard-disks-for-boot-options="props.virtualHardwareHardDisksLocal"
201
+ :cd-dvd-drives-for-boot-options="props.virtualHardwareCdDvdDrivesLocal"
202
+ :networks-for-boot-options="props.virtualHardwareNetworksLocal"
203
+ :cd-dvd-drives="props.vmtSettings.cdDvdDrives || []"
204
+ :hard-disks="props.vmtSettings.hardDisks || []"
205
+ :networks="props.vmtSettings.networks || []"
206
+ :customize-hardware-submit="props.customizeHardwareSubmit"
207
+ :max-cpus="props.maxCpus"
208
+ :max-memory="props.maxMemory"
209
+ :cpu-models="props.cpuModels"
210
+ :cpu="props.vmtSettings.cpu"
211
+ :memory="props.vmtSettings.memory"
212
+ :video-card="props.vmtSettings.videoCard"
213
+ :usb-controller="props.vmtSettings.usbController"
214
+ :pci-devices="props.vmtSettings.pciDevices"
215
+ :hard-disks-for-edit="props.vmtSettings.hardDisks || []"
216
+ :options="props.vmtSettings.options"
217
+ :selected-nav-item="props.selectedNavItem"
218
+ :nodes="props.nodes"
219
+ :files="props.files"
220
+ :networks-table="props.networksTable"
221
+ :error-validation-fields="props.errorValidationFields"
222
+ :get-datastore-table-func="props.getDatastoreTableFunc"
223
+ :datastore="props.datastore"
224
+ :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
225
+ :passthrough-devices="props.passthroughDevices"
226
+ :mediated-devices="props.mediatedDevices"
227
+ :compute-resource="vmForm.computeResource"
228
+ is-clone
229
+ @change-boot-order="emits('change-boot-order', $event)"
230
+ @send-data="emits('change-customize-hardware', $event)"
231
+ @get-storage="emits('get-storage', $event)"
232
+ @get-folders-or-files="emits('get-folders-or-files', $event)"
233
+ @get-active-device-child="emits('get-active-device-child', $event)"
234
+ @show-datastore-child="emits('show-datastore-child', $event)"
235
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
236
+ @get-networks-table="emits('get-networks-table', $event)"
237
+ @get-pci-devices="emits('get-pci-devices')"
238
+ />
187
239
  </template>
188
240
  </ui-wizard-block>
189
241
  <ui-wizard-block v-if="selectedStep.id === dynamicSteps.readyComplete">
@@ -237,13 +289,13 @@ import type {
237
289
  import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
238
290
  import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
239
291
  import type {
240
- UI_T_AddVmFinishFunc,
292
+ // UI_T_AddVmFinishFunc,
241
293
  UI_T_SelectedNavItem,
242
294
  } from '~/components/common/vm/actions/common/lib/models/types'
243
295
  import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
244
296
  import type { UI_I_WizardStep } from '~/components/atoms/wizard/lib/models/interfaces'
245
297
  import type {
246
- UI_I_Capabilities,
298
+ // UI_I_Capabilities,
247
299
  UI_I_VmForm,
248
300
  } from '~/components/common/vm/actions/common/lib/models/interfaces'
249
301
  import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
@@ -257,10 +309,11 @@ import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/mo
257
309
  import type {
258
310
  UI_I_MediatedDevice,
259
311
  UI_I_PciDevice,
312
+ UI_I_VmSettings,
260
313
  } from '~/lib/models/store/vm/interfaces'
314
+ import type { UI_I_WizardTexts } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
261
315
  import { dynamicSteps } from '~/components/common/vm/actions/add/lib/config/steps'
262
316
  import Wizard from '~/components/atoms/wizard/lib/utils/utils'
263
- import type { UI_I_WizardTexts } from 'bfg-uikit/components/ui/wizard/lib/models/interfaces'
264
317
 
265
318
  const vmForm = defineModel<UI_I_VmForm>('vmForm', {
266
319
  required: true,
@@ -310,6 +363,7 @@ const props = defineProps<{
310
363
  dataCenter?: UI_I_TreeNode // для сферы
311
364
  computeResource?: UI_I_TreeNode // для сферы
312
365
  computeResourceTree?: UI_I_TreeNode[] // для сферы
366
+ vmtSettings?: UI_I_VmSettings | null // для шаблонов
313
367
  }>()
314
368
 
315
369
  const emits = defineEmits<{
@@ -323,7 +377,7 @@ const emits = defineEmits<{
323
377
  (event: 'get-pci-devices'): void
324
378
  (event: 'change-steps', value: UI_I_WizardStep[]): void
325
379
  (event: 'finish'): void
326
- (event: 'change-template', value: string): void
380
+ (event: 'change-template', value: UI_I_TreeNode): void
327
381
  (event: 'change-name', value: [string, UI_I_TreeNode | null]): void
328
382
  (
329
383
  event: 'check-name',
@@ -64,6 +64,7 @@
64
64
  v-show="selectedStep.id === dynamicSteps.selectStorage"
65
65
  :storage-submit="props.storageSubmit"
66
66
  :datastore="props.datastore"
67
+ :storage="props.vmtSettings?.storage"
67
68
  :get-datastore-table-func="props.getDatastoreTableFunc"
68
69
  @submit="emits('change-storage', $event)"
69
70
  />
@@ -131,6 +132,56 @@
131
132
  @get-networks-table="emits('get-networks-table', $event)"
132
133
  @get-pci-devices="emits('get-pci-devices')"
133
134
  />
135
+ <common-vm-actions-common-customize-hardware
136
+ v-if="props.vmtSettings"
137
+ v-show="selectedStep.id === dynamicSteps.customizeHardwareTemplate"
138
+ :project="props.project"
139
+ :vm-name="vmForm.name"
140
+ :guest-machine-type="vmForm.guestMachineType"
141
+ :guest-os-family="vmForm.guestOsFamily"
142
+ :guest-os-version="vmForm.guestOsVersion"
143
+ :storage="vmForm.storage"
144
+ :hard-disks-for-boot-options="props.virtualHardwareHardDisksLocal"
145
+ :cd-dvd-drives-for-boot-options="
146
+ props.virtualHardwareCdDvdDrivesLocal
147
+ "
148
+ :networks-for-boot-options="props.virtualHardwareNetworksLocal"
149
+ :cd-dvd-drives="props.vmtSettings.cdDvdDrives || []"
150
+ :hard-disks="props.vmtSettings.hardDisks || []"
151
+ :networks="props.vmtSettings.networks || []"
152
+ :customize-hardware-submit="props.customizeHardwareSubmit"
153
+ :max-cpus="props.maxCpus"
154
+ :max-memory="props.maxMemory"
155
+ :cpu-models="props.cpuModels"
156
+ :cpu="props.vmtSettings.cpu"
157
+ :memory="props.vmtSettings.memory"
158
+ :video-card="props.vmtSettings.videoCard"
159
+ :usb-controller="props.vmtSettings.usbController"
160
+ :pci-devices="props.vmtSettings.pciDevices"
161
+ :hard-disks-for-edit="props.vmtSettings.hardDisks || []"
162
+ :options="props.vmtSettings.options"
163
+ :selected-nav-item="props.selectedNavItem"
164
+ :nodes="props.nodes"
165
+ :files="props.files"
166
+ :networks-table="props.networksTable"
167
+ :error-validation-fields="props.errorValidationFields"
168
+ :get-datastore-table-func="props.getDatastoreTableFunc"
169
+ :datastore="props.datastore"
170
+ :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
171
+ :passthrough-devices="props.passthroughDevices"
172
+ :mediated-devices="props.mediatedDevices"
173
+ :compute-resource="vmForm.computeResource"
174
+ is-clone
175
+ @change-boot-order="emits('change-boot-order', $event)"
176
+ @send-data="emits('change-customize-hardware', $event)"
177
+ @get-storage="emits('get-storage', $event)"
178
+ @get-folders-or-files="emits('get-folders-or-files', $event)"
179
+ @get-active-device-child="emits('get-active-device-child', $event)"
180
+ @show-datastore-child="emits('show-datastore-child', $event)"
181
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
182
+ @get-networks-table="emits('get-networks-table', $event)"
183
+ @get-pci-devices="emits('get-pci-devices')"
184
+ />
134
185
  <common-ready-to-complete
135
186
  v-if="selectedStep.id === dynamicSteps.readyComplete"
136
187
  :data="props.readyCompleteTableInfo"
@@ -179,13 +230,13 @@ import type {
179
230
  import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
180
231
  import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
181
232
  import type {
182
- UI_T_AddVmFinishFunc,
233
+ // UI_T_AddVmFinishFunc,
183
234
  UI_T_SelectedNavItem,
184
235
  } from '~/components/common/vm/actions/common/lib/models/types'
185
236
  import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
186
237
  import type { UI_I_WizardStep } from '~/components/atoms/wizard/lib/models/interfaces'
187
238
  import type {
188
- UI_I_Capabilities,
239
+ // UI_I_Capabilities,
189
240
  UI_I_VmForm,
190
241
  } from '~/components/common/vm/actions/common/lib/models/interfaces'
191
242
  import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
@@ -199,6 +250,7 @@ import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/mo
199
250
  import type {
200
251
  UI_I_MediatedDevice,
201
252
  UI_I_PciDevice,
253
+ UI_I_VmSettings,
202
254
  } from '~/lib/models/store/vm/interfaces'
203
255
  import { dynamicSteps } from '~/components/common/vm/actions/add/lib/config/steps'
204
256
  import Wizard from '~/components/atoms/wizard/lib/utils/utils'
@@ -251,6 +303,7 @@ const props = defineProps<{
251
303
  dataCenter?: UI_I_TreeNode // для сферы
252
304
  computeResource?: UI_I_TreeNode // для сферы
253
305
  computeResourceTree?: UI_I_TreeNode[] // для сферы
306
+ vmtSettings?: UI_I_VmSettings | null // для шаблонов
254
307
  }>()
255
308
 
256
309
  const emits = defineEmits<{
@@ -264,7 +317,7 @@ const emits = defineEmits<{
264
317
  (event: 'get-pci-devices'): void
265
318
  (event: 'change-steps', value: UI_I_WizardStep[]): void
266
319
  (event: 'finish'): void
267
- (event: 'change-template', value: string): void
320
+ (event: 'change-template', value: UI_I_TreeNode): void
268
321
  (event: 'change-name', value: [string, UI_I_TreeNode | null]): void
269
322
  (
270
323
  event: 'check-name',
@@ -14,7 +14,8 @@ export const dynamicSteps = {
14
14
  selectGuestOSMachineType: 8,
15
15
  selectGuestOS: 9,
16
16
  customizeHardware: 10,
17
- readyComplete: 11,
17
+ customizeHardwareTemplate: 11,
18
+ readyComplete: 12,
18
19
  }
19
20
 
20
21
  export const stepsFunc = (
@@ -169,6 +170,21 @@ export const stepsFunc = (
169
170
  },
170
171
  },
171
172
  },
173
+ {
174
+ id: dynamicSteps.customizeHardwareTemplate,
175
+ stepName: '',
176
+ title: localization.common.customizeHardware,
177
+ subTitle: localization.common.configureVirtualMachineHardware,
178
+ status: UI_E_WIZARD_STATUS.INACTIVE,
179
+ isValid: true,
180
+ testId: 'vm-select-customize-hardware',
181
+ fields: {
182
+ customizeHardware: {
183
+ field: '',
184
+ alert: '',
185
+ },
186
+ },
187
+ },
172
188
  {
173
189
  id: dynamicSteps.readyComplete,
174
190
  stepName: '',
@@ -230,7 +246,7 @@ export const stepsSchemeInitial = [
230
246
  dynamicSteps.selectName,
231
247
  dynamicSteps.selectStorage,
232
248
  dynamicSteps.selectOptions,
233
- dynamicSteps.customizeHardware,
249
+ dynamicSteps.customizeHardwareTemplate,
234
250
  dynamicSteps.readyComplete,
235
251
  ],
236
252
  // Deploy from template with Customize the operating system and this virtual machine's hardware (Procurator)
@@ -241,7 +257,7 @@ export const stepsSchemeInitial = [
241
257
  dynamicSteps.selectStorage,
242
258
  dynamicSteps.selectOptions,
243
259
  dynamicSteps.selectGuestOSMachineType,
244
- dynamicSteps.customizeHardware,
260
+ dynamicSteps.customizeHardwareTemplate,
245
261
  dynamicSteps.readyComplete,
246
262
  ],
247
263
  ]
@@ -11,8 +11,8 @@
11
11
  @submit="onFinish"
12
12
  >
13
13
  <template #modalBody="{ selectedStep }">
14
- <atoms-loader v-show="!vmSettings" id="loader" />
15
- <div v-if="vmSettings" class="vm-context">
14
+ <atoms-loader v-show="!vmSettingsLocal" id="loader" />
15
+ <div v-if="vmSettingsLocal" class="vm-context">
16
16
  <common-pages-scheduled-tasks-modals-common-new-task-form
17
17
  v-show="selectedStep.id === dynamicSteps.scheduledTasks"
18
18
  v-model="newTaskForm"
@@ -31,35 +31,35 @@
31
31
  v-show="selectedStep.id === dynamicSteps.selectStorage"
32
32
  :storage-submit="storageSubmit"
33
33
  :datastore="props.datastore"
34
- :storage="vmSettings.storage"
34
+ :storage="vmSettingsLocal.storage"
35
35
  :get-datastore-table-func="props.getDatastoreTableFunc"
36
36
  @submit="onChangeStorage"
37
37
  />
38
38
  <common-vm-actions-common-customize-hardware
39
39
  v-show="selectedStep.id === dynamicSteps.customizeHardware"
40
40
  v-model:vm-name="vmName"
41
- v-model:guest-machine-type="vmSettings.guestMachineType"
42
- v-model:guest-os-family="vmSettings.guestOsFamily"
43
- v-model:guest-os-version="vmSettings.guestOsVersion"
44
- :storage="vmSettings.storage"
41
+ v-model:guest-machine-type="vmSettingsLocal.guestMachineType"
42
+ v-model:guest-os-family="vmSettingsLocal.guestOsFamily"
43
+ v-model:guest-os-version="vmSettingsLocal.guestOsVersion"
44
+ :storage="vmSettingsLocal.storage"
45
45
  :hard-disks-for-boot-options="virtualHardwareHardDisksLocal"
46
46
  :cd-dvd-drives-for-boot-options="virtualHardwareCdDvdDrivesLocal"
47
47
  :networks-for-boot-options="virtualHardwareNetworksLocal"
48
- :cd-dvd-drives="vmSettings.cdDvdDrives"
49
- :hard-disks="vmSettings.hardDisks"
50
- :networks="vmSettings.networks"
48
+ :cd-dvd-drives="vmSettingsLocal.cdDvdDrives"
49
+ :hard-disks="vmSettingsLocal.hardDisks"
50
+ :networks="vmSettingsLocal.networks"
51
51
  :customize-hardware-submit="customizeHardwareSubmit"
52
- :max-cpus="vmSettings.maxCpus"
53
- :max-memory="vmSettings.maxMemory"
54
- :cpu-models="vmSettings.cpuModels"
55
- :cpu="vmSettings.cpu"
56
- :memory="vmSettings.memory"
57
- :video-card="vmSettings.videoCard"
58
- :usb-controller="vmSettings.usbController"
59
- :pci-devices="vmSettings.pciDevices"
52
+ :max-cpus="vmSettingsLocal.maxCpus"
53
+ :max-memory="vmSettingsLocal.maxMemory"
54
+ :cpu-models="vmSettingsLocal.cpuModels"
55
+ :cpu="vmSettingsLocal.cpu"
56
+ :memory="vmSettingsLocal.memory"
57
+ :video-card="vmSettingsLocal.videoCard"
58
+ :usb-controller="vmSettingsLocal.usbController"
59
+ :pci-devices="vmSettingsLocal.pciDevices"
60
60
  :selected-nav-item="selectedNavItem"
61
- :hard-disks-for-edit="vmSettings.hardDisks"
62
- :options="vmSettings.options"
61
+ :hard-disks-for-edit="vmSettingsLocal.hardDisks"
62
+ :options="vmSettingsLocal.options"
63
63
  :nodes="props.nodes"
64
64
  :files="props.files"
65
65
  :networks-table="props.networksTable"
@@ -120,7 +120,7 @@ import type {
120
120
  } from '~/lib/models/store/vm/interfaces'
121
121
  import type {
122
122
  I_DynamicSteps,
123
- UI_I_VmForm,
123
+ // UI_I_VmForm,
124
124
  } from '~/components/common/vm/actions/clone/toTemplate/lib/models/interfaces'
125
125
  import type {
126
126
  UI_I_ValidationReturn,
@@ -396,23 +396,15 @@ const checkCustomizeHardware = async (
396
396
  }
397
397
 
398
398
  const storageIdCash = ref<string | null>(null)
399
- const vmForm = ref<UI_I_VmForm>({
400
- name: '',
401
- storage: null,
402
- options: [],
403
- })
404
399
  const onChangeName = (name: string): void => {
405
- vmForm.value.name = name
400
+ vmSettingsLocal.value && (vmSettingsLocal.value.name = name)
406
401
  }
407
402
  const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
408
403
  if (!storage) return
409
404
 
410
- vmForm.value.storage = storage
405
+ vmSettingsLocal.value && (vmSettingsLocal.value.storage = storage)
411
406
  storageIdCash.value = storage.id
412
407
  }
413
- const onChangeSelectOptions = (options: string[]): void => {
414
- vmForm.value.options = options
415
- }
416
408
  const customizeHardware = ref<UI_I_SendDataCustomizeHardware | null>(null)
417
409
  const onChangeCustomizeHardware = (
418
410
  data: UI_I_SendDataCustomizeHardware
@@ -452,7 +444,7 @@ const isPowerOnByDefault = ref<boolean>(true)
452
444
  watch(
453
445
  () => props.vmNameInWizard,
454
446
  (newValue) => {
455
- vmForm.value.name = newValue
447
+ vmSettingsLocal.value && (vmSettingsLocal.value.name = newValue)
456
448
  }
457
449
  )
458
450
 
@@ -463,7 +455,7 @@ const validateSendData = async (
463
455
  let stepHasError = false
464
456
 
465
457
  const data = await props.validateSendDataFunc(
466
- vmForm.value,
458
+ vmSettingsLocal.value,
467
459
  virtualHardwareCpu.value,
468
460
  virtualHardwareMemory.value,
469
461
  customizeHardware.value,
@@ -489,7 +481,7 @@ const onFinish = (): void => {
489
481
  wizard.setLoader(false)
490
482
  props
491
483
  .finishFunc(
492
- vmForm.value,
484
+ vmSettingsLocal.value,
493
485
  virtualHardwareCpu.value,
494
486
  virtualHardwareMemory.value,
495
487
  customizeHardware.value,
@@ -515,9 +507,9 @@ const storageSubmit = ref<null | Function>(null)
515
507
  const selectOptionsSubmit = ref<number>(0)
516
508
  const customizeHardwareSubmit = ref<null | Function>(null)
517
509
 
518
- const vmSettings = computed<UI_I_VmSettings | null>(() => props.vmSettings)
519
- const vmName = ref<string>(vmSettings.value?.name || '')
520
- watch(vmSettings, (newValue) => {
510
+ const vmSettingsLocal = computed<UI_I_VmSettings | null>(() => props.vmSettings)
511
+ const vmName = ref<string>(vmSettingsLocal.value?.name || '')
512
+ watch(vmSettingsLocal, (newValue) => {
521
513
  vmName.value = newValue?.name || ''
522
514
  })
523
515
 
@@ -26,7 +26,7 @@ const props = defineProps<{
26
26
  templatesTree: UI_I_TreeNode[]
27
27
  }>()
28
28
  const emits = defineEmits<{
29
- (event: 'submit', value: UI_I_TreeNode | null): void
29
+ (event: 'submit', value: UI_I_TreeNode): void
30
30
  }>()
31
31
 
32
32
  const localization = computed<UI_I_Localization>(() => useLocal())
@@ -44,8 +44,7 @@ watch(
44
44
  )
45
45
 
46
46
  const submit = async (cb: Function): Promise<void> => {
47
- if (!selectedNode.value || selectedNode.value.type !== 'vm') {
48
- // TODO change vm to vmTemplate
47
+ if (!selectedNode.value || selectedNode.value.type !== 'vmt') {
49
48
  errors.value = [localization.value.vmWizard.selectValidTemplate]
50
49
  cb(false)
51
50
  return
@@ -34,7 +34,7 @@ watch(
34
34
  (newValue) => {
35
35
  nodes.value = useDeepCopy(newValue)
36
36
  },
37
- { deep: true, once: true }
37
+ { deep: true }
38
38
  )
39
39
 
40
40
  const loading = ref<boolean>(false)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.59",
4
+ "version": "1.5.61",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",