bfg-common 1.4.365 → 1.4.367
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/img/icons/icons-sprite-dark-1.svg +407 -407
- package/assets/img/icons/icons-sprite-dark-2.svg +343 -343
- package/assets/img/icons/icons-sprite-dark-3.svg +227 -227
- package/assets/img/icons/icons-sprite-dark-4.svg +255 -255
- package/assets/img/icons/icons-sprite-dark-5.svg +488 -488
- package/assets/img/icons/icons-sprite-dark-6.svg +94 -94
- package/assets/img/icons/icons-sprite-light-1.svg +407 -407
- package/assets/img/icons/icons-sprite-light-2.svg +343 -343
- package/assets/img/icons/icons-sprite-light-3.svg +227 -227
- package/assets/img/icons/icons-sprite-light-4.svg +255 -255
- package/assets/img/icons/icons-sprite-light-5.svg +488 -488
- package/assets/img/icons/icons-sprite-light-6.svg +94 -94
- package/assets/localization/local_en.json +1 -1
- package/components/atoms/TheIcon3.vue +50 -50
- package/components/atoms/modal/bySteps/BySteps.vue +253 -253
- package/components/atoms/stack/StackBlock.vue +185 -185
- package/components/common/context/lib/models/interfaces.ts +30 -30
- package/components/common/context/recursion/Recursion.vue +86 -86
- package/components/common/context/recursion/RecursionNew.vue +199 -199
- package/components/common/context/recursion/RecursionOld.vue +213 -213
- package/components/common/modals/confirmation/Confirmation.vue +65 -65
- package/components/common/vm/actions/add/Add.vue +617 -617
- package/components/common/vm/actions/clone/lib/config/steps.ts +129 -129
- package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +2 -2
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/bus/lib/config/options.ts +20 -20
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Cpu.vue +403 -403
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Hv.vue +99 -99
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/{location/Location.vue → Location.vue} +173 -172
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +2 -2
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +201 -201
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/streamingMode/StreamingMode.vue +85 -85
- package/components/common/vm/actions/common/select/storage/Storage.vue +198 -202
- package/components/common/vm/actions/editSettings/EditSettings.vue +1 -1
- package/composables/productNameLocal.ts +30 -30
- package/package.json +1 -1
- package/plugins/date.ts +181 -181
- package/plugins/recursion.ts +311 -311
- package/public/spice-console/lib/images/bitmap.js +203 -203
- package/public/spice-console/network/spicechannel.js +383 -383
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/StorageModalOld.vue +0 -52
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/storageModalNew/StorageModalNew.vue +0 -175
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/storageModalNew/lib/config/table.ts +0 -167
|
@@ -1,403 +1,403 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="hardware-cpu">
|
|
3
|
-
<atoms-stack-block :has-children="true" test-id="cpu-stack-block">
|
|
4
|
-
<template #stackBlockKey>
|
|
5
|
-
<div
|
|
6
|
-
id="vm-wizard-toggle-block-cpu"
|
|
7
|
-
data-id="vm-wizard-toggle-block-cpu"
|
|
8
|
-
class="flex-align-center"
|
|
9
|
-
>
|
|
10
|
-
<span>{{ localization.common.cpu }}</span>
|
|
11
|
-
<atoms-the-icon
|
|
12
|
-
v-show="cpuInvalid"
|
|
13
|
-
width="24px"
|
|
14
|
-
height="24px"
|
|
15
|
-
class="is-error tooltip-trigger"
|
|
16
|
-
name="info"
|
|
17
|
-
/>
|
|
18
|
-
</div>
|
|
19
|
-
</template>
|
|
20
|
-
<template #stackBlockContent>
|
|
21
|
-
<div class="flex-align-center flex-space-between">
|
|
22
|
-
<div class="flex-align-center">
|
|
23
|
-
<atoms-tooltip-error
|
|
24
|
-
:has-error="!!vcpusLocalAndApiErrorsTexts"
|
|
25
|
-
selector="#vm-wizard-vcpus-field input"
|
|
26
|
-
@remove="onRemoveValidationError"
|
|
27
|
-
>
|
|
28
|
-
<template #elem>
|
|
29
|
-
<atoms-combobox
|
|
30
|
-
id="vm-wizard-vcpus-field"
|
|
31
|
-
class="input-text-color"
|
|
32
|
-
v-model.number="selectedCpu"
|
|
33
|
-
:items="cpuOptions"
|
|
34
|
-
:disabled="isCpuDisabled"
|
|
35
|
-
test-id="vm-wizard-cpu-combobox"
|
|
36
|
-
@click.stop
|
|
37
|
-
/>
|
|
38
|
-
</template>
|
|
39
|
-
<template #content>{{ vcpusLocalAndApiErrorsTexts }}</template>
|
|
40
|
-
</atoms-tooltip-error>
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
<common-vm-actions-common-customize-hardware-virtual-hardware-cpu-tooltip
|
|
44
|
-
:vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
|
|
45
|
-
/>
|
|
46
|
-
</div>
|
|
47
|
-
</template>
|
|
48
|
-
<template #stackChildren>
|
|
49
|
-
<common-vm-actions-common-customize-hardware-virtual-hardware-cpu-cores-per-socket
|
|
50
|
-
v-model:selected-core-per-socket="selectedCorePerSocket"
|
|
51
|
-
:selected-cpus="selectedCpus"
|
|
52
|
-
:cpu-options="cpuOptions"
|
|
53
|
-
:is-edit="props.isEdit"
|
|
54
|
-
:disabled="isDisabled"
|
|
55
|
-
:error-validation-fields="props.errorValidationFields"
|
|
56
|
-
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
57
|
-
/>
|
|
58
|
-
<common-vm-actions-common-customize-hardware-virtual-hardware-cpu-hot-plug
|
|
59
|
-
v-model:enable-cpu-hot-add="enableCpuHotAdd"
|
|
60
|
-
:disabled="enableCpuHotAddDisabled"
|
|
61
|
-
/>
|
|
62
|
-
<common-vm-actions-common-customize-hardware-virtual-hardware-cpu-max-cpu
|
|
63
|
-
v-show="enableCpuHotAdd"
|
|
64
|
-
v-model:selected-max-cpu.number="selectedMaxCpu"
|
|
65
|
-
:cpu-options="maxCpuOptions"
|
|
66
|
-
:error-validation-fields="props.errorValidationFields"
|
|
67
|
-
:disabled="isDisabled"
|
|
68
|
-
@invalid="maxCpuInvalid = $event"
|
|
69
|
-
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
70
|
-
/>
|
|
71
|
-
<common-vm-actions-common-customize-hardware-virtual-hardware-reservation
|
|
72
|
-
v-model:reservation="reservation"
|
|
73
|
-
v-model:reservation-type="reservationType"
|
|
74
|
-
:error-validation-fields="props.errorValidationFields"
|
|
75
|
-
:disabled="isDisabled"
|
|
76
|
-
type="mhz"
|
|
77
|
-
component-type="cpu"
|
|
78
|
-
@invalid="reservationInvalid = $event"
|
|
79
|
-
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
80
|
-
/>
|
|
81
|
-
<common-vm-actions-common-customize-hardware-virtual-hardware-limit
|
|
82
|
-
v-model:limit="limit"
|
|
83
|
-
v-model:limit-type="limitType"
|
|
84
|
-
:error-validation-fields="props.errorValidationFields"
|
|
85
|
-
:disabled="isDisabled"
|
|
86
|
-
type="mhz"
|
|
87
|
-
component-type="cpu"
|
|
88
|
-
@invalid="limitInvalid = $event"
|
|
89
|
-
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
90
|
-
/>
|
|
91
|
-
<common-vm-actions-common-customize-hardware-virtual-hardware-cpu-shares
|
|
92
|
-
v-model:shares="shares"
|
|
93
|
-
v-model:shares-type="sharesType"
|
|
94
|
-
:error-validation-fields="props.errorValidationFields"
|
|
95
|
-
:disabled="isDisabled"
|
|
96
|
-
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
97
|
-
@invalid="sharesInvalid = $event"
|
|
98
|
-
/>
|
|
99
|
-
<!-- <common-vm-actions-common-customize-hardware-virtual-hardware-cpu-hv-->
|
|
100
|
-
<!-- v-models:hardwareVirtualization="hardwareVirtualization"-->
|
|
101
|
-
<!-- />-->
|
|
102
|
-
<!-- <common-vm-actions-common-customize-hardware-virtual-hardware-cpu-pc-->
|
|
103
|
-
<!-- v-models:performanceCounters="performanceCounters"-->
|
|
104
|
-
<!-- />-->
|
|
105
|
-
<!-- <common-vm-actions-common-customize-hardware-virtual-hardware-cpu-sa-->
|
|
106
|
-
<!-- v-models:schedulingAffinity="schedulingAffinity"-->
|
|
107
|
-
<!-- />-->
|
|
108
|
-
<!-- <common-vm-actions-common-customize-hardware-virtual-hardware-cpu-iommu-->
|
|
109
|
-
<!-- v-models:iommu="iommu"-->
|
|
110
|
-
<!-- />-->
|
|
111
|
-
<common-vm-actions-common-customize-hardware-virtual-hardware-cpu-model
|
|
112
|
-
v-model:cpu-model="cpuModel"
|
|
113
|
-
v-model:passthrough-host-cpu="passthroughHostCpu"
|
|
114
|
-
v-model:host-model-cpu="hostModelCpu"
|
|
115
|
-
:cpu-models="props.cpuModels"
|
|
116
|
-
:is-edit="props.isEdit"
|
|
117
|
-
:error-validation-fields="props.errorValidationFields"
|
|
118
|
-
:disabled="isDisabled"
|
|
119
|
-
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
120
|
-
/>
|
|
121
|
-
</template>
|
|
122
|
-
</atoms-stack-block>
|
|
123
|
-
</div>
|
|
124
|
-
</template>
|
|
125
|
-
|
|
126
|
-
<script setup lang="ts">
|
|
127
|
-
import type { UI_I_SendDataCpu } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
|
|
128
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
129
|
-
import type { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
|
|
130
|
-
import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
|
|
131
|
-
import type { API_UI_I_VmEditCpu } from '~/lib/models/store/vm/interfaces'
|
|
132
|
-
import { cpuOptionsFunc } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/lib/config/cpuOptions'
|
|
133
|
-
|
|
134
|
-
const props = defineProps<{
|
|
135
|
-
maxCpus: number
|
|
136
|
-
cpuModels: UI_I_OptionItem[]
|
|
137
|
-
isEdit: boolean
|
|
138
|
-
errorValidationFields: UI_I_ErrorValidationField<string>[]
|
|
139
|
-
vmCpuHelpTextSecond?: string
|
|
140
|
-
state?: string | number
|
|
141
|
-
cpu?: API_UI_I_VmEditCpu
|
|
142
|
-
}>()
|
|
143
|
-
const emits = defineEmits<{
|
|
144
|
-
(event: 'send-data', value: UI_I_SendDataCpu): void
|
|
145
|
-
(event: 'invalid', value: boolean): void
|
|
146
|
-
(event: 'remove-error-by-title', value: string): void
|
|
147
|
-
}>()
|
|
148
|
-
|
|
149
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
150
|
-
|
|
151
|
-
const isDisabled = computed<boolean>(() => {
|
|
152
|
-
return props.state === 2
|
|
153
|
-
})
|
|
154
|
-
|
|
155
|
-
const cpuOptions = computed<UI_I_OptionItem[]>(() =>
|
|
156
|
-
cpuOptionsFunc(localization.value, 1, props.maxCpus)
|
|
157
|
-
)
|
|
158
|
-
|
|
159
|
-
const enableCpuHotAdd = ref<boolean>(false)
|
|
160
|
-
const enableCpuHotAddDisabled = computed<boolean>(
|
|
161
|
-
() => selectedCpu.value >= props.maxCpus || isDisabled.value
|
|
162
|
-
)
|
|
163
|
-
watch(enableCpuHotAdd, (newValue) => {
|
|
164
|
-
console.log(newValue, 333)
|
|
165
|
-
if (newValue) return
|
|
166
|
-
|
|
167
|
-
maxCpuInvalid.value = false
|
|
168
|
-
selectedMaxCpu.value = 1
|
|
169
|
-
})
|
|
170
|
-
|
|
171
|
-
const selectedCpu = ref<number>(
|
|
172
|
-
isDisabled.value && enableCpuHotAdd.value ? props.maxCpus : 2
|
|
173
|
-
)
|
|
174
|
-
const isCpuDisabled = computed<boolean>(
|
|
175
|
-
() => isDisabled.value && !enableCpuHotAdd.value
|
|
176
|
-
)
|
|
177
|
-
watch(selectedCpu, (newValue) => {
|
|
178
|
-
selectedCpu.value = Math.floor(+newValue)
|
|
179
|
-
if (!(selectedCpu.value % selectedCorePerSocket.value) || isDisabled.value)
|
|
180
|
-
return
|
|
181
|
-
selectedCorePerSocket.value = 1
|
|
182
|
-
})
|
|
183
|
-
const maxCpuOptions = computed<UI_I_OptionItem[]>(() =>
|
|
184
|
-
cpuOptionsFunc(localization.value, selectedCpu.value, props.maxCpus)
|
|
185
|
-
)
|
|
186
|
-
watch(selectedCpu, (newValue) => {
|
|
187
|
-
if (newValue >= props.maxCpus) {
|
|
188
|
-
console.log(444)
|
|
189
|
-
enableCpuHotAdd.value = false
|
|
190
|
-
}
|
|
191
|
-
// selectedMaxCpu.value =
|
|
192
|
-
// selectedMaxCpu.value <= newValue ? newValue + 1 : selectedMaxCpu.value
|
|
193
|
-
// if (selectedMaxCpu.value > props.maxCpus) selectedMaxCpu.value = props.maxCpus
|
|
194
|
-
})
|
|
195
|
-
const selectedMaxCpu = ref<number>(1)
|
|
196
|
-
watch(
|
|
197
|
-
() => props.maxCpus,
|
|
198
|
-
(newValue) => {
|
|
199
|
-
selectedMaxCpu.value = newValue
|
|
200
|
-
}
|
|
201
|
-
)
|
|
202
|
-
|
|
203
|
-
const selectedCpus = computed<number[]>(() =>
|
|
204
|
-
enableCpuHotAdd.value
|
|
205
|
-
? [selectedCpu.value, selectedMaxCpu.value]
|
|
206
|
-
: [selectedCpu.value]
|
|
207
|
-
)
|
|
208
|
-
|
|
209
|
-
const selectedCorePerSocket = ref<number>(1)
|
|
210
|
-
|
|
211
|
-
const cpuErrorLocalText = computed<string>(() => {
|
|
212
|
-
const validValue = /^\d+(\.\d+)?$/.test(selectedCpu.value + '')
|
|
213
|
-
if (!validValue) {
|
|
214
|
-
return localization.value.common.inputContainsInvalidCharacters
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
const min = cpuOptions.value[0].value
|
|
218
|
-
const max = cpuOptions.value[1].value
|
|
219
|
-
if (selectedCpu.value < min || selectedCpu.value > max) {
|
|
220
|
-
return localization.value.common.memoryMustBe
|
|
221
|
-
.replace('{0}', min)
|
|
222
|
-
.replace('{1}', max)
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
return ''
|
|
226
|
-
})
|
|
227
|
-
|
|
228
|
-
const apiVcpusError = computed<string>(() => {
|
|
229
|
-
return (
|
|
230
|
-
props.errorValidationFields?.find(
|
|
231
|
-
(message) => message.field === 'cpu.vcpus'
|
|
232
|
-
)?.error_message || ''
|
|
233
|
-
)
|
|
234
|
-
})
|
|
235
|
-
|
|
236
|
-
const vcpusLocalAndApiErrorsTexts = computed<string>(() => {
|
|
237
|
-
const localError = cpuErrorLocalText.value
|
|
238
|
-
const apiError = apiVcpusError.value
|
|
239
|
-
|
|
240
|
-
let result = ''
|
|
241
|
-
if (localError && !apiError) result = localError
|
|
242
|
-
if (!localError && apiError) result = apiError
|
|
243
|
-
if (localError && apiError) result = localError + ', ' + apiError
|
|
244
|
-
if (!localError && apiError) result = apiError
|
|
245
|
-
|
|
246
|
-
return result
|
|
247
|
-
})
|
|
248
|
-
const reservationInvalid = ref<boolean>(false)
|
|
249
|
-
const limitInvalid = ref<boolean>(false)
|
|
250
|
-
const sharesInvalid = ref<boolean>(false)
|
|
251
|
-
const maxCpuInvalid = ref<boolean>(false)
|
|
252
|
-
const cpuInvalid = computed<boolean>(
|
|
253
|
-
() =>
|
|
254
|
-
!!cpuErrorLocalText.value ||
|
|
255
|
-
reservationInvalid.value ||
|
|
256
|
-
limitInvalid.value ||
|
|
257
|
-
sharesInvalid.value ||
|
|
258
|
-
(enableCpuHotAdd.value &&
|
|
259
|
-
selectedCpu.value < props.maxCpus &&
|
|
260
|
-
maxCpuInvalid.value)
|
|
261
|
-
)
|
|
262
|
-
watch(
|
|
263
|
-
cpuInvalid,
|
|
264
|
-
(newValue: boolean) => {
|
|
265
|
-
emits('invalid', newValue)
|
|
266
|
-
},
|
|
267
|
-
{ immediate: true }
|
|
268
|
-
)
|
|
269
|
-
|
|
270
|
-
const reservation = ref<string>('1')
|
|
271
|
-
const reservationType = ref<string>('mhz')
|
|
272
|
-
|
|
273
|
-
const limit = ref<string>('Unlimited')
|
|
274
|
-
const limitType = ref<string>('mhz')
|
|
275
|
-
|
|
276
|
-
const shares = ref<string>('2000')
|
|
277
|
-
const sharesType = ref<string>('2000')
|
|
278
|
-
|
|
279
|
-
// const hardwareVirtualization = ref<boolean>(false)
|
|
280
|
-
//
|
|
281
|
-
// const performanceCounters = ref<boolean>(false)
|
|
282
|
-
//
|
|
283
|
-
// const schedulingAffinity = ref<string>('')
|
|
284
|
-
//
|
|
285
|
-
// const iommu = ref<boolean>(false)
|
|
286
|
-
|
|
287
|
-
// const cpuModel = ref<string>(props.cpuModels[0]?.value || '')
|
|
288
|
-
const cpuModel = ref<string>('host-model') // PNCWEB-389
|
|
289
|
-
watch(
|
|
290
|
-
() => props.cpuModels,
|
|
291
|
-
(newValue) => {
|
|
292
|
-
cpuModel.value = newValue[0].value
|
|
293
|
-
}
|
|
294
|
-
)
|
|
295
|
-
const passthroughHostCpu = ref<boolean>(false)
|
|
296
|
-
const hostModelCpu = ref<boolean>(false)
|
|
297
|
-
|
|
298
|
-
// const isShowCpuHelp = ref<boolean>(false)
|
|
299
|
-
|
|
300
|
-
const { $binary } = useNuxtApp()
|
|
301
|
-
watch(
|
|
302
|
-
[
|
|
303
|
-
reservation,
|
|
304
|
-
reservationType,
|
|
305
|
-
limit,
|
|
306
|
-
limitType,
|
|
307
|
-
shares,
|
|
308
|
-
selectedCpu,
|
|
309
|
-
selectedMaxCpu,
|
|
310
|
-
selectedCorePerSocket,
|
|
311
|
-
enableCpuHotAdd,
|
|
312
|
-
cpuModel,
|
|
313
|
-
passthroughHostCpu,
|
|
314
|
-
hostModelCpu,
|
|
315
|
-
],
|
|
316
|
-
() => {
|
|
317
|
-
const reservationInMhz =
|
|
318
|
-
reservationType.value === 'ghz'
|
|
319
|
-
? $binary.ghzToMhz(+reservation.value)
|
|
320
|
-
: +reservation.value
|
|
321
|
-
const limitInMhz =
|
|
322
|
-
limit.value === 'Unlimited'
|
|
323
|
-
? limit.value
|
|
324
|
-
: limitType.value === 'ghz'
|
|
325
|
-
? $binary.ghzToMhz(+limit.value)
|
|
326
|
-
: +limit.value
|
|
327
|
-
const model = passthroughHostCpu.value
|
|
328
|
-
? 'host-passthrough'
|
|
329
|
-
: hostModelCpu.value
|
|
330
|
-
? 'host-model'
|
|
331
|
-
: cpuModel.value
|
|
332
|
-
|
|
333
|
-
emits('send-data', {
|
|
334
|
-
model,
|
|
335
|
-
vcpus: selectedCpu.value,
|
|
336
|
-
max_vcpus: enableCpuHotAdd.value ? selectedMaxCpu.value : 0,
|
|
337
|
-
core_per_socket: selectedCorePerSocket.value,
|
|
338
|
-
reservation_mhz: reservationInMhz,
|
|
339
|
-
limit_mhz: limitInMhz,
|
|
340
|
-
shares: +shares.value,
|
|
341
|
-
hotplug: enableCpuHotAdd.value,
|
|
342
|
-
})
|
|
343
|
-
},
|
|
344
|
-
{
|
|
345
|
-
immediate: true,
|
|
346
|
-
}
|
|
347
|
-
)
|
|
348
|
-
|
|
349
|
-
// Добавляем данные для редактирования
|
|
350
|
-
watch(
|
|
351
|
-
() => props.cpu,
|
|
352
|
-
(newValue) => {
|
|
353
|
-
if (!newValue) return
|
|
354
|
-
|
|
355
|
-
console.log(newValue.hotplug, 555)
|
|
356
|
-
enableCpuHotAdd.value = newValue.hotplug
|
|
357
|
-
selectedCpu.value = newValue.vcpus
|
|
358
|
-
selectedMaxCpu.value = newValue.hotplug ? newValue.max_vcpus : 1
|
|
359
|
-
selectedCorePerSocket.value = newValue.core_per_socket
|
|
360
|
-
reservation.value = '' + newValue.reservation_mhz
|
|
361
|
-
limit.value = '' + newValue.limit_mhz
|
|
362
|
-
shares.value = '' + newValue.shares
|
|
363
|
-
|
|
364
|
-
switch (newValue.model) {
|
|
365
|
-
case 'host-passthrough':
|
|
366
|
-
passthroughHostCpu.value = true
|
|
367
|
-
cpuModel.value = ''
|
|
368
|
-
break
|
|
369
|
-
case 'host-model':
|
|
370
|
-
hostModelCpu.value = true
|
|
371
|
-
cpuModel.value = ''
|
|
372
|
-
break
|
|
373
|
-
default:
|
|
374
|
-
cpuModel.value =
|
|
375
|
-
props.cpuModels.find((model) => model.value === newValue.model)
|
|
376
|
-
?.value || cpuModel.value
|
|
377
|
-
}
|
|
378
|
-
},
|
|
379
|
-
{ immediate: true }
|
|
380
|
-
)
|
|
381
|
-
|
|
382
|
-
const onRemoveValidationError = (): void => {
|
|
383
|
-
emits('remove-error-by-title', 'cpu.vcpus')
|
|
384
|
-
}
|
|
385
|
-
</script>
|
|
386
|
-
|
|
387
|
-
<style scoped lang="scss">
|
|
388
|
-
h3.cpu-help-title {
|
|
389
|
-
margin-top: 7px;
|
|
390
|
-
font-size: 22px;
|
|
391
|
-
color: #565656;
|
|
392
|
-
}
|
|
393
|
-
p.cpu-help-text {
|
|
394
|
-
width: 310px;
|
|
395
|
-
margin-top: 24px;
|
|
396
|
-
font-size: 14px;
|
|
397
|
-
color: #565656;
|
|
398
|
-
}
|
|
399
|
-
a.cpu-more-info {
|
|
400
|
-
color: #00648f;
|
|
401
|
-
font-size: 14px;
|
|
402
|
-
}
|
|
403
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="hardware-cpu">
|
|
3
|
+
<atoms-stack-block :has-children="true" test-id="cpu-stack-block">
|
|
4
|
+
<template #stackBlockKey>
|
|
5
|
+
<div
|
|
6
|
+
id="vm-wizard-toggle-block-cpu"
|
|
7
|
+
data-id="vm-wizard-toggle-block-cpu"
|
|
8
|
+
class="flex-align-center"
|
|
9
|
+
>
|
|
10
|
+
<span>{{ localization.common.cpu }}</span>
|
|
11
|
+
<atoms-the-icon
|
|
12
|
+
v-show="cpuInvalid"
|
|
13
|
+
width="24px"
|
|
14
|
+
height="24px"
|
|
15
|
+
class="is-error tooltip-trigger"
|
|
16
|
+
name="info"
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
<template #stackBlockContent>
|
|
21
|
+
<div class="flex-align-center flex-space-between">
|
|
22
|
+
<div class="flex-align-center">
|
|
23
|
+
<atoms-tooltip-error
|
|
24
|
+
:has-error="!!vcpusLocalAndApiErrorsTexts"
|
|
25
|
+
selector="#vm-wizard-vcpus-field input"
|
|
26
|
+
@remove="onRemoveValidationError"
|
|
27
|
+
>
|
|
28
|
+
<template #elem>
|
|
29
|
+
<atoms-combobox
|
|
30
|
+
id="vm-wizard-vcpus-field"
|
|
31
|
+
class="input-text-color"
|
|
32
|
+
v-model.number="selectedCpu"
|
|
33
|
+
:items="cpuOptions"
|
|
34
|
+
:disabled="isCpuDisabled"
|
|
35
|
+
test-id="vm-wizard-cpu-combobox"
|
|
36
|
+
@click.stop
|
|
37
|
+
/>
|
|
38
|
+
</template>
|
|
39
|
+
<template #content>{{ vcpusLocalAndApiErrorsTexts }}</template>
|
|
40
|
+
</atoms-tooltip-error>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<common-vm-actions-common-customize-hardware-virtual-hardware-cpu-tooltip
|
|
44
|
+
:vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
<template #stackChildren>
|
|
49
|
+
<common-vm-actions-common-customize-hardware-virtual-hardware-cpu-cores-per-socket
|
|
50
|
+
v-model:selected-core-per-socket="selectedCorePerSocket"
|
|
51
|
+
:selected-cpus="selectedCpus"
|
|
52
|
+
:cpu-options="cpuOptions"
|
|
53
|
+
:is-edit="props.isEdit"
|
|
54
|
+
:disabled="isDisabled"
|
|
55
|
+
:error-validation-fields="props.errorValidationFields"
|
|
56
|
+
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
57
|
+
/>
|
|
58
|
+
<common-vm-actions-common-customize-hardware-virtual-hardware-cpu-hot-plug
|
|
59
|
+
v-model:enable-cpu-hot-add="enableCpuHotAdd"
|
|
60
|
+
:disabled="enableCpuHotAddDisabled"
|
|
61
|
+
/>
|
|
62
|
+
<common-vm-actions-common-customize-hardware-virtual-hardware-cpu-max-cpu
|
|
63
|
+
v-show="enableCpuHotAdd"
|
|
64
|
+
v-model:selected-max-cpu.number="selectedMaxCpu"
|
|
65
|
+
:cpu-options="maxCpuOptions"
|
|
66
|
+
:error-validation-fields="props.errorValidationFields"
|
|
67
|
+
:disabled="isDisabled"
|
|
68
|
+
@invalid="maxCpuInvalid = $event"
|
|
69
|
+
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
70
|
+
/>
|
|
71
|
+
<common-vm-actions-common-customize-hardware-virtual-hardware-reservation
|
|
72
|
+
v-model:reservation="reservation"
|
|
73
|
+
v-model:reservation-type="reservationType"
|
|
74
|
+
:error-validation-fields="props.errorValidationFields"
|
|
75
|
+
:disabled="isDisabled"
|
|
76
|
+
type="mhz"
|
|
77
|
+
component-type="cpu"
|
|
78
|
+
@invalid="reservationInvalid = $event"
|
|
79
|
+
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
80
|
+
/>
|
|
81
|
+
<common-vm-actions-common-customize-hardware-virtual-hardware-limit
|
|
82
|
+
v-model:limit="limit"
|
|
83
|
+
v-model:limit-type="limitType"
|
|
84
|
+
:error-validation-fields="props.errorValidationFields"
|
|
85
|
+
:disabled="isDisabled"
|
|
86
|
+
type="mhz"
|
|
87
|
+
component-type="cpu"
|
|
88
|
+
@invalid="limitInvalid = $event"
|
|
89
|
+
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
90
|
+
/>
|
|
91
|
+
<common-vm-actions-common-customize-hardware-virtual-hardware-cpu-shares
|
|
92
|
+
v-model:shares="shares"
|
|
93
|
+
v-model:shares-type="sharesType"
|
|
94
|
+
:error-validation-fields="props.errorValidationFields"
|
|
95
|
+
:disabled="isDisabled"
|
|
96
|
+
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
97
|
+
@invalid="sharesInvalid = $event"
|
|
98
|
+
/>
|
|
99
|
+
<!-- <common-vm-actions-common-customize-hardware-virtual-hardware-cpu-hv-->
|
|
100
|
+
<!-- v-models:hardwareVirtualization="hardwareVirtualization"-->
|
|
101
|
+
<!-- />-->
|
|
102
|
+
<!-- <common-vm-actions-common-customize-hardware-virtual-hardware-cpu-pc-->
|
|
103
|
+
<!-- v-models:performanceCounters="performanceCounters"-->
|
|
104
|
+
<!-- />-->
|
|
105
|
+
<!-- <common-vm-actions-common-customize-hardware-virtual-hardware-cpu-sa-->
|
|
106
|
+
<!-- v-models:schedulingAffinity="schedulingAffinity"-->
|
|
107
|
+
<!-- />-->
|
|
108
|
+
<!-- <common-vm-actions-common-customize-hardware-virtual-hardware-cpu-iommu-->
|
|
109
|
+
<!-- v-models:iommu="iommu"-->
|
|
110
|
+
<!-- />-->
|
|
111
|
+
<common-vm-actions-common-customize-hardware-virtual-hardware-cpu-model
|
|
112
|
+
v-model:cpu-model="cpuModel"
|
|
113
|
+
v-model:passthrough-host-cpu="passthroughHostCpu"
|
|
114
|
+
v-model:host-model-cpu="hostModelCpu"
|
|
115
|
+
:cpu-models="props.cpuModels"
|
|
116
|
+
:is-edit="props.isEdit"
|
|
117
|
+
:error-validation-fields="props.errorValidationFields"
|
|
118
|
+
:disabled="isDisabled"
|
|
119
|
+
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
120
|
+
/>
|
|
121
|
+
</template>
|
|
122
|
+
</atoms-stack-block>
|
|
123
|
+
</div>
|
|
124
|
+
</template>
|
|
125
|
+
|
|
126
|
+
<script setup lang="ts">
|
|
127
|
+
import type { UI_I_SendDataCpu } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
|
|
128
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
129
|
+
import type { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
|
|
130
|
+
import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
|
|
131
|
+
import type { API_UI_I_VmEditCpu } from '~/lib/models/store/vm/interfaces'
|
|
132
|
+
import { cpuOptionsFunc } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/lib/config/cpuOptions'
|
|
133
|
+
|
|
134
|
+
const props = defineProps<{
|
|
135
|
+
maxCpus: number
|
|
136
|
+
cpuModels: UI_I_OptionItem[]
|
|
137
|
+
isEdit: boolean
|
|
138
|
+
errorValidationFields: UI_I_ErrorValidationField<string>[]
|
|
139
|
+
vmCpuHelpTextSecond?: string
|
|
140
|
+
state?: string | number
|
|
141
|
+
cpu?: API_UI_I_VmEditCpu
|
|
142
|
+
}>()
|
|
143
|
+
const emits = defineEmits<{
|
|
144
|
+
(event: 'send-data', value: UI_I_SendDataCpu): void
|
|
145
|
+
(event: 'invalid', value: boolean): void
|
|
146
|
+
(event: 'remove-error-by-title', value: string): void
|
|
147
|
+
}>()
|
|
148
|
+
|
|
149
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
150
|
+
|
|
151
|
+
const isDisabled = computed<boolean>(() => {
|
|
152
|
+
return props.state === 2
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
const cpuOptions = computed<UI_I_OptionItem[]>(() =>
|
|
156
|
+
cpuOptionsFunc(localization.value, 1, props.maxCpus)
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
const enableCpuHotAdd = ref<boolean>(false)
|
|
160
|
+
const enableCpuHotAddDisabled = computed<boolean>(
|
|
161
|
+
() => selectedCpu.value >= props.maxCpus || isDisabled.value
|
|
162
|
+
)
|
|
163
|
+
watch(enableCpuHotAdd, (newValue) => {
|
|
164
|
+
console.log(newValue, 333)
|
|
165
|
+
if (newValue) return
|
|
166
|
+
|
|
167
|
+
maxCpuInvalid.value = false
|
|
168
|
+
selectedMaxCpu.value = 1
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
const selectedCpu = ref<number>(
|
|
172
|
+
isDisabled.value && enableCpuHotAdd.value ? props.maxCpus : 2
|
|
173
|
+
)
|
|
174
|
+
const isCpuDisabled = computed<boolean>(
|
|
175
|
+
() => isDisabled.value && !enableCpuHotAdd.value
|
|
176
|
+
)
|
|
177
|
+
watch(selectedCpu, (newValue) => {
|
|
178
|
+
selectedCpu.value = Math.floor(+newValue)
|
|
179
|
+
if (!(selectedCpu.value % selectedCorePerSocket.value) || isDisabled.value)
|
|
180
|
+
return
|
|
181
|
+
selectedCorePerSocket.value = 1
|
|
182
|
+
})
|
|
183
|
+
const maxCpuOptions = computed<UI_I_OptionItem[]>(() =>
|
|
184
|
+
cpuOptionsFunc(localization.value, selectedCpu.value, props.maxCpus)
|
|
185
|
+
)
|
|
186
|
+
watch(selectedCpu, (newValue) => {
|
|
187
|
+
if (newValue >= props.maxCpus) {
|
|
188
|
+
console.log(444)
|
|
189
|
+
enableCpuHotAdd.value = false
|
|
190
|
+
}
|
|
191
|
+
// selectedMaxCpu.value =
|
|
192
|
+
// selectedMaxCpu.value <= newValue ? newValue + 1 : selectedMaxCpu.value
|
|
193
|
+
// if (selectedMaxCpu.value > props.maxCpus) selectedMaxCpu.value = props.maxCpus
|
|
194
|
+
})
|
|
195
|
+
const selectedMaxCpu = ref<number>(1)
|
|
196
|
+
watch(
|
|
197
|
+
() => props.maxCpus,
|
|
198
|
+
(newValue) => {
|
|
199
|
+
selectedMaxCpu.value = newValue
|
|
200
|
+
}
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
const selectedCpus = computed<number[]>(() =>
|
|
204
|
+
enableCpuHotAdd.value
|
|
205
|
+
? [selectedCpu.value, selectedMaxCpu.value]
|
|
206
|
+
: [selectedCpu.value]
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
const selectedCorePerSocket = ref<number>(1)
|
|
210
|
+
|
|
211
|
+
const cpuErrorLocalText = computed<string>(() => {
|
|
212
|
+
const validValue = /^\d+(\.\d+)?$/.test(selectedCpu.value + '')
|
|
213
|
+
if (!validValue) {
|
|
214
|
+
return localization.value.common.inputContainsInvalidCharacters
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const min = cpuOptions.value[0].value
|
|
218
|
+
const max = cpuOptions.value[1].value
|
|
219
|
+
if (selectedCpu.value < min || selectedCpu.value > max) {
|
|
220
|
+
return localization.value.common.memoryMustBe
|
|
221
|
+
.replace('{0}', min)
|
|
222
|
+
.replace('{1}', max)
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return ''
|
|
226
|
+
})
|
|
227
|
+
|
|
228
|
+
const apiVcpusError = computed<string>(() => {
|
|
229
|
+
return (
|
|
230
|
+
props.errorValidationFields?.find(
|
|
231
|
+
(message) => message.field === 'cpu.vcpus'
|
|
232
|
+
)?.error_message || ''
|
|
233
|
+
)
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
const vcpusLocalAndApiErrorsTexts = computed<string>(() => {
|
|
237
|
+
const localError = cpuErrorLocalText.value
|
|
238
|
+
const apiError = apiVcpusError.value
|
|
239
|
+
|
|
240
|
+
let result = ''
|
|
241
|
+
if (localError && !apiError) result = localError
|
|
242
|
+
if (!localError && apiError) result = apiError
|
|
243
|
+
if (localError && apiError) result = localError + ', ' + apiError
|
|
244
|
+
if (!localError && apiError) result = apiError
|
|
245
|
+
|
|
246
|
+
return result
|
|
247
|
+
})
|
|
248
|
+
const reservationInvalid = ref<boolean>(false)
|
|
249
|
+
const limitInvalid = ref<boolean>(false)
|
|
250
|
+
const sharesInvalid = ref<boolean>(false)
|
|
251
|
+
const maxCpuInvalid = ref<boolean>(false)
|
|
252
|
+
const cpuInvalid = computed<boolean>(
|
|
253
|
+
() =>
|
|
254
|
+
!!cpuErrorLocalText.value ||
|
|
255
|
+
reservationInvalid.value ||
|
|
256
|
+
limitInvalid.value ||
|
|
257
|
+
sharesInvalid.value ||
|
|
258
|
+
(enableCpuHotAdd.value &&
|
|
259
|
+
selectedCpu.value < props.maxCpus &&
|
|
260
|
+
maxCpuInvalid.value)
|
|
261
|
+
)
|
|
262
|
+
watch(
|
|
263
|
+
cpuInvalid,
|
|
264
|
+
(newValue: boolean) => {
|
|
265
|
+
emits('invalid', newValue)
|
|
266
|
+
},
|
|
267
|
+
{ immediate: true }
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
const reservation = ref<string>('1')
|
|
271
|
+
const reservationType = ref<string>('mhz')
|
|
272
|
+
|
|
273
|
+
const limit = ref<string>('Unlimited')
|
|
274
|
+
const limitType = ref<string>('mhz')
|
|
275
|
+
|
|
276
|
+
const shares = ref<string>('2000')
|
|
277
|
+
const sharesType = ref<string>('2000')
|
|
278
|
+
|
|
279
|
+
// const hardwareVirtualization = ref<boolean>(false)
|
|
280
|
+
//
|
|
281
|
+
// const performanceCounters = ref<boolean>(false)
|
|
282
|
+
//
|
|
283
|
+
// const schedulingAffinity = ref<string>('')
|
|
284
|
+
//
|
|
285
|
+
// const iommu = ref<boolean>(false)
|
|
286
|
+
|
|
287
|
+
// const cpuModel = ref<string>(props.cpuModels[0]?.value || '')
|
|
288
|
+
const cpuModel = ref<string>('host-model') // PNCWEB-389
|
|
289
|
+
watch(
|
|
290
|
+
() => props.cpuModels,
|
|
291
|
+
(newValue) => {
|
|
292
|
+
cpuModel.value = newValue[0].value
|
|
293
|
+
}
|
|
294
|
+
)
|
|
295
|
+
const passthroughHostCpu = ref<boolean>(false)
|
|
296
|
+
const hostModelCpu = ref<boolean>(false)
|
|
297
|
+
|
|
298
|
+
// const isShowCpuHelp = ref<boolean>(false)
|
|
299
|
+
|
|
300
|
+
const { $binary } = useNuxtApp()
|
|
301
|
+
watch(
|
|
302
|
+
[
|
|
303
|
+
reservation,
|
|
304
|
+
reservationType,
|
|
305
|
+
limit,
|
|
306
|
+
limitType,
|
|
307
|
+
shares,
|
|
308
|
+
selectedCpu,
|
|
309
|
+
selectedMaxCpu,
|
|
310
|
+
selectedCorePerSocket,
|
|
311
|
+
enableCpuHotAdd,
|
|
312
|
+
cpuModel,
|
|
313
|
+
passthroughHostCpu,
|
|
314
|
+
hostModelCpu,
|
|
315
|
+
],
|
|
316
|
+
() => {
|
|
317
|
+
const reservationInMhz =
|
|
318
|
+
reservationType.value === 'ghz'
|
|
319
|
+
? $binary.ghzToMhz(+reservation.value)
|
|
320
|
+
: +reservation.value
|
|
321
|
+
const limitInMhz =
|
|
322
|
+
limit.value === 'Unlimited'
|
|
323
|
+
? limit.value
|
|
324
|
+
: limitType.value === 'ghz'
|
|
325
|
+
? $binary.ghzToMhz(+limit.value)
|
|
326
|
+
: +limit.value
|
|
327
|
+
const model = passthroughHostCpu.value
|
|
328
|
+
? 'host-passthrough'
|
|
329
|
+
: hostModelCpu.value
|
|
330
|
+
? 'host-model'
|
|
331
|
+
: cpuModel.value
|
|
332
|
+
|
|
333
|
+
emits('send-data', {
|
|
334
|
+
model,
|
|
335
|
+
vcpus: selectedCpu.value,
|
|
336
|
+
max_vcpus: enableCpuHotAdd.value ? selectedMaxCpu.value : 0,
|
|
337
|
+
core_per_socket: selectedCorePerSocket.value,
|
|
338
|
+
reservation_mhz: reservationInMhz,
|
|
339
|
+
limit_mhz: limitInMhz,
|
|
340
|
+
shares: +shares.value,
|
|
341
|
+
hotplug: enableCpuHotAdd.value,
|
|
342
|
+
})
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
immediate: true,
|
|
346
|
+
}
|
|
347
|
+
)
|
|
348
|
+
|
|
349
|
+
// Добавляем данные для редактирования
|
|
350
|
+
watch(
|
|
351
|
+
() => props.cpu,
|
|
352
|
+
(newValue) => {
|
|
353
|
+
if (!newValue) return
|
|
354
|
+
|
|
355
|
+
console.log(newValue.hotplug, 555)
|
|
356
|
+
enableCpuHotAdd.value = newValue.hotplug
|
|
357
|
+
selectedCpu.value = newValue.vcpus
|
|
358
|
+
selectedMaxCpu.value = newValue.hotplug ? newValue.max_vcpus : 1
|
|
359
|
+
selectedCorePerSocket.value = newValue.core_per_socket
|
|
360
|
+
reservation.value = '' + newValue.reservation_mhz
|
|
361
|
+
limit.value = '' + newValue.limit_mhz
|
|
362
|
+
shares.value = '' + newValue.shares
|
|
363
|
+
|
|
364
|
+
switch (newValue.model) {
|
|
365
|
+
case 'host-passthrough':
|
|
366
|
+
passthroughHostCpu.value = true
|
|
367
|
+
cpuModel.value = ''
|
|
368
|
+
break
|
|
369
|
+
case 'host-model':
|
|
370
|
+
hostModelCpu.value = true
|
|
371
|
+
cpuModel.value = ''
|
|
372
|
+
break
|
|
373
|
+
default:
|
|
374
|
+
cpuModel.value =
|
|
375
|
+
props.cpuModels.find((model) => model.value === newValue.model)
|
|
376
|
+
?.value || cpuModel.value
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
{ immediate: true }
|
|
380
|
+
)
|
|
381
|
+
|
|
382
|
+
const onRemoveValidationError = (): void => {
|
|
383
|
+
emits('remove-error-by-title', 'cpu.vcpus')
|
|
384
|
+
}
|
|
385
|
+
</script>
|
|
386
|
+
|
|
387
|
+
<style scoped lang="scss">
|
|
388
|
+
h3.cpu-help-title {
|
|
389
|
+
margin-top: 7px;
|
|
390
|
+
font-size: 22px;
|
|
391
|
+
color: #565656;
|
|
392
|
+
}
|
|
393
|
+
p.cpu-help-text {
|
|
394
|
+
width: 310px;
|
|
395
|
+
margin-top: 24px;
|
|
396
|
+
font-size: 14px;
|
|
397
|
+
color: #565656;
|
|
398
|
+
}
|
|
399
|
+
a.cpu-more-info {
|
|
400
|
+
color: #00648f;
|
|
401
|
+
font-size: 14px;
|
|
402
|
+
}
|
|
403
|
+
</style>
|