bfg-common 1.2.49 → 1.2.50

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.
@@ -238,12 +238,20 @@ const hardDisks = ref<UI_I_SendDataNewHardDisk[]>([
238
238
  watch(
239
239
  () => props.hardDisks,
240
240
  (newValue) => {
241
- if (!props.isEdit && !props.isClone || !newValue) return
241
+ if ((!props.isEdit && !props.isClone) || !newValue) return
242
242
 
243
243
  const count = newValue?.length || 0
244
244
  hardDisksIndex.value = [...Array(count).keys()]
245
- hardDisksType.value = Array(count).fill(props.isEdit ? 'edit' : 'new')
246
245
  hardDisks.value = newValue
246
+ if (props.isEdit) {
247
+ hardDisksType.value = Array(count).fill('edit')
248
+ } else if (props.isClone) {
249
+ hardDisksType.value = Array(count).fill('new')
250
+ hardDisks.value = newValue.map((hardDisk) => {
251
+ hardDisk.create = true
252
+ return hardDisk
253
+ })
254
+ }
247
255
  },
248
256
  { immediate: true }
249
257
  )
@@ -320,14 +328,18 @@ const networksIndex = ref<number[]>([0])
320
328
  watch(
321
329
  () => props.networks,
322
330
  (newValue) => {
323
- if (!props.isEdit && !props.isClone || !newValue) return
331
+ if ((!props.isEdit && !props.isClone) || !newValue) return
324
332
 
325
333
  // networks.value = newValue
326
334
  // networksType.value = Array(newValue.length).fill('edit')
327
335
  const count = newValue?.length || 0
328
336
  networksIndex.value = [...Array(count).keys()]
329
- networksType.value = Array(count).fill(props.isEdit ? 'edit' : 'new')
330
337
  networks.value = newValue
338
+ if (props.isEdit) {
339
+ networksType.value = Array(count).fill('edit')
340
+ } else if (props.isClone) {
341
+ networksType.value = Array(count).fill('new')
342
+ }
331
343
  },
332
344
  { immediate: true }
333
345
  )
@@ -372,14 +384,18 @@ const cdDvdDrivesType = ref<UI_T_CdDvdType[]>(['new'])
372
384
  watch(
373
385
  () => props.cdDvdDrives,
374
386
  (newValue) => {
375
- if (!props.isEdit && !props.isClone || !newValue) return
387
+ if ((!props.isEdit && !props.isClone) || !newValue) return
376
388
 
377
389
  // cdDvdDrives.value = newValue
378
390
  // cdDvdDrivesType.value = Array(newValue.length).fill('edit')
379
391
  const count = newValue?.length || 0
380
392
  cdDvdDrivesIndex.value = [...Array(count).keys()]
381
- cdDvdDrivesType.value = Array(count).fill(props.isEdit ? 'edit' : 'new')
382
393
  cdDvdDrives.value = newValue
394
+ if (props.isEdit) {
395
+ cdDvdDrivesType.value = Array(count).fill('edit')
396
+ } else if (props.isClone) {
397
+ cdDvdDrivesType.value = Array(count).fill('new')
398
+ }
383
399
  },
384
400
  { immediate: true }
385
401
  )
@@ -390,7 +406,7 @@ const addCdDvdDrive = (): void => {
390
406
  cdDvdDrives.value.push({
391
407
  ...useDeepCopy(defaultCdDvdDriver),
392
408
  attach: true,
393
- boot_order: 0 // Убираем галочку
409
+ boot_order: 0, // Убираем галочку
394
410
  })
395
411
  }
396
412
  const onRemoveCdDvdDrive = (
@@ -442,12 +458,16 @@ const pciDevices = ref<UI_I_PciDevice[]>([])
442
458
  watch(
443
459
  () => props.pciDevices,
444
460
  (newValue) => {
445
- if (!props.isEdit && !props.isClone) return
461
+ if ((!props.isEdit && !props.isClone) || !newValue) return
446
462
 
447
463
  const count = newValue?.length || 0
448
464
  pciDevicesIndex.value = [...Array(count).keys()]
449
- pciDevicesType.value = Array(count).fill(props.isEdit ? 'edit' : 'new')
450
465
  pciDevices.value = newValue || []
466
+ if (props.isEdit) {
467
+ pciDevicesType.value = Array(count).fill('edit')
468
+ } else if (props.isClone) {
469
+ pciDevicesType.value = Array(count).fill('new')
470
+ }
451
471
  },
452
472
  { immediate: true }
453
473
  )
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.2.49",
4
+ "version": "1.2.50",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",