bfg-common 1.1.55 → 1.1.56
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/customizeHardware/virtualHardware/VirtualHardware.vue +21 -2
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDrive.vue +274 -223
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/Cpu.vue +1 -0
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/Limit.vue +8 -6
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/Memory.vue +10 -3
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/models/types.ts +1 -1
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +1 -1
- package/package.json +1 -1
package/components/common/vm/actions/add/customizeHardware/virtualHardware/VirtualHardware.vue
CHANGED
|
@@ -81,7 +81,8 @@
|
|
|
81
81
|
@get-folders-or-files="emits('get-folders-or-files', $event)"
|
|
82
82
|
@get-active-device-child="emits('get-active-device-child', $event)"
|
|
83
83
|
@show-datastore-child="emits('show-datastore-child', $event)"
|
|
84
|
-
@remove="onRemoveCdDvdDrive(cdDvdDrivesIndex[key])"
|
|
84
|
+
@remove="onRemoveCdDvdDrive(cdDvdDrivesIndex[key], item)"
|
|
85
|
+
@roll-back="onRollBackCdDvdDrive(cdDvdDrivesIndex[key])"
|
|
85
86
|
@send-data="
|
|
86
87
|
sendDataNewCdDvdDriveMethod($event, cdDvdDrivesIndex[key])
|
|
87
88
|
"
|
|
@@ -369,8 +370,18 @@ const addCdDvdDrive = (): void => {
|
|
|
369
370
|
cdDvdDrivesType.value.push('new')
|
|
370
371
|
cdDvdDrives.value.push(useDeepCopy(defaultCdDvdDriver))
|
|
371
372
|
}
|
|
372
|
-
const onRemoveCdDvdDrive = (index: number): void => {
|
|
373
|
+
const onRemoveCdDvdDrive = (index: number, cdDvdDrive: UI_I_SendDataNewCdDvdDrive): void => {
|
|
373
374
|
const removeIndex = cdDvdDrivesIndex.value.indexOf(index)
|
|
375
|
+
|
|
376
|
+
if (!cdDvdDrive.create && !cdDvdDrive.attach) {
|
|
377
|
+
cdDvdDrivesType.value = cdDvdDrivesType.value.map((item, key) => {
|
|
378
|
+
if (key === removeIndex) return 'removed'
|
|
379
|
+
return item
|
|
380
|
+
})
|
|
381
|
+
sendData()
|
|
382
|
+
return
|
|
383
|
+
}
|
|
384
|
+
|
|
374
385
|
cdDvdDrivesIndex.value = cdDvdDrivesIndex.value.filter(
|
|
375
386
|
(cdDvdDrive) => cdDvdDrive !== index
|
|
376
387
|
)
|
|
@@ -384,6 +395,14 @@ const onRemoveCdDvdDrive = (index: number): void => {
|
|
|
384
395
|
delete sendDataNewCdDvdDrive.value[index]
|
|
385
396
|
sendData()
|
|
386
397
|
}
|
|
398
|
+
const onRollBackCdDvdDrive = (index: number): void => {
|
|
399
|
+
const removeIndex = cdDvdDrivesIndex.value.indexOf(index)
|
|
400
|
+
cdDvdDrivesType.value = cdDvdDrivesType.value.map((item, key) => {
|
|
401
|
+
if (key === removeIndex) return 'edit'
|
|
402
|
+
return item
|
|
403
|
+
})
|
|
404
|
+
}
|
|
405
|
+
|
|
387
406
|
const defaultPciDevice: UI_I_PciDevice = {
|
|
388
407
|
id: '',
|
|
389
408
|
vendor_name: '',
|
package/components/common/vm/actions/add/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDrive.vue
CHANGED
|
@@ -1,223 +1,274 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="hardware-cd-dvd-drive">
|
|
3
|
-
<atoms-stack-block
|
|
4
|
-
:has-children="true"
|
|
5
|
-
:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
)
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
)
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="hardware-cd-dvd-drive">
|
|
3
|
+
<atoms-stack-block
|
|
4
|
+
:has-children="true"
|
|
5
|
+
:is-roll-back="props.type === 'removed'"
|
|
6
|
+
:removable="isRemovable"
|
|
7
|
+
@remove="onRemoveCdDvdDrive"
|
|
8
|
+
@roll-back="onRollBackCdDvdDrive"
|
|
9
|
+
>
|
|
10
|
+
<template #stackBlockKey>
|
|
11
|
+
<div
|
|
12
|
+
class="vm-wizard-toggle-block-cd-dvd-drive vm-wizard-toggle-block-hard-disk"
|
|
13
|
+
>
|
|
14
|
+
<span>{{ label }}</span>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
<template #stackBlockContent>
|
|
18
|
+
<div class="flex-align-center flex-space-between">
|
|
19
|
+
<template v-if="props.type === 'removed'">
|
|
20
|
+
<span>{{ localization.deviceWillRemoved }}</span>
|
|
21
|
+
<div class="flex-align-center">
|
|
22
|
+
<input
|
|
23
|
+
id="delete-files-from-datastore"
|
|
24
|
+
v-model="deleteFilesFromDatastore"
|
|
25
|
+
:disabled="props.disabled"
|
|
26
|
+
type="checkbox"
|
|
27
|
+
class="pointer"
|
|
28
|
+
@click.stop
|
|
29
|
+
/>
|
|
30
|
+
<label
|
|
31
|
+
for="delete-files-from-datastore"
|
|
32
|
+
:class="[
|
|
33
|
+
'label-text-normal pointer',
|
|
34
|
+
props.disabled && 'div-disabled',
|
|
35
|
+
]"
|
|
36
|
+
>{{ localization.deleteFilesFromDatastore }}</label
|
|
37
|
+
>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
<template v-else>
|
|
41
|
+
<div class="select">
|
|
42
|
+
<select
|
|
43
|
+
id="vm-wizard-cd-dvd-drive-field"
|
|
44
|
+
v-model="selectedCdDvdDrive"
|
|
45
|
+
class="vm-wizard-cd-dvd-drive-field"
|
|
46
|
+
@click.stop
|
|
47
|
+
@change="changeCdDvdDrive"
|
|
48
|
+
>
|
|
49
|
+
<option
|
|
50
|
+
v-for="(item, key) in cdDvdDriveOptions"
|
|
51
|
+
:key="key"
|
|
52
|
+
:value="item.value"
|
|
53
|
+
>
|
|
54
|
+
{{ item.text }}
|
|
55
|
+
</option>
|
|
56
|
+
</select>
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
61
|
+
<template #stackChildren>
|
|
62
|
+
<common-vm-actions-add-customize-hardware-virtual-hardware-cd-dvd-drive-media
|
|
63
|
+
v-if="selectedCdDvdDrive === 'datastoreIsoFile'"
|
|
64
|
+
v-model:cd-dvd-media="cdDvdMedia"
|
|
65
|
+
@browse="isShowFileModal = true"
|
|
66
|
+
/>
|
|
67
|
+
|
|
68
|
+
<common-vm-actions-add-customize-hardware-virtual-hardware-bus
|
|
69
|
+
v-model:bus="bus"
|
|
70
|
+
:index="indexByHardDisks"
|
|
71
|
+
:validation-type="busValidationType"
|
|
72
|
+
:error-validation-fields="props.errorValidationFields"
|
|
73
|
+
:disabled="isRunning"
|
|
74
|
+
component-type="disk_devices"
|
|
75
|
+
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
76
|
+
/>
|
|
77
|
+
</template>
|
|
78
|
+
</atoms-stack-block>
|
|
79
|
+
|
|
80
|
+
<Teleport to="body">
|
|
81
|
+
<common-vm-actions-add-customize-hardware-virtual-hardware-browse-view
|
|
82
|
+
v-if="isShowFileModal"
|
|
83
|
+
:show="isShowFileModal"
|
|
84
|
+
:file-types="fileTypes"
|
|
85
|
+
:nodes="props.nodes"
|
|
86
|
+
:files="props.files"
|
|
87
|
+
@submit="onSelectFile"
|
|
88
|
+
@get-storage="emits('get-storage', $event)"
|
|
89
|
+
@get-folders-or-files="emits('get-folders-or-files', $event)"
|
|
90
|
+
@get-active-device-child="emits('get-active-device-child', $event)"
|
|
91
|
+
@show-datastore-child="emits('show-datastore-child', $event)"
|
|
92
|
+
@hide="isShowFileModal = false"
|
|
93
|
+
/>
|
|
94
|
+
</Teleport>
|
|
95
|
+
</div>
|
|
96
|
+
</template>
|
|
97
|
+
|
|
98
|
+
<script lang="ts" setup>
|
|
99
|
+
import { UI_I_FileTreeNode } from '~/components/models/interfaces'
|
|
100
|
+
import { UI_I_TablePayload } from '~/models/store/interfaces'
|
|
101
|
+
import { UI_T_CdDvdDrive } from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/cdDvdDrive/models/types'
|
|
102
|
+
import { UI_I_SendDataNewCdDvdDrive } from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/models/interfaces'
|
|
103
|
+
import { UI_I_Localization, UI_I_HTMLSelectElement } from '~/models/interfaces'
|
|
104
|
+
import { UI_I_ErrorValidationField } from '~/models/store/interfaces'
|
|
105
|
+
import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
|
|
106
|
+
import { UI_I_FolderOrFileTreePayload } from '~/models/store/storage/interfaces'
|
|
107
|
+
import { UI_T_CdDvdType } from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/models/types'
|
|
108
|
+
import { cdDvdDriveOptionsFunc } from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/cdDvdDrive/config/options'
|
|
109
|
+
import { fileTypesFunc } from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/cdDvdDrive/config/fileTypes'
|
|
110
|
+
|
|
111
|
+
const props = defineProps<{
|
|
112
|
+
hardDisksCount: number
|
|
113
|
+
index: number
|
|
114
|
+
cdDvdDrive: UI_I_SendDataNewCdDvdDrive
|
|
115
|
+
nodes: UI_I_FileTreeNode[]
|
|
116
|
+
files: UI_I_FileTreeNode[]
|
|
117
|
+
errorValidationFields: UI_I_ErrorValidationField<string>[]
|
|
118
|
+
type: UI_T_CdDvdType
|
|
119
|
+
isEdit: boolean
|
|
120
|
+
state?: string
|
|
121
|
+
}>()
|
|
122
|
+
|
|
123
|
+
const emits = defineEmits<{
|
|
124
|
+
(event: 'send-data', value: UI_I_SendDataNewCdDvdDrive): void
|
|
125
|
+
(event: 'remove'): void
|
|
126
|
+
(event: 'roll-back'): void
|
|
127
|
+
(event: 'remove-error-by-title', value: string): void
|
|
128
|
+
(event: 'get-storage', value: UI_I_TablePayload): void
|
|
129
|
+
(event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
|
|
130
|
+
(event: 'get-active-device-child', value: UI_I_FileTreeNode): void
|
|
131
|
+
(event: 'show-datastore-child', value: UI_I_FileTreeNode): void
|
|
132
|
+
}>()
|
|
133
|
+
|
|
134
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
135
|
+
|
|
136
|
+
const isRunning = computed<boolean>(() => {
|
|
137
|
+
return props.state === '1'
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
const isRemovable = computed<boolean>(() => {
|
|
141
|
+
return (
|
|
142
|
+
!props.isEdit ||
|
|
143
|
+
!isRunning.value ||
|
|
144
|
+
(isRunning.value && bus.value === 'virtio')
|
|
145
|
+
)
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
const indexByHardDisks = computed<number>(
|
|
149
|
+
() => props.index + props.hardDisksCount
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
const label = computed<string>(() => {
|
|
153
|
+
if (props.type === 'edit' || props.type === 'removed')
|
|
154
|
+
return `${localization.value.cdDvdDrive} ${props.index + 1}`
|
|
155
|
+
|
|
156
|
+
return `${localization.value.newCdDvdDrive} *`
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
const busValidationType = computed<string>(
|
|
160
|
+
() => `disk_devices[${indexByHardDisks}].bus`
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
const selectedCdDvdDrive = ref<UI_T_CdDvdDrive>('clientDevice')
|
|
164
|
+
const cdDvdDriveOptions = ref<UI_I_OptionItem[]>(
|
|
165
|
+
cdDvdDriveOptionsFunc(localization.value)
|
|
166
|
+
)
|
|
167
|
+
const changeCdDvdDrive = (event: UI_I_HTMLSelectElement): void => {
|
|
168
|
+
const isDatastoreIsoFile = event.target.value === 'datastoreIsoFile'
|
|
169
|
+
if (!isDatastoreIsoFile) return
|
|
170
|
+
|
|
171
|
+
isShowFileModal.value = true
|
|
172
|
+
}
|
|
173
|
+
const isShowFileModal = ref<boolean>(false)
|
|
174
|
+
const onSelectFile = (file: UI_I_FileTreeNode): void => {
|
|
175
|
+
cdDvdMedia.value = file.path
|
|
176
|
+
}
|
|
177
|
+
const fileTypes = computed<UI_I_OptionItem[]>(() =>
|
|
178
|
+
fileTypesFunc(localization.value)
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
const onRemoveCdDvdDrive = (): void => {
|
|
182
|
+
emits('remove')
|
|
183
|
+
}
|
|
184
|
+
const onRollBackCdDvdDrive = (): void => {
|
|
185
|
+
emits('roll-back')
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const cdDvdMedia = ref<string>('')
|
|
189
|
+
const bus = ref<string>('ide')
|
|
190
|
+
|
|
191
|
+
const deleteFilesFromDatastore = ref<boolean>(false)
|
|
192
|
+
|
|
193
|
+
watch(
|
|
194
|
+
[cdDvdMedia, bus, deleteFilesFromDatastore, , () => props.type],
|
|
195
|
+
() => {
|
|
196
|
+
emits('send-data', {
|
|
197
|
+
create: props.cdDvdDrive.create,
|
|
198
|
+
attach: props.cdDvdDrive.attach,
|
|
199
|
+
source: cdDvdMedia.value,
|
|
200
|
+
size: 0,
|
|
201
|
+
bus: bus.value,
|
|
202
|
+
device_type: 'cdrom',
|
|
203
|
+
provision_type: 'thick',
|
|
204
|
+
disk_mode: 'dependent',
|
|
205
|
+
sharing: false,
|
|
206
|
+
read_only: true,
|
|
207
|
+
shares: 0,
|
|
208
|
+
cache: 'none',
|
|
209
|
+
io: 'native',
|
|
210
|
+
limit_iops: 0,
|
|
211
|
+
discard: 'unmap',
|
|
212
|
+
boot_order: -1,
|
|
213
|
+
detach: props.type === 'removed',
|
|
214
|
+
remove: props.type === 'removed' && deleteFilesFromDatastore.value, // Проверяем если удалили диск и указали Delete files from datastore
|
|
215
|
+
})
|
|
216
|
+
// if (!props.isEdit) {
|
|
217
|
+
// emits('send-data', {
|
|
218
|
+
// create: false,
|
|
219
|
+
// source: cdDvdMedia.value,
|
|
220
|
+
// bus: bus.value,
|
|
221
|
+
// device_type: 'cdrom',
|
|
222
|
+
// boot_order: -1,
|
|
223
|
+
// })
|
|
224
|
+
// return
|
|
225
|
+
// }
|
|
226
|
+
// emits('send-data', {
|
|
227
|
+
// create: false,
|
|
228
|
+
// source: cdDvdMedia.value,
|
|
229
|
+
// bus: bus.value,
|
|
230
|
+
// device_type: 'cdrom',
|
|
231
|
+
// boot_order: -1,
|
|
232
|
+
// size: 0,
|
|
233
|
+
// target: 'hda',
|
|
234
|
+
// storage_id: '',
|
|
235
|
+
// provision_type: 'thick',
|
|
236
|
+
// disk_mode: 'dependent',
|
|
237
|
+
// sharing: false,
|
|
238
|
+
// read_only: true,
|
|
239
|
+
// shares: 0,
|
|
240
|
+
// cache: 'none',
|
|
241
|
+
// io: 'native',
|
|
242
|
+
// limit_iops: 0,
|
|
243
|
+
// discard: 'unmap',
|
|
244
|
+
// })
|
|
245
|
+
},
|
|
246
|
+
{ immediate: true }
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
// Добавляем данные для редактирования
|
|
250
|
+
watch(
|
|
251
|
+
() => props.cdDvdDrive,
|
|
252
|
+
(newValue) => {
|
|
253
|
+
if (newValue.source !== '') {
|
|
254
|
+
selectedCdDvdDrive.value = 'datastoreIsoFile'
|
|
255
|
+
cdDvdMedia.value = newValue.source
|
|
256
|
+
}
|
|
257
|
+
if (newValue.bus !== '') {
|
|
258
|
+
bus.value = newValue.bus
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
{ immediate: true }
|
|
262
|
+
)
|
|
263
|
+
watch(
|
|
264
|
+
isRunning,
|
|
265
|
+
(newValue) => {
|
|
266
|
+
if (newValue && props.type === 'new') {
|
|
267
|
+
bus.value = 'virtio'
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
{ immediate: true }
|
|
271
|
+
)
|
|
272
|
+
</script>
|
|
273
|
+
|
|
274
|
+
<style lang="scss" scoped></style>
|
|
@@ -187,17 +187,19 @@ const limitErrorLocalText = computed<string>(() => {
|
|
|
187
187
|
return localization.value.inputContainsInvalidCharacters
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
if (limitLocal.value !== 'Unlimited') {
|
|
191
|
+
const value = $binary.universalFromTo(
|
|
191
192
|
+limitLocal.value,
|
|
192
193
|
limitTypeLocal.value,
|
|
193
194
|
binaryKeys[0],
|
|
194
195
|
0
|
|
195
|
-
)
|
|
196
|
-
if (value % props.multiply !== 0) {
|
|
197
|
-
return localization.value.valueShouldMultiple.replace(
|
|
198
|
-
'{0}',
|
|
199
|
-
`${props.multiply} ${binaryKeys[0].toUpperCase()}`
|
|
200
196
|
)
|
|
197
|
+
if (value % props.multiply !== 0) {
|
|
198
|
+
return localization.value.valueShouldMultiple.replace(
|
|
199
|
+
'{0}',
|
|
200
|
+
`${props.multiply} ${binaryKeys[0].toUpperCase()}`
|
|
201
|
+
)
|
|
202
|
+
}
|
|
201
203
|
}
|
|
202
204
|
|
|
203
205
|
return ''
|
package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/Memory.vue
CHANGED
|
@@ -244,7 +244,8 @@ const reserveGuestMemory = ref<boolean>(false)
|
|
|
244
244
|
const limit = ref<string>('Unlimited')
|
|
245
245
|
watch(limit, (newValue) => {
|
|
246
246
|
const valueInt = parseInt('' + newValue)
|
|
247
|
-
limit.value !== 'Unlimited' &&
|
|
247
|
+
limit.value !== 'Unlimited' &&
|
|
248
|
+
(limit.value = isNaN(valueInt) ? '0' : '' + valueInt)
|
|
248
249
|
})
|
|
249
250
|
const limitType = ref<string>('mb')
|
|
250
251
|
const limitOptions = computed<UI_I_OptionItem[] | undefined>(() => {
|
|
@@ -265,7 +266,7 @@ watch(isDisabledMemoryHotPlug, (newValue) => {
|
|
|
265
266
|
})
|
|
266
267
|
|
|
267
268
|
watch(
|
|
268
|
-
[memoryInMb, memoryHotPlug, reservation, reservationType, limit],
|
|
269
|
+
[memoryInMb, memoryHotPlug, reservation, reservationType, limit, limitType],
|
|
269
270
|
() => {
|
|
270
271
|
const reservationInMb =
|
|
271
272
|
reservationType.value === 'mb'
|
|
@@ -277,11 +278,17 @@ watch(
|
|
|
277
278
|
'mb',
|
|
278
279
|
12
|
|
279
280
|
)
|
|
281
|
+
const limitInMb =
|
|
282
|
+
limit.value === 'Unlimited'
|
|
283
|
+
? limit.value
|
|
284
|
+
: limitType.value === 'gb'
|
|
285
|
+
? $binary.gbToMb(+limit.value)
|
|
286
|
+
: +limit.value
|
|
280
287
|
emits('send-data', {
|
|
281
288
|
memory: '' + memoryInMb.value,
|
|
282
289
|
hotplug: memoryHotPlug.value,
|
|
283
290
|
reservation_mb: reservationInMb,
|
|
284
|
-
limit_mb:
|
|
291
|
+
limit_mb: limitInMb,
|
|
285
292
|
})
|
|
286
293
|
},
|
|
287
294
|
{ immediate: true }
|
|
@@ -383,7 +383,7 @@ watch(
|
|
|
383
383
|
discard: discard.value,
|
|
384
384
|
capacity: sizeInMb.value,
|
|
385
385
|
boot_order: -1,
|
|
386
|
-
detach: props.type === 'removed'
|
|
386
|
+
detach: props.type === 'removed',
|
|
387
387
|
remove: props.type === 'removed' && deleteFilesFromDatastore.value, // Проверяем если удалили диск и указали Delete files from datastore
|
|
388
388
|
})
|
|
389
389
|
},
|