bfg-common 1.5.556 → 1.5.558
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.
- package/assets/localization/local_be.json +4 -20
- package/assets/localization/local_en.json +4 -20
- package/assets/localization/local_hy.json +4 -20
- package/assets/localization/local_kk.json +4 -20
- package/assets/localization/local_ru.json +4 -20
- package/assets/localization/local_zh.json +5 -21
- package/components/common/modals/confirmByInput/ConfirmByInput.vue +1 -9
- package/components/common/modals/confirmByInput/ConfirmByInputNew.vue +2 -7
- package/components/common/pages/backups/modals/createBackup/New.vue +2 -8
- package/components/common/pages/backups/modals/restore/Restore.vue +5 -9
- package/components/common/pages/backups/modals/restore/RestoreNew.vue +3 -13
- package/components/common/pages/backups/modals/restore/RestoreOld.vue +18 -6
- package/components/common/vm/actions/add/Add.vue +46 -119
- package/components/common/vm/actions/add/New.vue +16 -54
- package/components/common/vm/actions/add/Old.vue +16 -55
- package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +14 -81
- package/components/common/vm/actions/common/customizeHardware/CustomizeHardwareNew.vue +7 -56
- package/components/common/vm/actions/common/customizeHardware/CustomizeHardwareOld.vue +8 -56
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue +73 -142
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardwareNew.vue +60 -54
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardwareOld.vue +61 -55
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Cpu.vue +139 -159
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CpuNew.vue +8 -15
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CpuOld.vue +8 -13
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +62 -75
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +58 -74
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbController.vue +6 -17
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbControllerNew.vue +6 -3
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbControllerOld.vue +6 -3
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCard.vue +17 -39
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCardNew.vue +6 -5
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCardOld.vue +6 -5
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/lib/config/options.ts +4 -4
- package/components/common/vm/actions/common/customizeHardware/vmoptions/Vmoptions.vue +6 -93
- package/components/common/vm/actions/common/customizeHardware/vmoptions/VmoptionsNew.vue +8 -62
- package/components/common/vm/actions/common/customizeHardware/vmoptions/VmoptionsOld.vue +8 -60
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptions.vue +5 -69
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptionsNew.vue +12 -32
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptionsOld.vue +12 -33
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +114 -132
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/OrderNew.vue +41 -6
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/OrderOld.vue +44 -6
- package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +8 -23
- package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptionsNew.vue +21 -31
- package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptionsOld.vue +26 -34
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/New.vue +28 -34
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/Old.vue +24 -30
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/RemoteConsoleOptions.vue +8 -112
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +3 -3
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/{KeymapNew.vue → New.vue} +6 -6
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/{KeymapOld.vue → Old.vue} +5 -5
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/Password.vue +6 -7
- package/components/common/vm/actions/common/customizeHardware/vmoptions/tools/Tools.vue +4 -38
- package/components/common/vm/actions/common/customizeHardware/vmoptions/tools/ToolsNew.vue +7 -26
- package/components/common/vm/actions/common/customizeHardware/vmoptions/tools/ToolsOld.vue +24 -50
- package/components/common/vm/actions/common/lib/models/interfaces.ts +57 -25
- package/components/common/vm/actions/editSettings/EditSettings.vue +21 -35
- package/components/common/vm/actions/editSettings/EditSettingsOld.vue +14 -41
- package/components/common/vm/actions/editSettings/new/New.vue +14 -41
- package/components/common/vm/actions/lib/models/interfaces.ts +4 -29
- package/components/common/vm/actions/lib/utils.ts +37 -32
- package/package.json +1 -3
- /package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/{PasswordNew.vue → New.vue} +0 -0
- /package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/{PasswordOld.vue → Old.vue} +0 -0
package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<common-vm-actions-common-customize-hardware-virtual-hardware-new
|
|
3
3
|
v-if="isNewView"
|
|
4
|
+
v-model="model"
|
|
4
5
|
v-model:cpu-invalid="cpuInvalid"
|
|
5
6
|
v-model:memory-invalid="memoryInvalid"
|
|
6
7
|
v-model:video-card-invalid="videoCardInvalid"
|
|
@@ -9,7 +10,6 @@
|
|
|
9
10
|
:is-edit="props.isEdit"
|
|
10
11
|
:storage="props.storage"
|
|
11
12
|
:project="props.project"
|
|
12
|
-
:max-cpus="props.maxCpus"
|
|
13
13
|
:max-memory="props.maxMemory"
|
|
14
14
|
:cpu-models="props.cpuModels"
|
|
15
15
|
:datastore="props.datastore"
|
|
@@ -27,15 +27,11 @@
|
|
|
27
27
|
:cd-dvd-drives-index="cdDvdDrivesIndex"
|
|
28
28
|
:error-validation-fields="errorValidationFields"
|
|
29
29
|
:get-datastore-table-func="getDatastoreTableFunc"
|
|
30
|
-
:cpu="cpu"
|
|
31
30
|
:state="state"
|
|
32
|
-
:memory="memory"
|
|
33
|
-
:networks="networksLocal"
|
|
34
31
|
:hard-disks="hardDisksLocal"
|
|
35
32
|
:video-card="videoCard"
|
|
36
33
|
:pci-devices="pciDevicesLocal"
|
|
37
34
|
:cd-dvd-drives="cdDvdDrivesLocal"
|
|
38
|
-
:usb-controller="usbController"
|
|
39
35
|
:guest-machine-type="guestMachineType"
|
|
40
36
|
:passthrough-devices="passthroughDevices"
|
|
41
37
|
:mediated-devices="mediatedDevices"
|
|
@@ -55,22 +51,18 @@
|
|
|
55
51
|
@remove-cd-dvd-drive="onRemoveCdDvdDrive(...$event)"
|
|
56
52
|
@show-datastore-child="emits('show-datastore-child', $event)"
|
|
57
53
|
@get-folders-or-files="emits('get-folders-or-files', $event)"
|
|
58
|
-
@send-data-cpu-method="onSendDataCpuMethod"
|
|
59
54
|
@set-invalid-hard-disk="onSetInvalidHardDisk(...$event)"
|
|
60
55
|
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
61
56
|
@roll-back-cd-dvd-drive="onRollBackCdDvdDrive"
|
|
62
57
|
@set-invalid-pci-device="onSetInvalidPciDevice(...$event)"
|
|
63
58
|
@get-active-device-child="emits('get-active-device-child', $event)"
|
|
64
|
-
@send-data-memory-method="onSendDataMemoryMethod"
|
|
65
|
-
@send-data-video-card-method="onSendDataVideoCardMethod"
|
|
66
|
-
@send-data-new-network-method="sendDataNewNetworkMethod(...$event)"
|
|
67
59
|
@send-data-pci-devices-method="onSendDataPciDevicesMethod(...$event)"
|
|
68
60
|
@send-data-new-hard-disk-method="onSendDataNewHardDiskMethod(...$event)"
|
|
69
61
|
@send-data-new-cd-dvd-drive-method="sendDataNewCdDvdDriveMethod(...$event)"
|
|
70
|
-
@send-data-new-usb-controller-method="onSendDataNewUsbControllerMethod"
|
|
71
62
|
/>
|
|
72
63
|
<common-vm-actions-common-customize-hardware-virtual-hardware-old
|
|
73
64
|
v-else
|
|
65
|
+
v-model="model"
|
|
74
66
|
v-model:cpu-invalid="cpuInvalid"
|
|
75
67
|
v-model:memory-invalid="memoryInvalid"
|
|
76
68
|
v-model:video-card-invalid="videoCardInvalid"
|
|
@@ -79,7 +71,6 @@
|
|
|
79
71
|
:is-edit="props.isEdit"
|
|
80
72
|
:storage="props.storage"
|
|
81
73
|
:project="props.project"
|
|
82
|
-
:max-cpus="props.maxCpus"
|
|
83
74
|
:max-memory="props.maxMemory"
|
|
84
75
|
:cpu-models="props.cpuModels"
|
|
85
76
|
:datastore="props.datastore"
|
|
@@ -97,15 +88,11 @@
|
|
|
97
88
|
:cd-dvd-drives-index="cdDvdDrivesIndex"
|
|
98
89
|
:error-validation-fields="errorValidationFields"
|
|
99
90
|
:get-datastore-table-func="getDatastoreTableFunc"
|
|
100
|
-
:cpu="cpu"
|
|
101
91
|
:state="state"
|
|
102
|
-
:memory="memory"
|
|
103
|
-
:networks="networksLocal"
|
|
104
92
|
:hard-disks="hardDisksLocal"
|
|
105
93
|
:video-card="videoCard"
|
|
106
94
|
:pci-devices="pciDevicesLocal"
|
|
107
95
|
:cd-dvd-drives="cdDvdDrivesLocal"
|
|
108
|
-
:usb-controller="usbController"
|
|
109
96
|
:guest-machine-type="guestMachineType"
|
|
110
97
|
:passthrough-devices="passthroughDevices"
|
|
111
98
|
:mediated-devices="mediatedDevices"
|
|
@@ -124,19 +111,14 @@
|
|
|
124
111
|
@remove-cd-dvd-drive="onRemoveCdDvdDrive(...$event)"
|
|
125
112
|
@show-datastore-child="emits('show-datastore-child', $event)"
|
|
126
113
|
@get-folders-or-files="emits('get-folders-or-files', $event)"
|
|
127
|
-
@send-data-cpu-method="onSendDataCpuMethod"
|
|
128
114
|
@set-invalid-hard-disk="onSetInvalidHardDisk(...$event)"
|
|
129
115
|
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
130
116
|
@roll-back-cd-dvd-drive="onRollBackCdDvdDrive"
|
|
131
117
|
@set-invalid-pci-device="onSetInvalidPciDevice(...$event)"
|
|
132
118
|
@get-active-device-child="emits('get-active-device-child', $event)"
|
|
133
|
-
@send-data-memory-method="onSendDataMemoryMethod"
|
|
134
|
-
@send-data-video-card-method="onSendDataVideoCardMethod"
|
|
135
|
-
@send-data-new-network-method="sendDataNewNetworkMethod(...$event)"
|
|
136
119
|
@send-data-pci-devices-method="onSendDataPciDevicesMethod(...$event)"
|
|
137
120
|
@send-data-new-hard-disk-method="onSendDataNewHardDiskMethod(...$event)"
|
|
138
121
|
@send-data-new-cd-dvd-drive-method="sendDataNewCdDvdDriveMethod(...$event)"
|
|
139
|
-
@send-data-new-usb-controller-method="onSendDataNewUsbControllerMethod"
|
|
140
122
|
/>
|
|
141
123
|
</template>
|
|
142
124
|
|
|
@@ -148,13 +130,9 @@ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
|
|
|
148
130
|
import type { UI_I_FolderOrFileTreePayload } from '~/lib/models/store/storage/interfaces'
|
|
149
131
|
import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
|
|
150
132
|
import type {
|
|
151
|
-
UI_I_SendDataCpu,
|
|
152
|
-
UI_I_SendDataMemory,
|
|
153
133
|
UI_I_SendDataNewHardDisk,
|
|
154
|
-
UI_I_SendDataNewNetwork,
|
|
155
134
|
UI_I_SendDataVideoCard,
|
|
156
135
|
UI_I_InvalidKeys,
|
|
157
|
-
UI_I_SendDataVirtualHardware,
|
|
158
136
|
UI_I_SendDataNewCdDvdDrive,
|
|
159
137
|
// UI_I_HardDisk,
|
|
160
138
|
UI_I_SendDataNewPciDevice,
|
|
@@ -172,23 +150,23 @@ import type {
|
|
|
172
150
|
} from '~/components/atoms/dropdown/tree/lib/models/interfaces'
|
|
173
151
|
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
174
152
|
import type {
|
|
175
|
-
API_UI_I_VmEditCpu,
|
|
176
|
-
API_UI_I_VmEditMemory,
|
|
177
153
|
UI_I_MediatedDevice,
|
|
178
154
|
UI_I_PciDevice,
|
|
179
155
|
} from '~/lib/models/store/vm/interfaces'
|
|
180
156
|
import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
|
|
157
|
+
import type { UI_I_CreateVmData } from '~/components/common/vm/actions/common/lib/models/interfaces'
|
|
181
158
|
import { dropdownItemsFunc } from './lib/config/dropdownItems'
|
|
182
159
|
|
|
160
|
+
const model = defineModel<UI_I_CreateVmData>({ required: true })
|
|
161
|
+
|
|
183
162
|
const props = withDefaults(
|
|
184
163
|
defineProps<{
|
|
185
164
|
storage: UI_I_DatastoreTableItem | null
|
|
186
165
|
cpuModels: UI_I_OptionItem[]
|
|
187
|
-
maxCpus: number
|
|
188
166
|
maxMemory: number
|
|
189
167
|
isEdit: boolean
|
|
190
168
|
isClone: boolean
|
|
191
|
-
errorValidationFields: UI_I_ErrorValidationField
|
|
169
|
+
errorValidationFields: UI_I_ErrorValidationField[]
|
|
192
170
|
nodes: UI_I_FileTreeNode[]
|
|
193
171
|
files: UI_I_FileTreeNode[]
|
|
194
172
|
networksTable: UI_I_NetworkTableItem[]
|
|
@@ -197,14 +175,10 @@ const props = withDefaults(
|
|
|
197
175
|
isDatastoreLoading: boolean
|
|
198
176
|
project: UI_T_Project
|
|
199
177
|
state?: string | number
|
|
200
|
-
cpu?: API_UI_I_VmEditCpu
|
|
201
|
-
memory?: API_UI_I_VmEditMemory
|
|
202
178
|
vmCpuHelpTextSecond?: string
|
|
203
179
|
hardDisks?: UI_I_SendDataNewHardDisk[] | null
|
|
204
180
|
cdDvdDrives?: UI_I_SendDataNewCdDvdDrive[] | null
|
|
205
|
-
networks?: UI_I_SendDataNewNetwork[] | null
|
|
206
181
|
videoCard?: UI_I_SendDataVideoCard
|
|
207
|
-
usbController?: string
|
|
208
182
|
pciDevices?: UI_I_SendDataNewPciDevice[]
|
|
209
183
|
passthroughDevices?: UI_I_PciDevice[]
|
|
210
184
|
mediatedDevices?: UI_I_MediatedDevice[]
|
|
@@ -214,14 +188,10 @@ const props = withDefaults(
|
|
|
214
188
|
}>(),
|
|
215
189
|
{
|
|
216
190
|
state: undefined,
|
|
217
|
-
cpu: undefined,
|
|
218
|
-
memory: undefined,
|
|
219
191
|
vmCpuHelpTextSecond: undefined,
|
|
220
192
|
hardDisks: undefined,
|
|
221
193
|
cdDvdDrives: undefined,
|
|
222
|
-
networks: undefined,
|
|
223
194
|
videoCard: undefined,
|
|
224
|
-
usbController: undefined,
|
|
225
195
|
pciDevices: undefined,
|
|
226
196
|
passthroughDevices: undefined,
|
|
227
197
|
mediatedDevices: undefined,
|
|
@@ -231,7 +201,6 @@ const props = withDefaults(
|
|
|
231
201
|
}
|
|
232
202
|
)
|
|
233
203
|
const emits = defineEmits<{
|
|
234
|
-
(event: 'send-data', value: UI_I_SendDataVirtualHardware): void
|
|
235
204
|
(event: 'invalid', value: string[]): void
|
|
236
205
|
(event: 'get-storage', value: UI_I_TablePayload): void
|
|
237
206
|
(event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
|
|
@@ -301,6 +270,18 @@ const addHardDisk = (
|
|
|
301
270
|
let provisionType = 'thick'
|
|
302
271
|
if (provisioned_type === 1) provisionType = 'thin'
|
|
303
272
|
|
|
273
|
+
model.value.disk_devices = [
|
|
274
|
+
...model.value.disk_devices.filter((disk) => disk.device_type !== 'cdrom'),
|
|
275
|
+
{
|
|
276
|
+
create,
|
|
277
|
+
size,
|
|
278
|
+
source,
|
|
279
|
+
attach: true,
|
|
280
|
+
boot_order: 0, // Убираем галочку
|
|
281
|
+
provision_type: provisionType,
|
|
282
|
+
},
|
|
283
|
+
...model.value.disk_devices.filter((disk) => disk.device_type === 'cdrom'),
|
|
284
|
+
]
|
|
304
285
|
hardDisksLocal.value.push({
|
|
305
286
|
create,
|
|
306
287
|
size,
|
|
@@ -309,7 +290,6 @@ const addHardDisk = (
|
|
|
309
290
|
boot_order: 0, // Убираем галочку
|
|
310
291
|
provision_type: provisionType,
|
|
311
292
|
})
|
|
312
|
-
sendData()
|
|
313
293
|
}
|
|
314
294
|
const onAddExistHardDisk = (file: UI_I_FileTreeNode): void => {
|
|
315
295
|
addHardDisk(
|
|
@@ -331,7 +311,6 @@ const onRemoveHardDisk = (
|
|
|
331
311
|
if (key === removeIndex) return 'removed'
|
|
332
312
|
return item
|
|
333
313
|
})
|
|
334
|
-
sendData()
|
|
335
314
|
return
|
|
336
315
|
}
|
|
337
316
|
|
|
@@ -340,6 +319,11 @@ const onRemoveHardDisk = (
|
|
|
340
319
|
(_item, key) => key !== removeIndex
|
|
341
320
|
)
|
|
342
321
|
|
|
322
|
+
model.value.disk_devices = model.value.disk_devices.filter(
|
|
323
|
+
(_hardDisk, key: number) => {
|
|
324
|
+
return removeIndex !== key
|
|
325
|
+
}
|
|
326
|
+
)
|
|
343
327
|
hardDisksLocal.value = hardDisksLocal.value.filter(
|
|
344
328
|
(_hardDisk, key: number) => {
|
|
345
329
|
return removeIndex !== key
|
|
@@ -347,8 +331,6 @@ const onRemoveHardDisk = (
|
|
|
347
331
|
)
|
|
348
332
|
|
|
349
333
|
delete newHardDiskInvalidKeys.value[index]
|
|
350
|
-
delete sendDataNewHardDisk.value[index]
|
|
351
|
-
sendData()
|
|
352
334
|
}
|
|
353
335
|
const onRollBackHardDisk = (index: number): void => {
|
|
354
336
|
const removeIndex = hardDisksIndex.value.indexOf(index)
|
|
@@ -358,51 +340,39 @@ const onRollBackHardDisk = (index: number): void => {
|
|
|
358
340
|
})
|
|
359
341
|
}
|
|
360
342
|
|
|
343
|
+
const networksType = ref<UI_T_NetworkType[]>(['new'])
|
|
344
|
+
const networksIndex = ref<number[]>([0])
|
|
345
|
+
if (!model.value.network_devices.length) {
|
|
346
|
+
networksType.value = []
|
|
347
|
+
networksIndex.value = []
|
|
348
|
+
}
|
|
349
|
+
model.value.network_devices.forEach(() => {
|
|
350
|
+
if (!props.isEdit && !props.isClone) return
|
|
351
|
+
|
|
352
|
+
const count = model.value.network_devices.length || 0
|
|
353
|
+
networksIndex.value = [...Array(count).keys()]
|
|
354
|
+
if (props.isEdit) {
|
|
355
|
+
networksType.value = Array(count).fill('edit')
|
|
356
|
+
} else if (props.isClone) {
|
|
357
|
+
networksType.value = Array(count).fill('clone')
|
|
358
|
+
}
|
|
359
|
+
})
|
|
360
|
+
|
|
361
361
|
const defaultNetwork = {
|
|
362
362
|
network: '',
|
|
363
363
|
net_bridge: '',
|
|
364
364
|
mac: '',
|
|
365
365
|
target: '',
|
|
366
|
-
model: '',
|
|
367
|
-
boot_order:
|
|
366
|
+
model: 'rtl8139',
|
|
367
|
+
boot_order: 0,
|
|
368
368
|
}
|
|
369
|
-
const networksLocal = ref<UI_I_SendDataNewNetwork[]>([
|
|
370
|
-
useDeepCopy(defaultNetwork),
|
|
371
|
-
])
|
|
372
|
-
const networksType = ref<UI_T_NetworkType[]>(['new'])
|
|
373
|
-
const networksIndex = ref<number[]>([0])
|
|
374
|
-
watch(
|
|
375
|
-
() => props.networks,
|
|
376
|
-
(newValue) => {
|
|
377
|
-
if (!props.isEdit && !props.isClone) return
|
|
378
|
-
if (!newValue) {
|
|
379
|
-
networksLocal.value = []
|
|
380
|
-
networksType.value = []
|
|
381
|
-
networksIndex.value = []
|
|
382
|
-
return
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
// networksLocal.value = newValue
|
|
386
|
-
// networksType.value = Array(newValue.length).fill('edit')
|
|
387
|
-
const count = newValue?.length || 0
|
|
388
|
-
networksIndex.value = [...Array(count).keys()]
|
|
389
|
-
networksLocal.value = newValue
|
|
390
|
-
if (props.isEdit) {
|
|
391
|
-
networksType.value = Array(count).fill('edit')
|
|
392
|
-
} else if (props.isClone) {
|
|
393
|
-
networksType.value = Array(count).fill('clone')
|
|
394
|
-
}
|
|
395
|
-
},
|
|
396
|
-
{ immediate: true }
|
|
397
|
-
)
|
|
398
369
|
const addNetwork = (): void => {
|
|
399
370
|
const index = (networksIndex.value.at(-1) ?? -1) + 1
|
|
400
371
|
networksIndex.value.push(index)
|
|
401
372
|
networksType.value.push('new')
|
|
402
373
|
|
|
403
|
-
|
|
374
|
+
model.value.network_devices.push({
|
|
404
375
|
...useDeepCopy(defaultNetwork),
|
|
405
|
-
boot_order: 0, // Убираем галочку
|
|
406
376
|
})
|
|
407
377
|
}
|
|
408
378
|
const onRemoveNetwork = (index: number): void => {
|
|
@@ -411,13 +381,11 @@ const onRemoveNetwork = (index: number): void => {
|
|
|
411
381
|
networksType.value = networksType.value.filter(
|
|
412
382
|
(_item, key) => key !== removeIndex
|
|
413
383
|
)
|
|
414
|
-
|
|
384
|
+
model.value.network_devices = model.value.network_devices.filter(
|
|
415
385
|
(_network, key: number) => removeIndex !== key
|
|
416
386
|
)
|
|
417
387
|
|
|
418
388
|
delete newNetworkInvalidKeys.value[index]
|
|
419
|
-
delete sendDataNewNetwork.value[index]
|
|
420
|
-
sendData()
|
|
421
389
|
}
|
|
422
390
|
|
|
423
391
|
const defaultCdDvdDriver: UI_I_SendDataNewCdDvdDrive = {
|
|
@@ -455,6 +423,11 @@ const addCdDvdDrive = (): void => {
|
|
|
455
423
|
const value = (cdDvdDrivesIndex.value.at(-1) ?? -1) + 1
|
|
456
424
|
cdDvdDrivesIndex.value.push(value)
|
|
457
425
|
cdDvdDrivesType.value.push('new')
|
|
426
|
+
model.value.disk_devices.push({
|
|
427
|
+
...useDeepCopy(defaultCdDvdDriver),
|
|
428
|
+
attach: true,
|
|
429
|
+
boot_order: 0, // Убираем галочку
|
|
430
|
+
})
|
|
458
431
|
cdDvdDrivesLocal.value.push({
|
|
459
432
|
...useDeepCopy(defaultCdDvdDriver),
|
|
460
433
|
attach: true,
|
|
@@ -473,7 +446,6 @@ const onRemoveCdDvdDrive = (
|
|
|
473
446
|
if (key === removeIndex) return 'removed'
|
|
474
447
|
return item
|
|
475
448
|
})
|
|
476
|
-
sendData()
|
|
477
449
|
return
|
|
478
450
|
}
|
|
479
451
|
|
|
@@ -483,12 +455,12 @@ const onRemoveCdDvdDrive = (
|
|
|
483
455
|
cdDvdDrivesType.value = cdDvdDrivesType.value.filter(
|
|
484
456
|
(_item, key) => key !== index
|
|
485
457
|
)
|
|
458
|
+
model.value.disk_devices = model.value.disk_devices.filter(
|
|
459
|
+
(_cdDvdDrive, key: number) => removeIndex !== key
|
|
460
|
+
)
|
|
486
461
|
cdDvdDrivesLocal.value = cdDvdDrivesLocal.value.filter(
|
|
487
462
|
(_cdDvdDrive, key: number) => removeIndex !== key
|
|
488
463
|
)
|
|
489
|
-
|
|
490
|
-
delete sendDataNewCdDvdDrive.value[index]
|
|
491
|
-
sendData()
|
|
492
464
|
}
|
|
493
465
|
const onRollBackCdDvdDrive = (index: number): void => {
|
|
494
466
|
const removeIndex = cdDvdDrivesIndex.value.indexOf(index)
|
|
@@ -530,6 +502,7 @@ const addPciDevice = (): void => {
|
|
|
530
502
|
pciDevicesType.value.push('new')
|
|
531
503
|
|
|
532
504
|
pciDevicesLocal.value.push(useDeepCopy(defaultPciDevice))
|
|
505
|
+
model.value.passthrough_pci_devices.push(useDeepCopy(defaultPciDevice))
|
|
533
506
|
}
|
|
534
507
|
const onRemovePciDevice = (index: number): void => {
|
|
535
508
|
const removeIndex = pciDevicesIndex.value.indexOf(index)
|
|
@@ -538,6 +511,11 @@ const onRemovePciDevice = (index: number): void => {
|
|
|
538
511
|
(_item, key) => key !== removeIndex
|
|
539
512
|
)
|
|
540
513
|
|
|
514
|
+
model.value.passthrough_pci_devices = model.value.passthrough_pci_devices.filter(
|
|
515
|
+
(_pciDevice, key: number) => {
|
|
516
|
+
return removeIndex !== key
|
|
517
|
+
}
|
|
518
|
+
)
|
|
541
519
|
pciDevicesLocal.value = pciDevicesLocal.value.filter(
|
|
542
520
|
(_pciDevice, key: number) => {
|
|
543
521
|
return removeIndex !== key
|
|
@@ -545,8 +523,6 @@ const onRemovePciDevice = (index: number): void => {
|
|
|
545
523
|
)
|
|
546
524
|
|
|
547
525
|
delete newPciDeviceInvalidKeys.value[index]
|
|
548
|
-
delete sendDataNewPciDevices.value[index]
|
|
549
|
-
sendData()
|
|
550
526
|
}
|
|
551
527
|
|
|
552
528
|
const isShowFileModal = ref<boolean>(false)
|
|
@@ -571,80 +547,35 @@ const onAddDevice = (item: UI_I_DropdownTreeItemChild): void => {
|
|
|
571
547
|
}
|
|
572
548
|
|
|
573
549
|
const cpuInvalid = ref<boolean>(false)
|
|
574
|
-
const sendDataCpu = ref<UI_I_SendDataCpu | null>(null)
|
|
575
|
-
const onSendDataCpuMethod = (data: UI_I_SendDataCpu): void => {
|
|
576
|
-
sendDataCpu.value = data
|
|
577
|
-
sendData()
|
|
578
|
-
}
|
|
579
|
-
const sendDataMemory = ref<UI_I_SendDataMemory | null>(null)
|
|
580
|
-
const onSendDataMemoryMethod = (data: UI_I_SendDataMemory): void => {
|
|
581
|
-
sendDataMemory.value = data
|
|
582
|
-
sendData()
|
|
583
|
-
}
|
|
584
|
-
const sendDataNewHardDisk = ref<UI_I_SendDataNewHardDisk[]>([])
|
|
585
550
|
const onSendDataNewHardDiskMethod = (
|
|
586
551
|
data: UI_I_SendDataNewHardDisk,
|
|
587
552
|
index: number
|
|
588
553
|
): void => {
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
const sendDataNewNetworkMethod = (
|
|
594
|
-
data: UI_I_SendDataNewNetwork,
|
|
595
|
-
index: number
|
|
596
|
-
): void => {
|
|
597
|
-
sendDataNewNetwork.value[index] = data
|
|
598
|
-
sendData()
|
|
554
|
+
model.value.disk_devices[index] = {
|
|
555
|
+
...data,
|
|
556
|
+
boot_order: model.value.disk_devices[index]?.boot_order || 0,
|
|
557
|
+
}
|
|
599
558
|
}
|
|
600
|
-
const sendDataNewCdDvdDrive = ref<UI_I_SendDataNewCdDvdDrive[]>([])
|
|
601
559
|
const sendDataNewCdDvdDriveMethod = (
|
|
602
560
|
data: UI_I_SendDataNewCdDvdDrive,
|
|
603
561
|
index: number
|
|
604
562
|
): void => {
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
563
|
+
const cdromIndexStart = model.value.disk_devices.findIndex(
|
|
564
|
+
(disk) => disk.device_type === 'cdrom'
|
|
565
|
+
)
|
|
566
|
+
model.value.disk_devices[cdromIndexStart + index] = {
|
|
567
|
+
...data,
|
|
568
|
+
boot_order:
|
|
569
|
+
model.value.disk_devices[cdromIndexStart + index]?.boot_order || 0,
|
|
570
|
+
}
|
|
612
571
|
}
|
|
613
|
-
const sendDataNewPciDevices = ref<UI_I_SendDataNewPciDevice[]>([])
|
|
614
572
|
const onSendDataPciDevicesMethod = (
|
|
615
573
|
data: UI_I_SendDataNewPciDevice,
|
|
616
574
|
index: number
|
|
617
575
|
): void => {
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
}
|
|
621
|
-
const sendDataVideoCard = ref<UI_I_SendDataVideoCard | null>(null)
|
|
622
|
-
const onSendDataVideoCardMethod = (data: UI_I_SendDataVideoCard): void => {
|
|
623
|
-
sendDataVideoCard.value = data
|
|
624
|
-
sendData()
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
const sendData = (): void => {
|
|
628
|
-
const cpu = sendDataCpu.value
|
|
629
|
-
const memory = sendDataMemory.value
|
|
630
|
-
const hardDisks = sendDataNewHardDisk.value.flat(2)
|
|
631
|
-
const networks = sendDataNewNetwork.value.flat(2)
|
|
632
|
-
const cdDvdDrives = sendDataNewCdDvdDrive.value.flat(2)
|
|
633
|
-
const pciDevices = sendDataNewPciDevices.value.flat()
|
|
634
|
-
const usbController = sendDataNewUsbController.value
|
|
635
|
-
const videoCard = sendDataVideoCard.value
|
|
636
|
-
|
|
637
|
-
const sendData: UI_I_SendDataVirtualHardware = {
|
|
638
|
-
cpu,
|
|
639
|
-
memory,
|
|
640
|
-
usbController,
|
|
641
|
-
pciDevices,
|
|
642
|
-
networks,
|
|
643
|
-
hardDisks,
|
|
644
|
-
cdDvdDrives,
|
|
645
|
-
videoCard,
|
|
576
|
+
model.value.passthrough_pci_devices[index] = {
|
|
577
|
+
...data,
|
|
646
578
|
}
|
|
647
|
-
emits('send-data', sendData)
|
|
648
579
|
}
|
|
649
580
|
|
|
650
581
|
const onSetInvalidHardDisk = (invalid: boolean, index: number): void => {
|