bfg-common 1.5.580 → 1.5.581
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/components/common/vm/actions/add/Add.vue +120 -46
- package/components/common/vm/actions/add/New.vue +54 -16
- package/components/common/vm/actions/add/Old.vue +55 -16
- package/components/common/vm/actions/clone/Clone.vue +116 -44
- package/components/common/vm/actions/clone/new/New.vue +50 -14
- package/components/common/vm/actions/clone/old/Old.vue +52 -16
- package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +81 -14
- package/components/common/vm/actions/common/customizeHardware/CustomizeHardwareNew.vue +56 -7
- package/components/common/vm/actions/common/customizeHardware/CustomizeHardwareOld.vue +56 -8
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue +206 -211
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardwareNew.vue +120 -225
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardwareOld.vue +118 -220
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDrive.vue +53 -66
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Cpu.vue +159 -139
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CpuNew.vue +15 -8
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CpuOld.vue +13 -8
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +75 -62
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +149 -241
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDiskNew.vue +4 -3
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDiskOld.vue +3 -2
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +100 -62
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbController.vue +17 -6
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbControllerNew.vue +3 -6
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbControllerOld.vue +3 -6
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCard.vue +39 -17
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCardNew.vue +5 -6
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCardOld.vue +5 -6
- 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 +93 -6
- package/components/common/vm/actions/common/customizeHardware/vmoptions/VmoptionsNew.vue +60 -8
- package/components/common/vm/actions/common/customizeHardware/vmoptions/VmoptionsOld.vue +58 -8
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptions.vue +69 -5
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptionsNew.vue +32 -12
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptionsOld.vue +33 -12
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +132 -114
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/OrderNew.vue +6 -41
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/OrderOld.vue +6 -44
- package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +23 -8
- package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptionsNew.vue +31 -21
- package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptionsOld.vue +34 -26
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/New.vue +34 -28
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/Old.vue +30 -24
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/RemoteConsoleOptions.vue +112 -8
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +3 -3
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/{New.vue → KeymapNew.vue} +6 -6
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/{Old.vue → KeymapOld.vue} +5 -5
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/Password.vue +7 -6
- package/components/common/vm/actions/common/customizeHardware/vmoptions/tools/Tools.vue +27 -9
- package/components/common/vm/actions/common/lib/models/interfaces.ts +25 -58
- package/components/common/vm/actions/editSettings/EditSettings.vue +90 -32
- package/components/common/vm/actions/editSettings/EditSettingsOld.vue +41 -14
- package/components/common/vm/actions/editSettings/new/New.vue +41 -14
- package/components/common/vm/actions/lib/models/interfaces.ts +29 -4
- package/components/common/vm/actions/lib/utils.ts +36 -64
- package/package.json +1 -1
- /package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/{New.vue → PasswordNew.vue} +0 -0
- /package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/{Old.vue → PasswordOld.vue} +0 -0
package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<common-vm-actions-common-customize-hardware-virtual-hardware-new
|
|
3
3
|
v-if="isNewView"
|
|
4
|
-
v-model="model"
|
|
5
4
|
v-model:cpu-invalid="cpuInvalid"
|
|
6
5
|
v-model:memory-invalid="memoryInvalid"
|
|
7
6
|
v-model:video-card-invalid="videoCardInvalid"
|
|
@@ -10,6 +9,7 @@
|
|
|
10
9
|
:is-edit="props.isEdit"
|
|
11
10
|
:storage="props.storage"
|
|
12
11
|
: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,16 +27,21 @@
|
|
|
27
27
|
:cd-dvd-drives-index="cdDvdDrivesIndex"
|
|
28
28
|
:error-validation-fields="errorValidationFields"
|
|
29
29
|
:get-datastore-table-func="getDatastoreTableFunc"
|
|
30
|
+
:cpu="cpu"
|
|
30
31
|
:state="state"
|
|
32
|
+
:memory="memory"
|
|
33
|
+
:networks="networksLocal"
|
|
34
|
+
:hard-disks="hardDisksLocal"
|
|
31
35
|
:video-card="videoCard"
|
|
32
36
|
:pci-devices="pciDevicesLocal"
|
|
37
|
+
:cd-dvd-drives="cdDvdDrivesLocal"
|
|
38
|
+
:usb-controller="usbController"
|
|
33
39
|
:guest-machine-type="guestMachineType"
|
|
34
40
|
:passthrough-devices="passthroughDevices"
|
|
35
41
|
:mediated-devices="mediatedDevices"
|
|
36
42
|
:vm-cpu-help-text-second="vmCpuHelpTextSecond"
|
|
37
43
|
:compute-resource="props.computeResource"
|
|
38
44
|
:compatibility-info="props.compatibilityInfo"
|
|
39
|
-
:network-value-prop="networkValueProp"
|
|
40
45
|
@add-device="onAddDevice"
|
|
41
46
|
@get-storage="emits('get-storage', $event)"
|
|
42
47
|
@remove-network="onRemoveNetwork"
|
|
@@ -50,18 +55,22 @@
|
|
|
50
55
|
@remove-cd-dvd-drive="onRemoveCdDvdDrive(...$event)"
|
|
51
56
|
@show-datastore-child="emits('show-datastore-child', $event)"
|
|
52
57
|
@get-folders-or-files="emits('get-folders-or-files', $event)"
|
|
58
|
+
@send-data-cpu-method="onSendDataCpuMethod"
|
|
53
59
|
@set-invalid-hard-disk="onSetInvalidHardDisk(...$event)"
|
|
54
60
|
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
55
61
|
@roll-back-cd-dvd-drive="onRollBackCdDvdDrive"
|
|
56
62
|
@set-invalid-pci-device="onSetInvalidPciDevice(...$event)"
|
|
57
63
|
@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)"
|
|
58
67
|
@send-data-pci-devices-method="onSendDataPciDevicesMethod(...$event)"
|
|
59
68
|
@send-data-new-hard-disk-method="onSendDataNewHardDiskMethod(...$event)"
|
|
60
69
|
@send-data-new-cd-dvd-drive-method="sendDataNewCdDvdDriveMethod(...$event)"
|
|
70
|
+
@send-data-new-usb-controller-method="onSendDataNewUsbControllerMethod"
|
|
61
71
|
/>
|
|
62
72
|
<common-vm-actions-common-customize-hardware-virtual-hardware-old
|
|
63
73
|
v-else
|
|
64
|
-
v-model="model"
|
|
65
74
|
v-model:cpu-invalid="cpuInvalid"
|
|
66
75
|
v-model:memory-invalid="memoryInvalid"
|
|
67
76
|
v-model:video-card-invalid="videoCardInvalid"
|
|
@@ -70,6 +79,7 @@
|
|
|
70
79
|
:is-edit="props.isEdit"
|
|
71
80
|
:storage="props.storage"
|
|
72
81
|
:project="props.project"
|
|
82
|
+
:max-cpus="props.maxCpus"
|
|
73
83
|
:max-memory="props.maxMemory"
|
|
74
84
|
:cpu-models="props.cpuModels"
|
|
75
85
|
:datastore="props.datastore"
|
|
@@ -87,15 +97,20 @@
|
|
|
87
97
|
:cd-dvd-drives-index="cdDvdDrivesIndex"
|
|
88
98
|
:error-validation-fields="errorValidationFields"
|
|
89
99
|
:get-datastore-table-func="getDatastoreTableFunc"
|
|
100
|
+
:cpu="cpu"
|
|
90
101
|
:state="state"
|
|
102
|
+
:memory="memory"
|
|
103
|
+
:networks="networksLocal"
|
|
104
|
+
:hard-disks="hardDisksLocal"
|
|
91
105
|
:video-card="videoCard"
|
|
92
106
|
:pci-devices="pciDevicesLocal"
|
|
107
|
+
:cd-dvd-drives="cdDvdDrivesLocal"
|
|
108
|
+
:usb-controller="usbController"
|
|
93
109
|
:guest-machine-type="guestMachineType"
|
|
94
110
|
:passthrough-devices="passthroughDevices"
|
|
95
111
|
:mediated-devices="mediatedDevices"
|
|
96
112
|
:vm-cpu-help-text-second="vmCpuHelpTextSecond"
|
|
97
113
|
:compute-resource="props.computeResource"
|
|
98
|
-
:network-value-prop="networkValueProp"
|
|
99
114
|
@add-device="onAddDevice"
|
|
100
115
|
@get-storage="emits('get-storage', $event)"
|
|
101
116
|
@remove-network="onRemoveNetwork"
|
|
@@ -109,14 +124,19 @@
|
|
|
109
124
|
@remove-cd-dvd-drive="onRemoveCdDvdDrive(...$event)"
|
|
110
125
|
@show-datastore-child="emits('show-datastore-child', $event)"
|
|
111
126
|
@get-folders-or-files="emits('get-folders-or-files', $event)"
|
|
127
|
+
@send-data-cpu-method="onSendDataCpuMethod"
|
|
112
128
|
@set-invalid-hard-disk="onSetInvalidHardDisk(...$event)"
|
|
113
129
|
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
114
130
|
@roll-back-cd-dvd-drive="onRollBackCdDvdDrive"
|
|
115
131
|
@set-invalid-pci-device="onSetInvalidPciDevice(...$event)"
|
|
116
132
|
@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)"
|
|
117
136
|
@send-data-pci-devices-method="onSendDataPciDevicesMethod(...$event)"
|
|
118
137
|
@send-data-new-hard-disk-method="onSendDataNewHardDiskMethod(...$event)"
|
|
119
138
|
@send-data-new-cd-dvd-drive-method="sendDataNewCdDvdDriveMethod(...$event)"
|
|
139
|
+
@send-data-new-usb-controller-method="onSendDataNewUsbControllerMethod"
|
|
120
140
|
/>
|
|
121
141
|
</template>
|
|
122
142
|
|
|
@@ -128,9 +148,13 @@ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
|
|
|
128
148
|
import type { UI_I_FolderOrFileTreePayload } from '~/lib/models/store/storage/interfaces'
|
|
129
149
|
import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
|
|
130
150
|
import type {
|
|
151
|
+
UI_I_SendDataCpu,
|
|
152
|
+
UI_I_SendDataMemory,
|
|
131
153
|
UI_I_SendDataNewHardDisk,
|
|
154
|
+
UI_I_SendDataNewNetwork,
|
|
132
155
|
UI_I_SendDataVideoCard,
|
|
133
156
|
UI_I_InvalidKeys,
|
|
157
|
+
UI_I_SendDataVirtualHardware,
|
|
134
158
|
UI_I_SendDataNewCdDvdDrive,
|
|
135
159
|
// UI_I_HardDisk,
|
|
136
160
|
UI_I_SendDataNewPciDevice,
|
|
@@ -148,23 +172,23 @@ import type {
|
|
|
148
172
|
} from '~/components/atoms/dropdown/tree/lib/models/interfaces'
|
|
149
173
|
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
150
174
|
import type {
|
|
175
|
+
API_UI_I_VmEditCpu,
|
|
176
|
+
API_UI_I_VmEditMemory,
|
|
151
177
|
UI_I_MediatedDevice,
|
|
152
178
|
UI_I_PciDevice,
|
|
153
179
|
} from '~/lib/models/store/vm/interfaces'
|
|
154
180
|
import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
|
|
155
|
-
import type { UI_I_CreateVmData } from '~/components/common/vm/actions/common/lib/models/interfaces'
|
|
156
181
|
import { dropdownItemsFunc } from './lib/config/dropdownItems'
|
|
157
182
|
|
|
158
|
-
const model = defineModel<UI_I_CreateVmData>({ required: true })
|
|
159
|
-
|
|
160
183
|
const props = withDefaults(
|
|
161
184
|
defineProps<{
|
|
162
185
|
storage: UI_I_DatastoreTableItem | null
|
|
163
186
|
cpuModels: UI_I_OptionItem[]
|
|
187
|
+
maxCpus: number
|
|
164
188
|
maxMemory: number
|
|
165
189
|
isEdit: boolean
|
|
166
190
|
isClone: boolean
|
|
167
|
-
errorValidationFields: UI_I_ErrorValidationField[]
|
|
191
|
+
errorValidationFields: UI_I_ErrorValidationField<string>[]
|
|
168
192
|
nodes: UI_I_FileTreeNode[]
|
|
169
193
|
files: UI_I_FileTreeNode[]
|
|
170
194
|
networksTable: UI_I_NetworkTableItem[]
|
|
@@ -173,10 +197,14 @@ const props = withDefaults(
|
|
|
173
197
|
isDatastoreLoading: boolean
|
|
174
198
|
project: UI_T_Project
|
|
175
199
|
state?: string | number
|
|
200
|
+
cpu?: API_UI_I_VmEditCpu
|
|
201
|
+
memory?: API_UI_I_VmEditMemory
|
|
176
202
|
vmCpuHelpTextSecond?: string
|
|
177
203
|
hardDisks?: UI_I_SendDataNewHardDisk[] | null
|
|
178
204
|
cdDvdDrives?: UI_I_SendDataNewCdDvdDrive[] | null
|
|
205
|
+
networks?: UI_I_SendDataNewNetwork[] | null
|
|
179
206
|
videoCard?: UI_I_SendDataVideoCard
|
|
207
|
+
usbController?: string
|
|
180
208
|
pciDevices?: UI_I_SendDataNewPciDevice[]
|
|
181
209
|
passthroughDevices?: UI_I_PciDevice[]
|
|
182
210
|
mediatedDevices?: UI_I_MediatedDevice[]
|
|
@@ -186,10 +214,14 @@ const props = withDefaults(
|
|
|
186
214
|
}>(),
|
|
187
215
|
{
|
|
188
216
|
state: undefined,
|
|
217
|
+
cpu: undefined,
|
|
218
|
+
memory: undefined,
|
|
189
219
|
vmCpuHelpTextSecond: undefined,
|
|
190
220
|
hardDisks: undefined,
|
|
191
221
|
cdDvdDrives: undefined,
|
|
222
|
+
networks: undefined,
|
|
192
223
|
videoCard: undefined,
|
|
224
|
+
usbController: undefined,
|
|
193
225
|
pciDevices: undefined,
|
|
194
226
|
passthroughDevices: undefined,
|
|
195
227
|
mediatedDevices: undefined,
|
|
@@ -199,6 +231,7 @@ const props = withDefaults(
|
|
|
199
231
|
}
|
|
200
232
|
)
|
|
201
233
|
const emits = defineEmits<{
|
|
234
|
+
(event: 'send-data', value: UI_I_SendDataVirtualHardware): void
|
|
202
235
|
(event: 'invalid', value: string[]): void
|
|
203
236
|
(event: 'get-storage', value: UI_I_TablePayload): void
|
|
204
237
|
(event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
|
|
@@ -225,57 +258,38 @@ const dropdownItems = computed<UI_I_DropdownTreeItem[]>(() =>
|
|
|
225
258
|
|
|
226
259
|
const hardDisksIndex = ref<number[]>([0])
|
|
227
260
|
const hardDisksType = ref<UI_T_HardDiskType[]>(['new'])
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
model.value.disk_devices
|
|
241
|
-
.filter((disk) => disk.device_type !== 'cdrom')
|
|
242
|
-
.forEach((_disk, _index, array) => {
|
|
243
|
-
if (!props.isEdit && !props.isClone) return
|
|
244
|
-
|
|
245
|
-
const count = array.length
|
|
246
|
-
hardDisksIndex.value = [...Array(count).keys()]
|
|
247
|
-
if (props.isEdit) {
|
|
248
|
-
hardDisksType.value = Array(count).fill('edit')
|
|
249
|
-
} else if (props.isClone) {
|
|
250
|
-
hardDisksType.value = Array(count).fill('clone')
|
|
251
|
-
}
|
|
252
|
-
})
|
|
253
|
-
}
|
|
261
|
+
const hardDisksLocal = ref<UI_I_SendDataNewHardDisk[]>([
|
|
262
|
+
{
|
|
263
|
+
create: true,
|
|
264
|
+
size: 90,
|
|
265
|
+
source: '',
|
|
266
|
+
boot_order: -1,
|
|
267
|
+
},
|
|
268
|
+
])
|
|
269
|
+
watch(
|
|
270
|
+
() => props.hardDisks,
|
|
271
|
+
(newValue) => {
|
|
272
|
+
if ((!props.isEdit && !props.isClone) || !newValue) return
|
|
254
273
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
// })
|
|
271
|
-
// }
|
|
272
|
-
// },
|
|
273
|
-
// { immediate: true }
|
|
274
|
-
// )
|
|
274
|
+
const count = newValue?.length || 0
|
|
275
|
+
hardDisksIndex.value = [...Array(count).keys()]
|
|
276
|
+
hardDisksLocal.value = newValue
|
|
277
|
+
if (props.isEdit) {
|
|
278
|
+
hardDisksType.value = Array(count).fill('edit')
|
|
279
|
+
} else if (props.isClone) {
|
|
280
|
+
hardDisksType.value = Array(count).fill('clone')
|
|
281
|
+
hardDisksLocal.value = newValue.map((hardDisk) => {
|
|
282
|
+
hardDisk.create = true
|
|
283
|
+
return hardDisk
|
|
284
|
+
})
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
{ immediate: true }
|
|
288
|
+
)
|
|
275
289
|
|
|
276
290
|
const addHardDisk = (
|
|
277
291
|
create = true,
|
|
278
|
-
size =
|
|
292
|
+
size = 90,
|
|
279
293
|
source = '',
|
|
280
294
|
type: UI_T_HardDiskType = 'new',
|
|
281
295
|
provisioned_type?: number // При добавлении существующей
|
|
@@ -287,43 +301,15 @@ const addHardDisk = (
|
|
|
287
301
|
let provisionType = 'thick'
|
|
288
302
|
if (provisioned_type === 1) provisionType = 'thin'
|
|
289
303
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
//
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
// },
|
|
300
|
-
{
|
|
301
|
-
create,
|
|
302
|
-
size,
|
|
303
|
-
source,
|
|
304
|
-
bus: 'virtio',
|
|
305
|
-
storage_id: '',
|
|
306
|
-
provision_type: 'thick',
|
|
307
|
-
disk_mode: 'dependent',
|
|
308
|
-
boot_order: 0, // Убираем галочку
|
|
309
|
-
device_type: 'disk',
|
|
310
|
-
sharing: false,
|
|
311
|
-
shares: 0,
|
|
312
|
-
cache: 'none',
|
|
313
|
-
io: '',
|
|
314
|
-
limit_iops: 0,
|
|
315
|
-
attach: true,
|
|
316
|
-
},
|
|
317
|
-
...model.value.disk_devices.filter((disk) => disk.device_type === 'cdrom'),
|
|
318
|
-
]
|
|
319
|
-
// hardDisksLocal.value.push({
|
|
320
|
-
// create,
|
|
321
|
-
// size,
|
|
322
|
-
// source,
|
|
323
|
-
// attach: true,
|
|
324
|
-
// boot_order: 0, // Убираем галочку
|
|
325
|
-
// provision_type: provisionType,
|
|
326
|
-
// })
|
|
304
|
+
hardDisksLocal.value.push({
|
|
305
|
+
create,
|
|
306
|
+
size,
|
|
307
|
+
source,
|
|
308
|
+
attach: true,
|
|
309
|
+
boot_order: 0, // Убираем галочку
|
|
310
|
+
provision_type: provisionType,
|
|
311
|
+
})
|
|
312
|
+
sendData()
|
|
327
313
|
}
|
|
328
314
|
const onAddExistHardDisk = (file: UI_I_FileTreeNode): void => {
|
|
329
315
|
addHardDisk(
|
|
@@ -345,6 +331,7 @@ const onRemoveHardDisk = (
|
|
|
345
331
|
if (key === removeIndex) return 'removed'
|
|
346
332
|
return item
|
|
347
333
|
})
|
|
334
|
+
sendData()
|
|
348
335
|
return
|
|
349
336
|
}
|
|
350
337
|
|
|
@@ -353,18 +340,15 @@ const onRemoveHardDisk = (
|
|
|
353
340
|
(_item, key) => key !== removeIndex
|
|
354
341
|
)
|
|
355
342
|
|
|
356
|
-
|
|
343
|
+
hardDisksLocal.value = hardDisksLocal.value.filter(
|
|
357
344
|
(_hardDisk, key: number) => {
|
|
358
345
|
return removeIndex !== key
|
|
359
346
|
}
|
|
360
347
|
)
|
|
361
|
-
// hardDisksLocal.value = hardDisksLocal.value.filter(
|
|
362
|
-
// (_hardDisk, key: number) => {
|
|
363
|
-
// return removeIndex !== key
|
|
364
|
-
// }
|
|
365
|
-
// )
|
|
366
348
|
|
|
367
349
|
delete newHardDiskInvalidKeys.value[index]
|
|
350
|
+
delete sendDataNewHardDisk.value[index]
|
|
351
|
+
sendData()
|
|
368
352
|
}
|
|
369
353
|
const onRollBackHardDisk = (index: number): void => {
|
|
370
354
|
const removeIndex = hardDisksIndex.value.indexOf(index)
|
|
@@ -374,41 +358,51 @@ const onRollBackHardDisk = (index: number): void => {
|
|
|
374
358
|
})
|
|
375
359
|
}
|
|
376
360
|
|
|
377
|
-
const
|
|
361
|
+
const defaultNetwork = {
|
|
362
|
+
network: '',
|
|
363
|
+
net_bridge: '',
|
|
364
|
+
mac: '',
|
|
365
|
+
target: '',
|
|
366
|
+
model: '',
|
|
367
|
+
boot_order: -1,
|
|
368
|
+
}
|
|
369
|
+
const networksLocal = ref<UI_I_SendDataNewNetwork[]>([
|
|
370
|
+
useDeepCopy(defaultNetwork),
|
|
371
|
+
])
|
|
378
372
|
const networksType = ref<UI_T_NetworkType[]>(['new'])
|
|
379
373
|
const networksIndex = ref<number[]>([0])
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
} else {
|
|
384
|
-
model.value.network_devices.forEach(() => {
|
|
374
|
+
watch(
|
|
375
|
+
() => props.networks,
|
|
376
|
+
(newValue) => {
|
|
385
377
|
if (!props.isEdit && !props.isClone) return
|
|
378
|
+
if (!newValue) {
|
|
379
|
+
networksLocal.value = []
|
|
380
|
+
networksType.value = []
|
|
381
|
+
networksIndex.value = []
|
|
382
|
+
return
|
|
383
|
+
}
|
|
386
384
|
|
|
387
|
-
|
|
385
|
+
// networksLocal.value = newValue
|
|
386
|
+
// networksType.value = Array(newValue.length).fill('edit')
|
|
387
|
+
const count = newValue?.length || 0
|
|
388
388
|
networksIndex.value = [...Array(count).keys()]
|
|
389
|
+
networksLocal.value = newValue
|
|
389
390
|
if (props.isEdit) {
|
|
390
391
|
networksType.value = Array(count).fill('edit')
|
|
391
392
|
} else if (props.isClone) {
|
|
392
393
|
networksType.value = Array(count).fill('clone')
|
|
393
394
|
}
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
const defaultNetwork = {
|
|
398
|
-
network: '',
|
|
399
|
-
net_bridge: '',
|
|
400
|
-
mac: '',
|
|
401
|
-
target: '',
|
|
402
|
-
model: 'virtio',
|
|
403
|
-
boot_order: 0,
|
|
404
|
-
}
|
|
395
|
+
},
|
|
396
|
+
{ immediate: true }
|
|
397
|
+
)
|
|
405
398
|
const addNetwork = (): void => {
|
|
406
399
|
const index = (networksIndex.value.at(-1) ?? -1) + 1
|
|
407
400
|
networksIndex.value.push(index)
|
|
408
401
|
networksType.value.push('new')
|
|
409
402
|
|
|
410
|
-
|
|
403
|
+
networksLocal.value.push({
|
|
411
404
|
...useDeepCopy(defaultNetwork),
|
|
405
|
+
boot_order: 0, // Убираем галочку
|
|
412
406
|
})
|
|
413
407
|
}
|
|
414
408
|
const onRemoveNetwork = (index: number): void => {
|
|
@@ -417,97 +411,55 @@ const onRemoveNetwork = (index: number): void => {
|
|
|
417
411
|
networksType.value = networksType.value.filter(
|
|
418
412
|
(_item, key) => key !== removeIndex
|
|
419
413
|
)
|
|
420
|
-
|
|
414
|
+
networksLocal.value = networksLocal.value.filter(
|
|
421
415
|
(_network, key: number) => removeIndex !== key
|
|
422
416
|
)
|
|
423
417
|
|
|
424
418
|
delete newNetworkInvalidKeys.value[index]
|
|
419
|
+
delete sendDataNewNetwork.value[index]
|
|
420
|
+
sendData()
|
|
425
421
|
}
|
|
426
422
|
|
|
427
|
-
// const defaultCdDvdDriver: UI_I_SendDataNewCdDvdDrive = {
|
|
428
|
-
// create: false,
|
|
429
|
-
// attach: false,
|
|
430
|
-
// source: '',
|
|
431
|
-
// bus: '',
|
|
432
|
-
// device_type: 'cdrom',
|
|
433
|
-
// boot_order: -1,
|
|
434
|
-
// }
|
|
435
423
|
const defaultCdDvdDriver: UI_I_SendDataNewCdDvdDrive = {
|
|
424
|
+
create: false,
|
|
425
|
+
attach: false,
|
|
436
426
|
source: '',
|
|
437
|
-
storage_id: '',
|
|
438
|
-
device_type: 'cdrom',
|
|
439
427
|
bus: '',
|
|
440
|
-
|
|
441
|
-
boot_order:
|
|
442
|
-
provision_type: 'thick',
|
|
443
|
-
disk_mode: 'dependent',
|
|
444
|
-
sharing: false,
|
|
445
|
-
read_only: true,
|
|
446
|
-
shares: 0,
|
|
447
|
-
cache: 'none',
|
|
448
|
-
io: 'native',
|
|
449
|
-
limit_iops: 0,
|
|
450
|
-
discard: 'unmap',
|
|
451
|
-
attach: false,
|
|
452
|
-
detach: false,
|
|
453
|
-
remove: false,
|
|
454
|
-
create: false,
|
|
428
|
+
device_type: 'cdrom',
|
|
429
|
+
boot_order: -1,
|
|
455
430
|
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
431
|
+
const cdDvdDrivesLocal = ref<UI_I_SendDataNewCdDvdDrive[]>([
|
|
432
|
+
useDeepCopy(defaultCdDvdDriver),
|
|
433
|
+
])
|
|
459
434
|
const cdDvdDrivesIndex = ref<number[]>([0])
|
|
460
435
|
const cdDvdDrivesType = ref<UI_T_CdDvdType[]>(['new'])
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
.
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
// watch(
|
|
480
|
-
// () => props.cdDvdDrives,
|
|
481
|
-
// (newValue) => {
|
|
482
|
-
// if ((!props.isEdit && !props.isClone) || !newValue) return
|
|
483
|
-
//
|
|
484
|
-
// // cdDvdDrivesLocal.value = newValue
|
|
485
|
-
// // cdDvdDrivesType.value = Array(newValue.length).fill('edit')
|
|
486
|
-
// const count = newValue?.length || 0
|
|
487
|
-
// cdDvdDrivesIndex.value = [...Array(count).keys()]
|
|
488
|
-
// cdDvdDrivesLocal.value = newValue
|
|
489
|
-
// if (props.isEdit) {
|
|
490
|
-
// cdDvdDrivesType.value = Array(count).fill('edit')
|
|
491
|
-
// } else if (props.isClone) {
|
|
492
|
-
// cdDvdDrivesType.value = Array(count).fill('new')
|
|
493
|
-
// }
|
|
494
|
-
// },
|
|
495
|
-
// { immediate: true }
|
|
496
|
-
// )
|
|
436
|
+
watch(
|
|
437
|
+
() => props.cdDvdDrives,
|
|
438
|
+
(newValue) => {
|
|
439
|
+
if ((!props.isEdit && !props.isClone) || !newValue) return
|
|
440
|
+
|
|
441
|
+
// cdDvdDrivesLocal.value = newValue
|
|
442
|
+
// cdDvdDrivesType.value = Array(newValue.length).fill('edit')
|
|
443
|
+
const count = newValue?.length || 0
|
|
444
|
+
cdDvdDrivesIndex.value = [...Array(count).keys()]
|
|
445
|
+
cdDvdDrivesLocal.value = newValue
|
|
446
|
+
if (props.isEdit) {
|
|
447
|
+
cdDvdDrivesType.value = Array(count).fill('edit')
|
|
448
|
+
} else if (props.isClone) {
|
|
449
|
+
cdDvdDrivesType.value = Array(count).fill('new')
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
{ immediate: true }
|
|
453
|
+
)
|
|
497
454
|
const addCdDvdDrive = (): void => {
|
|
498
455
|
const value = (cdDvdDrivesIndex.value.at(-1) ?? -1) + 1
|
|
499
456
|
cdDvdDrivesIndex.value.push(value)
|
|
500
457
|
cdDvdDrivesType.value.push('new')
|
|
501
|
-
|
|
458
|
+
cdDvdDrivesLocal.value.push({
|
|
502
459
|
...useDeepCopy(defaultCdDvdDriver),
|
|
503
460
|
attach: true,
|
|
504
461
|
boot_order: 0, // Убираем галочку
|
|
505
462
|
})
|
|
506
|
-
// cdDvdDrivesLocal.value.push({
|
|
507
|
-
// ...useDeepCopy(defaultCdDvdDriver),
|
|
508
|
-
// attach: true,
|
|
509
|
-
// boot_order: 0, // Убираем галочку
|
|
510
|
-
// })
|
|
511
463
|
}
|
|
512
464
|
const onRemoveCdDvdDrive = (
|
|
513
465
|
index: number,
|
|
@@ -521,6 +473,7 @@ const onRemoveCdDvdDrive = (
|
|
|
521
473
|
if (key === removeIndex) return 'removed'
|
|
522
474
|
return item
|
|
523
475
|
})
|
|
476
|
+
sendData()
|
|
524
477
|
return
|
|
525
478
|
}
|
|
526
479
|
|
|
@@ -530,12 +483,12 @@ const onRemoveCdDvdDrive = (
|
|
|
530
483
|
cdDvdDrivesType.value = cdDvdDrivesType.value.filter(
|
|
531
484
|
(_item, key) => key !== index
|
|
532
485
|
)
|
|
533
|
-
|
|
486
|
+
cdDvdDrivesLocal.value = cdDvdDrivesLocal.value.filter(
|
|
534
487
|
(_cdDvdDrive, key: number) => removeIndex !== key
|
|
535
488
|
)
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
489
|
+
|
|
490
|
+
delete sendDataNewCdDvdDrive.value[index]
|
|
491
|
+
sendData()
|
|
539
492
|
}
|
|
540
493
|
const onRollBackCdDvdDrive = (index: number): void => {
|
|
541
494
|
const removeIndex = cdDvdDrivesIndex.value.indexOf(index)
|
|
@@ -577,7 +530,6 @@ const addPciDevice = (): void => {
|
|
|
577
530
|
pciDevicesType.value.push('new')
|
|
578
531
|
|
|
579
532
|
pciDevicesLocal.value.push(useDeepCopy(defaultPciDevice))
|
|
580
|
-
model.value.passthrough_pci_devices.push(useDeepCopy(defaultPciDevice))
|
|
581
533
|
}
|
|
582
534
|
const onRemovePciDevice = (index: number): void => {
|
|
583
535
|
const removeIndex = pciDevicesIndex.value.indexOf(index)
|
|
@@ -586,10 +538,6 @@ const onRemovePciDevice = (index: number): void => {
|
|
|
586
538
|
(_item, key) => key !== removeIndex
|
|
587
539
|
)
|
|
588
540
|
|
|
589
|
-
model.value.passthrough_pci_devices =
|
|
590
|
-
model.value.passthrough_pci_devices.filter((_pciDevice, key: number) => {
|
|
591
|
-
return removeIndex !== key
|
|
592
|
-
})
|
|
593
541
|
pciDevicesLocal.value = pciDevicesLocal.value.filter(
|
|
594
542
|
(_pciDevice, key: number) => {
|
|
595
543
|
return removeIndex !== key
|
|
@@ -597,6 +545,8 @@ const onRemovePciDevice = (index: number): void => {
|
|
|
597
545
|
)
|
|
598
546
|
|
|
599
547
|
delete newPciDeviceInvalidKeys.value[index]
|
|
548
|
+
delete sendDataNewPciDevices.value[index]
|
|
549
|
+
sendData()
|
|
600
550
|
}
|
|
601
551
|
|
|
602
552
|
const isShowFileModal = ref<boolean>(false)
|
|
@@ -621,35 +571,80 @@ const onAddDevice = (item: UI_I_DropdownTreeItemChild): void => {
|
|
|
621
571
|
}
|
|
622
572
|
|
|
623
573
|
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[]>([])
|
|
624
585
|
const onSendDataNewHardDiskMethod = (
|
|
625
586
|
data: UI_I_SendDataNewHardDisk,
|
|
626
587
|
index: number
|
|
627
588
|
): void => {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
boot_order: model.value.disk_devices[index]?.boot_order || 0,
|
|
631
|
-
}
|
|
589
|
+
sendDataNewHardDisk.value[index] = data
|
|
590
|
+
sendData()
|
|
632
591
|
}
|
|
592
|
+
const sendDataNewNetwork = ref<UI_I_SendDataNewNetwork[]>([])
|
|
593
|
+
const sendDataNewNetworkMethod = (
|
|
594
|
+
data: UI_I_SendDataNewNetwork,
|
|
595
|
+
index: number
|
|
596
|
+
): void => {
|
|
597
|
+
sendDataNewNetwork.value[index] = data
|
|
598
|
+
sendData()
|
|
599
|
+
}
|
|
600
|
+
const sendDataNewCdDvdDrive = ref<UI_I_SendDataNewCdDvdDrive[]>([])
|
|
633
601
|
const sendDataNewCdDvdDriveMethod = (
|
|
634
602
|
data: UI_I_SendDataNewCdDvdDrive,
|
|
635
603
|
index: number
|
|
636
604
|
): void => {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
)
|
|
640
|
-
model.value.disk_devices[cdromIndexStart + index] = {
|
|
641
|
-
...data,
|
|
642
|
-
boot_order:
|
|
643
|
-
model.value.disk_devices[cdromIndexStart + index]?.boot_order || 0,
|
|
644
|
-
}
|
|
605
|
+
sendDataNewCdDvdDrive.value[index] = data
|
|
606
|
+
sendData()
|
|
645
607
|
}
|
|
608
|
+
const sendDataNewUsbController = ref<string | null>(null)
|
|
609
|
+
const onSendDataNewUsbControllerMethod = (data: string): void => {
|
|
610
|
+
sendDataNewUsbController.value = data
|
|
611
|
+
sendData()
|
|
612
|
+
}
|
|
613
|
+
const sendDataNewPciDevices = ref<UI_I_SendDataNewPciDevice[]>([])
|
|
646
614
|
const onSendDataPciDevicesMethod = (
|
|
647
615
|
data: UI_I_SendDataNewPciDevice,
|
|
648
616
|
index: number
|
|
649
617
|
): void => {
|
|
650
|
-
|
|
651
|
-
|
|
618
|
+
sendDataNewPciDevices.value[index] = data
|
|
619
|
+
sendData()
|
|
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,
|
|
652
646
|
}
|
|
647
|
+
emits('send-data', sendData)
|
|
653
648
|
}
|
|
654
649
|
|
|
655
650
|
const onSetInvalidHardDisk = (invalid: boolean, index: number): void => {
|