bfg-common 1.0.15 → 1.0.16
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/atoms/alert/Notification.vue +167 -167
- package/components/atoms/autocomplete/Autocomplete.vue +236 -236
- package/components/atoms/combobox/Combobox.vue +131 -131
- package/components/atoms/datepicker/Datepicker.vue +612 -612
- package/components/atoms/dropdown/tree/Tree.vue +134 -134
- package/components/atoms/list/SelectList.vue +62 -62
- package/components/atoms/modal/bySteps/BySteps.vue +234 -234
- package/components/atoms/modal/byStepsSecond/ByStepsSecond.vue +174 -174
- package/components/atoms/nav/NavBar.vue +116 -116
- package/components/atoms/nav/VerticalNavBar.vue +89 -89
- package/components/atoms/notificationBar/NotificationBar.vue +175 -175
- package/components/atoms/perPage/PerPage.vue +52 -52
- package/components/atoms/popup/SimplePopup.vue +90 -90
- package/components/atoms/step/VerticalStep.vue +104 -104
- package/components/atoms/switch/Switch.vue +107 -107
- package/components/atoms/table/dataGrid/DataGridColumnSwitch.vue +204 -204
- package/components/atoms/table/dataGrid/DataGridPage.vue +189 -189
- package/components/atoms/table/dataGrid/DataGridPagination.vue +83 -83
- package/components/atoms/table/dataGrid/config/itemsPerPage.ts +20 -20
- package/components/atoms/tabs/Tabs.vue +189 -189
- package/components/atoms/tooltip/Signpost.vue +224 -224
- package/components/common/accordion/Accordion.vue +176 -176
- package/components/common/accordion/Recursion.vue +195 -195
- package/components/common/adapterManager/AddAdapterWarningModal.vue +82 -82
- package/components/common/adapterManager/NoActiveAdaptersModal.vue +62 -62
- package/components/common/adapterManager/NoConnectedActiveAdaptersModal.vue +62 -62
- package/components/common/browse/Browse.vue +182 -182
- package/components/common/browse/blocks/Title.vue +66 -66
- package/components/common/diagramMain/Header.vue +160 -160
- package/components/common/diagramMain/adapter/AdapterItem.vue +227 -227
- package/components/common/diagramMain/adapter/AdapterItems.vue +57 -57
- package/components/common/diagramMain/modals/ManagePhysicalAdaptersModal.vue +236 -236
- package/components/common/diagramMain/modals/editSettings/tabs/Security.vue +178 -178
- package/components/common/diagramMain/modals/editSettings/tabs/TrafficShaping.vue +392 -392
- package/components/common/diagramMain/modals/editSettings/tabs/port/IpvFourSettings.vue +339 -339
- package/components/common/diagramMain/modals/editSettings/tabs/port/PortProperties.vue +202 -202
- package/components/common/diagramMain/modals/remove/RemoveModal.vue +226 -226
- package/components/common/diagramMain/modals/viewSettings/Info.vue +94 -94
- package/components/common/diagramMain/network/Contents.vue +238 -238
- package/components/common/feedback/Buttons.vue +232 -232
- package/components/common/feedback/Message.vue +468 -468
- package/components/common/feedback/VisitPortal.vue +54 -54
- package/components/common/modals/Rename.vue +165 -165
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/Form.vue +388 -388
- package/components/common/monitor/models/interfaces.ts +0 -1
- package/components/common/perPage/PerPage.vue +51 -51
- package/components/common/recursionTree/RecursionTree.vue +201 -201
- package/components/common/vm/actions/add/Add.vue +687 -687
- package/components/common/vm/actions/add/FolderTreeView.vue +83 -83
- package/components/common/vm/actions/add/config/capabilities.ts +670 -670
- package/components/common/vm/actions/add/customizeHardware/CustomizeHardware.vue +1 -1
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/browseView/BrowseView.vue +203 -203
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/cdDvdDrive/media/Media.vue +55 -55
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/CoresPerSocket.vue +1 -1
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/Cpu.vue +371 -368
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/CpuModel.vue +2 -2
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/MaxCpu.vue +105 -99
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/Sa.vue +102 -102
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/shares/Shares.vue +155 -151
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/Limit.vue +214 -210
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/Memory.vue +282 -278
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/Location.vue +10 -10
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +451 -447
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/cache/Cache.vue +1 -1
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/limitIops/LimitIops.vue +151 -147
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/provisioning/Provisioning.vue +2 -2
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/Location.vue +1 -1
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +256 -252
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/adapterType/AdapterType.vue +86 -86
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddress.vue +6 -6
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/newUsbController/NewUsbController.vue +3 -3
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/reservation/Reservation.vue +231 -228
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/TotalVideoMemory.vue +1 -1
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/VideoCard.vue +173 -169
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/numberDisplays/NumberDisplays.vue +1 -1
- package/components/common/vm/actions/add/customizeHardware/vmoptions/Vmoptions.vue +145 -141
- package/components/common/vm/actions/add/customizeHardware/vmoptions/bootOptions/BootOptions.vue +1 -1
- package/components/common/vm/actions/add/customizeHardware/vmoptions/bootOptions/firmware/Firmware.vue +1 -1
- package/components/common/vm/actions/add/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +114 -114
- package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/RemoteConsoleOptions.vue +230 -226
- package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/imgCompression/ImgCompression.vue +1 -1
- package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/jpegCompression/JpegCompression.vue +1 -1
- package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +50 -50
- package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/mouseMode/MouseMode.vue +52 -52
- package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/streamingMode/StreamingMode.vue +1 -1
- package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/type/Type.vue +1 -1
- package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/zlibCompression/ZlibCompression.vue +1 -1
- package/components/common/vm/actions/add/select/compatibility/Compatibility.vue +151 -151
- package/components/common/vm/actions/add/select/computeResource/ComputeResource.vue +170 -170
- package/components/common/vm/actions/add/select/computeResource/TreeView.vue +126 -126
- package/components/common/vm/actions/add/select/name/Name.vue +173 -173
- package/components/common/vm/actions/add/select/os/os.vue +221 -221
- package/components/common/vm/actions/add/utils.ts +118 -118
- package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/TablesView.vue +141 -141
- package/components/common/wizards/datastore/add/nfs/configuration/Configuration.vue +373 -373
- package/components/common/wizards/datastore/add/nfs/configuration/serversList/ServersList.vue +123 -123
- package/components/common/wizards/datastore/add/nfs/kerberosAuthentication/KerberosAuthentication.vue +54 -54
- package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/hostTable/HostTable.vue +131 -131
- package/components/common/wizards/datastore/add/sharedStorm/partitionConfiguration/PartitionConfiguration.vue +230 -230
- package/models/store/storage/interfaces.ts +32 -32
- package/package.json +1 -1
- package/plugins/recursion.ts +230 -230
- package/public/spice-console/application/codec.js +257 -257
- package/public/spice-console/lib/rasterEngine.js +907 -907
- package/public/spice-console-minify/lib/decoder/dixie.min.js +4 -4
- package/public/spice-console-minify/lib/jgestures.min.js +24 -24
- package/public/spice-console-minify/lib/jquery-2.0.3.min.js +24 -24
- package/public/spice-console-minify/lib/jquery-mousewheel.min.js +11 -11
- package/public/spice-console-minify/lib/jquery-visibility.min.js +1 -1
- package/public/spice-console-minify/lib/lodash.4.0.0.min.js +5 -5
package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/Memory.vue
CHANGED
|
@@ -1,278 +1,282 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="hardware-memory">
|
|
3
|
-
<atoms-stack-block :has-children="true">
|
|
4
|
-
<template #stackBlockKey>
|
|
5
|
-
<div id="vm-wizard-toggle-block-memory" class="flex-align-center">
|
|
6
|
-
<span>{{ localization.memory }}</span>
|
|
7
|
-
<atoms-the-icon
|
|
8
|
-
v-show="memoryInvalid"
|
|
9
|
-
width="24px"
|
|
10
|
-
height="24px"
|
|
11
|
-
class="is-error tooltip-trigger"
|
|
12
|
-
name="info"
|
|
13
|
-
/>
|
|
14
|
-
</div>
|
|
15
|
-
</template>
|
|
16
|
-
<template #stackBlockContent>
|
|
17
|
-
<div class="flex-align-center">
|
|
18
|
-
<atoms-tooltip-error
|
|
19
|
-
:has-error="!!memorySizeLocalAndApiErrorsTexts"
|
|
20
|
-
selector="#vm-wizard-memory-field input"
|
|
21
|
-
@remove="onRemoveValidationError"
|
|
22
|
-
>
|
|
23
|
-
<template #elem>
|
|
24
|
-
<atoms-combobox
|
|
25
|
-
id="vm-wizard-memory-field"
|
|
26
|
-
v-model="selectedMemory"
|
|
27
|
-
:items="memoryOptions"
|
|
28
|
-
:disabled="isMemoryDisabled"
|
|
29
|
-
@click.stop
|
|
30
|
-
@select="selectMemory"
|
|
31
|
-
/>
|
|
32
|
-
</template>
|
|
33
|
-
<template #content>{{ memorySizeLocalAndApiErrorsTexts }}</template>
|
|
34
|
-
</atoms-tooltip-error>
|
|
35
|
-
|
|
36
|
-
<div class="select ml-1">
|
|
37
|
-
<select
|
|
38
|
-
id="vm-wizard-memory-type-select"
|
|
39
|
-
v-model="memoryType"
|
|
40
|
-
@click.stop
|
|
41
|
-
>
|
|
42
|
-
<option
|
|
43
|
-
v-for="(item, key) in memoryTypeOptions"
|
|
44
|
-
:key="key"
|
|
45
|
-
:value="item.value"
|
|
46
|
-
>
|
|
47
|
-
{{ item.text }}
|
|
48
|
-
</option>
|
|
49
|
-
</select>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</template>
|
|
53
|
-
<template #stackChildren>
|
|
54
|
-
<common-vm-actions-add-customize-hardware-virtual-hardware-reservation
|
|
55
|
-
v-model:reservation="reservation"
|
|
56
|
-
v-model:reservation-type="reservationType"
|
|
57
|
-
v-model:reserve-guest-memory="reserveGuestMemory"
|
|
58
|
-
:error-validation-fields="props.errorValidationFields"
|
|
59
|
-
:multiply="2"
|
|
60
|
-
:disabled="isDisabled"
|
|
61
|
-
component-type="memory"
|
|
62
|
-
type="mb"
|
|
63
|
-
class="memory-reservation"
|
|
64
|
-
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
65
|
-
@invalid="reservationInvalid = $event"
|
|
66
|
-
/>
|
|
67
|
-
<common-vm-actions-add-customize-hardware-virtual-hardware-limit
|
|
68
|
-
v-model:limit="limit"
|
|
69
|
-
v-model:limit-type="limitType"
|
|
70
|
-
:error-validation-fields="props.errorValidationFields"
|
|
71
|
-
:limit-options="limitOptions"
|
|
72
|
-
:disabled="isDisabled"
|
|
73
|
-
type="mb"
|
|
74
|
-
component-type="memory"
|
|
75
|
-
class="memory-limit"
|
|
76
|
-
@invalid="limitInvalid = $event"
|
|
77
|
-
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
78
|
-
/>
|
|
79
|
-
<common-vm-actions-add-customize-hardware-virtual-hardware-memory-hot-plug
|
|
80
|
-
v-model:memory-hot-plug="memoryHotPlug"
|
|
81
|
-
:disabled="isDisabledMemoryHotPlug"
|
|
82
|
-
/>
|
|
83
|
-
</template>
|
|
84
|
-
</atoms-stack-block>
|
|
85
|
-
</div>
|
|
86
|
-
</template>
|
|
87
|
-
|
|
88
|
-
<script setup lang="ts">
|
|
89
|
-
import { API_UI_I_VmEditMemory } from '~/models/store/vm/interfaces'
|
|
90
|
-
import { UI_I_SendDataMemory } from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/models/interfaces'
|
|
91
|
-
import { UI_I_Localization } from '~/models/interfaces'
|
|
92
|
-
import { UI_I_ErrorValidationField } from '~/models/store/interfaces'
|
|
93
|
-
import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
|
|
94
|
-
import { binaryOptionsFunc } from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/config/binaryOptions'
|
|
95
|
-
import { memoryOptionsFunc } from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/config/memoryOptions'
|
|
96
|
-
|
|
97
|
-
const props = defineProps<{
|
|
98
|
-
maxMemory: number
|
|
99
|
-
isEdit: boolean
|
|
100
|
-
errorValidationFields: UI_I_ErrorValidationField
|
|
101
|
-
state?: string
|
|
102
|
-
memory?: API_UI_I_VmEditMemory
|
|
103
|
-
}>()
|
|
104
|
-
const emits = defineEmits<{
|
|
105
|
-
(event: 'send-data', value: UI_I_SendDataMemory): void
|
|
106
|
-
(event: 'invalid', value: boolean): void
|
|
107
|
-
(event: 'remove-error-by-title', value: string): void
|
|
108
|
-
}>()
|
|
109
|
-
|
|
110
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
111
|
-
const { $binary } = useNuxtApp()
|
|
112
|
-
|
|
113
|
-
const minMemoryInMb = 128
|
|
114
|
-
watch(
|
|
115
|
-
() => props.maxMemory,
|
|
116
|
-
(newValue) => {
|
|
117
|
-
memoryOptions.value = memoryOptionsFunc(
|
|
118
|
-
localization.value,
|
|
119
|
-
minMemoryInMb,
|
|
120
|
-
newValue
|
|
121
|
-
)
|
|
122
|
-
}
|
|
123
|
-
)
|
|
124
|
-
|
|
125
|
-
const isDisabled = computed<boolean>(() => {
|
|
126
|
-
return props.state === '1'
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
const isMemoryDisabled = computed<boolean>(
|
|
130
|
-
() => isDisabled.value && !memoryHotPlug.value
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
const selectedMemory = ref<number>(4)
|
|
134
|
-
const memoryType = ref<string>('gb')
|
|
135
|
-
const memoryTypeOptions = ref<UI_I_OptionItem[]>(
|
|
136
|
-
binaryOptionsFunc(localization.value)
|
|
137
|
-
)
|
|
138
|
-
const memoryInMb = computed<number>(() => {
|
|
139
|
-
if (memoryType.value === 'mb') {
|
|
140
|
-
return +selectedMemory.value
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return $binary.universalFromTo(+selectedMemory.value, memoryType.value, 'mb')
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
const memoryOptions = ref<UI_I_OptionItem[]>(
|
|
147
|
-
memoryOptionsFunc(localization.value, minMemoryInMb, props.maxMemory)
|
|
148
|
-
)
|
|
149
|
-
const selectMemory = (mb: number): void => {
|
|
150
|
-
if (memoryType.value === 'mb') {
|
|
151
|
-
selectedMemory.value = mb
|
|
152
|
-
return
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
selectedMemory.value = $binary.universalFromTo(mb, 'mb', memoryType.value, 12)
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
const memoryErrorLocalText = computed<string>(() => {
|
|
159
|
-
const validValue = /^\d+(\.\d+)?$/.test(selectedMemory.value + '')
|
|
160
|
-
if (!validValue) {
|
|
161
|
-
return localization.value.inputContainsInvalidCharacters
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
const maxMemoryInGb = $binary.mbToGb(props.maxMemory)
|
|
165
|
-
if (memoryInMb.value < minMemoryInMb || memoryInMb.value > props.maxMemory) {
|
|
166
|
-
return localization.value.memoryMustBe
|
|
167
|
-
.replace('{0}', `${minMemoryInMb} ${localization.value.mb}`)
|
|
168
|
-
.replace('{1}', `${maxMemoryInGb} ${localization.value.gb}`)
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (memoryInMb.value % 2 !== 0) {
|
|
172
|
-
return localization.value.valueShouldMultiple.replace(
|
|
173
|
-
'{0}',
|
|
174
|
-
`${2} ${localization.value.mb}`
|
|
175
|
-
)
|
|
176
|
-
}
|
|
177
|
-
return ''
|
|
178
|
-
})
|
|
179
|
-
|
|
180
|
-
const apiErrorLocal = computed<string>(() => {
|
|
181
|
-
return (
|
|
182
|
-
props.errorValidationFields?.find(
|
|
183
|
-
(message) => message.field === 'memory.size_mb'
|
|
184
|
-
)?.error_message || ''
|
|
185
|
-
)
|
|
186
|
-
})
|
|
187
|
-
|
|
188
|
-
const memorySizeLocalAndApiErrorsTexts = computed<string>(() => {
|
|
189
|
-
const localError = memoryErrorLocalText.value
|
|
190
|
-
const apiError = apiErrorLocal.value
|
|
191
|
-
|
|
192
|
-
let result = ''
|
|
193
|
-
if (localError && !apiError) result = localError
|
|
194
|
-
if (apiError && !localError) result = apiError
|
|
195
|
-
if (localError && apiError) result = localError + ', ' + apiError
|
|
196
|
-
if (!localError && apiError) result = apiError
|
|
197
|
-
|
|
198
|
-
return result
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
const reservationInvalid = ref<boolean>(false)
|
|
202
|
-
const limitInvalid = ref<boolean>(false)
|
|
203
|
-
const memoryInvalid = computed<boolean>(
|
|
204
|
-
() =>
|
|
205
|
-
!!memorySizeLocalAndApiErrorsTexts.value ||
|
|
206
|
-
reservationInvalid.value ||
|
|
207
|
-
limitInvalid.value
|
|
208
|
-
)
|
|
209
|
-
watch(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
const
|
|
218
|
-
const
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
watch(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="hardware-memory">
|
|
3
|
+
<atoms-stack-block :has-children="true">
|
|
4
|
+
<template #stackBlockKey>
|
|
5
|
+
<div id="vm-wizard-toggle-block-memory" class="flex-align-center">
|
|
6
|
+
<span>{{ localization.memory }}</span>
|
|
7
|
+
<atoms-the-icon
|
|
8
|
+
v-show="memoryInvalid"
|
|
9
|
+
width="24px"
|
|
10
|
+
height="24px"
|
|
11
|
+
class="is-error tooltip-trigger"
|
|
12
|
+
name="info"
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
<template #stackBlockContent>
|
|
17
|
+
<div class="flex-align-center">
|
|
18
|
+
<atoms-tooltip-error
|
|
19
|
+
:has-error="!!memorySizeLocalAndApiErrorsTexts"
|
|
20
|
+
selector="#vm-wizard-memory-field input"
|
|
21
|
+
@remove="onRemoveValidationError"
|
|
22
|
+
>
|
|
23
|
+
<template #elem>
|
|
24
|
+
<atoms-combobox
|
|
25
|
+
id="vm-wizard-memory-field"
|
|
26
|
+
v-model="selectedMemory"
|
|
27
|
+
:items="memoryOptions"
|
|
28
|
+
:disabled="isMemoryDisabled"
|
|
29
|
+
@click.stop
|
|
30
|
+
@select="selectMemory"
|
|
31
|
+
/>
|
|
32
|
+
</template>
|
|
33
|
+
<template #content>{{ memorySizeLocalAndApiErrorsTexts }}</template>
|
|
34
|
+
</atoms-tooltip-error>
|
|
35
|
+
|
|
36
|
+
<div class="select ml-1">
|
|
37
|
+
<select
|
|
38
|
+
id="vm-wizard-memory-type-select"
|
|
39
|
+
v-model="memoryType"
|
|
40
|
+
@click.stop
|
|
41
|
+
>
|
|
42
|
+
<option
|
|
43
|
+
v-for="(item, key) in memoryTypeOptions"
|
|
44
|
+
:key="key"
|
|
45
|
+
:value="item.value"
|
|
46
|
+
>
|
|
47
|
+
{{ item.text }}
|
|
48
|
+
</option>
|
|
49
|
+
</select>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</template>
|
|
53
|
+
<template #stackChildren>
|
|
54
|
+
<common-vm-actions-add-customize-hardware-virtual-hardware-reservation
|
|
55
|
+
v-model:reservation="reservation"
|
|
56
|
+
v-model:reservation-type="reservationType"
|
|
57
|
+
v-model:reserve-guest-memory="reserveGuestMemory"
|
|
58
|
+
:error-validation-fields="props.errorValidationFields"
|
|
59
|
+
:multiply="2"
|
|
60
|
+
:disabled="isDisabled"
|
|
61
|
+
component-type="memory"
|
|
62
|
+
type="mb"
|
|
63
|
+
class="memory-reservation"
|
|
64
|
+
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
65
|
+
@invalid="reservationInvalid = $event"
|
|
66
|
+
/>
|
|
67
|
+
<common-vm-actions-add-customize-hardware-virtual-hardware-limit
|
|
68
|
+
v-model:limit="limit"
|
|
69
|
+
v-model:limit-type="limitType"
|
|
70
|
+
:error-validation-fields="props.errorValidationFields"
|
|
71
|
+
:limit-options="limitOptions"
|
|
72
|
+
:disabled="isDisabled"
|
|
73
|
+
type="mb"
|
|
74
|
+
component-type="memory"
|
|
75
|
+
class="memory-limit"
|
|
76
|
+
@invalid="limitInvalid = $event"
|
|
77
|
+
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
|
78
|
+
/>
|
|
79
|
+
<common-vm-actions-add-customize-hardware-virtual-hardware-memory-hot-plug
|
|
80
|
+
v-model:memory-hot-plug="memoryHotPlug"
|
|
81
|
+
:disabled="isDisabledMemoryHotPlug"
|
|
82
|
+
/>
|
|
83
|
+
</template>
|
|
84
|
+
</atoms-stack-block>
|
|
85
|
+
</div>
|
|
86
|
+
</template>
|
|
87
|
+
|
|
88
|
+
<script setup lang="ts">
|
|
89
|
+
import { API_UI_I_VmEditMemory } from '~/models/store/vm/interfaces'
|
|
90
|
+
import { UI_I_SendDataMemory } from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/models/interfaces'
|
|
91
|
+
import { UI_I_Localization } from '~/models/interfaces'
|
|
92
|
+
import { UI_I_ErrorValidationField } from '~/models/store/interfaces'
|
|
93
|
+
import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
|
|
94
|
+
import { binaryOptionsFunc } from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/config/binaryOptions'
|
|
95
|
+
import { memoryOptionsFunc } from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/config/memoryOptions'
|
|
96
|
+
|
|
97
|
+
const props = defineProps<{
|
|
98
|
+
maxMemory: number
|
|
99
|
+
isEdit: boolean
|
|
100
|
+
errorValidationFields: UI_I_ErrorValidationField[]
|
|
101
|
+
state?: string
|
|
102
|
+
memory?: API_UI_I_VmEditMemory
|
|
103
|
+
}>()
|
|
104
|
+
const emits = defineEmits<{
|
|
105
|
+
(event: 'send-data', value: UI_I_SendDataMemory): void
|
|
106
|
+
(event: 'invalid', value: boolean): void
|
|
107
|
+
(event: 'remove-error-by-title', value: string): void
|
|
108
|
+
}>()
|
|
109
|
+
|
|
110
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
111
|
+
const { $binary } = useNuxtApp()
|
|
112
|
+
|
|
113
|
+
const minMemoryInMb = 128
|
|
114
|
+
watch(
|
|
115
|
+
() => props.maxMemory,
|
|
116
|
+
(newValue) => {
|
|
117
|
+
memoryOptions.value = memoryOptionsFunc(
|
|
118
|
+
localization.value,
|
|
119
|
+
minMemoryInMb,
|
|
120
|
+
newValue
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
const isDisabled = computed<boolean>(() => {
|
|
126
|
+
return props.state === '1'
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
const isMemoryDisabled = computed<boolean>(
|
|
130
|
+
() => isDisabled.value && !memoryHotPlug.value
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
const selectedMemory = ref<number>(4)
|
|
134
|
+
const memoryType = ref<string>('gb')
|
|
135
|
+
const memoryTypeOptions = ref<UI_I_OptionItem[]>(
|
|
136
|
+
binaryOptionsFunc(localization.value)
|
|
137
|
+
)
|
|
138
|
+
const memoryInMb = computed<number>(() => {
|
|
139
|
+
if (memoryType.value === 'mb') {
|
|
140
|
+
return +selectedMemory.value
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return $binary.universalFromTo(+selectedMemory.value, memoryType.value, 'mb')
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
const memoryOptions = ref<UI_I_OptionItem[]>(
|
|
147
|
+
memoryOptionsFunc(localization.value, minMemoryInMb, props.maxMemory)
|
|
148
|
+
)
|
|
149
|
+
const selectMemory = (mb: number): void => {
|
|
150
|
+
if (memoryType.value === 'mb') {
|
|
151
|
+
selectedMemory.value = mb
|
|
152
|
+
return
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
selectedMemory.value = $binary.universalFromTo(mb, 'mb', memoryType.value, 12)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const memoryErrorLocalText = computed<string>(() => {
|
|
159
|
+
const validValue = /^\d+(\.\d+)?$/.test(selectedMemory.value + '')
|
|
160
|
+
if (!validValue) {
|
|
161
|
+
return localization.value.inputContainsInvalidCharacters
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const maxMemoryInGb = $binary.mbToGb(props.maxMemory)
|
|
165
|
+
if (memoryInMb.value < minMemoryInMb || memoryInMb.value > props.maxMemory) {
|
|
166
|
+
return localization.value.memoryMustBe
|
|
167
|
+
.replace('{0}', `${minMemoryInMb} ${localization.value.mb}`)
|
|
168
|
+
.replace('{1}', `${maxMemoryInGb} ${localization.value.gb}`)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (memoryInMb.value % 2 !== 0) {
|
|
172
|
+
return localization.value.valueShouldMultiple.replace(
|
|
173
|
+
'{0}',
|
|
174
|
+
`${2} ${localization.value.mb}`
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
return ''
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
const apiErrorLocal = computed<string>(() => {
|
|
181
|
+
return (
|
|
182
|
+
props.errorValidationFields?.find(
|
|
183
|
+
(message) => message.field === 'memory.size_mb'
|
|
184
|
+
)?.error_message || ''
|
|
185
|
+
)
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
const memorySizeLocalAndApiErrorsTexts = computed<string>(() => {
|
|
189
|
+
const localError = memoryErrorLocalText.value
|
|
190
|
+
const apiError = apiErrorLocal.value
|
|
191
|
+
|
|
192
|
+
let result = ''
|
|
193
|
+
if (localError && !apiError) result = localError
|
|
194
|
+
if (apiError && !localError) result = apiError
|
|
195
|
+
if (localError && apiError) result = localError + ', ' + apiError
|
|
196
|
+
if (!localError && apiError) result = apiError
|
|
197
|
+
|
|
198
|
+
return result
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
const reservationInvalid = ref<boolean>(false)
|
|
202
|
+
const limitInvalid = ref<boolean>(false)
|
|
203
|
+
const memoryInvalid = computed<boolean>(
|
|
204
|
+
() =>
|
|
205
|
+
!!memorySizeLocalAndApiErrorsTexts.value ||
|
|
206
|
+
reservationInvalid.value ||
|
|
207
|
+
limitInvalid.value
|
|
208
|
+
)
|
|
209
|
+
watch(
|
|
210
|
+
memoryInvalid,
|
|
211
|
+
(newValue) => {
|
|
212
|
+
emits('invalid', newValue)
|
|
213
|
+
},
|
|
214
|
+
{ immediate: true }
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
const reservation = ref<string>('2')
|
|
218
|
+
const reservationType = ref<string>('mb')
|
|
219
|
+
const reserveGuestMemory = ref<boolean>(false)
|
|
220
|
+
|
|
221
|
+
const limit = ref<string>('Unlimited')
|
|
222
|
+
const limitType = ref<string>('mb')
|
|
223
|
+
const limitOptions = computed<UI_I_OptionItem[] | undefined>(() => {
|
|
224
|
+
if (memoryHotPlug.value)
|
|
225
|
+
return memoryOptionsFunc(
|
|
226
|
+
localization.value,
|
|
227
|
+
memoryInMb.value,
|
|
228
|
+
props.maxMemory
|
|
229
|
+
)
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
const memoryHotPlug = ref<boolean>(false)
|
|
233
|
+
const isDisabledMemoryHotPlug = computed<boolean>(
|
|
234
|
+
() => memoryInMb.value >= props.maxMemory || isDisabled.value
|
|
235
|
+
)
|
|
236
|
+
watch(isDisabledMemoryHotPlug, (newValue) => {
|
|
237
|
+
if (newValue) memoryHotPlug.value = false
|
|
238
|
+
})
|
|
239
|
+
|
|
240
|
+
watch(
|
|
241
|
+
[memoryInMb, memoryHotPlug, reservation, reservationType, limit],
|
|
242
|
+
() => {
|
|
243
|
+
const reservationInMb =
|
|
244
|
+
reservationType.value === 'mb'
|
|
245
|
+
? reservation.value
|
|
246
|
+
: '' +
|
|
247
|
+
$binary.universalFromTo(
|
|
248
|
+
reservation.value,
|
|
249
|
+
reservationType.value,
|
|
250
|
+
'mb',
|
|
251
|
+
12
|
|
252
|
+
)
|
|
253
|
+
emits('send-data', {
|
|
254
|
+
memory: '' + memoryInMb.value,
|
|
255
|
+
hotplug: memoryHotPlug.value,
|
|
256
|
+
reservation_mb: reservationInMb,
|
|
257
|
+
limit_mb: limit.value,
|
|
258
|
+
})
|
|
259
|
+
},
|
|
260
|
+
{ immediate: true }
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
// Добавляем данные для редактирования
|
|
264
|
+
watch(
|
|
265
|
+
() => props.memory,
|
|
266
|
+
(newValue) => {
|
|
267
|
+
if (!newValue) return
|
|
268
|
+
|
|
269
|
+
selectedMemory.value = $binary.mbToGb(newValue.size_mb)
|
|
270
|
+
reservation.value = '' + newValue.reservation_mb
|
|
271
|
+
limit.value = '' + newValue.limit_mb
|
|
272
|
+
memoryHotPlug.value = newValue.hotplug
|
|
273
|
+
},
|
|
274
|
+
{ immediate: true }
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
const onRemoveValidationError = (): void => {
|
|
278
|
+
emits('remove-error-by-title', 'memory.size_mb')
|
|
279
|
+
}
|
|
280
|
+
</script>
|
|
281
|
+
|
|
282
|
+
<style scoped lang="scss"></style>
|
package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/Location.vue
CHANGED
|
@@ -96,18 +96,18 @@ const locationOptions = ref<UI_I_OptionItem[]>([])
|
|
|
96
96
|
|
|
97
97
|
watch(
|
|
98
98
|
() => props.location,
|
|
99
|
-
(
|
|
100
|
-
if (locationOptions.value.length || !
|
|
99
|
+
(newValue) => {
|
|
100
|
+
if (locationOptions.value.length || !newValue) {
|
|
101
101
|
return
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
locationOptions.value = [
|
|
105
|
-
{ text: localization.value.storeWithVirtualMachine, value:
|
|
105
|
+
{ text: localization.value.storeWithVirtualMachine, value: newValue.id },
|
|
106
106
|
{ text: `${localization.value.browse}...`, value: -1 },
|
|
107
107
|
]
|
|
108
|
-
selectedLocation.value =
|
|
109
|
-
storages.value.push(
|
|
110
|
-
addStorage(
|
|
108
|
+
selectedLocation.value = newValue.id
|
|
109
|
+
storages.value.push(newValue)
|
|
110
|
+
addStorage(newValue)
|
|
111
111
|
},
|
|
112
112
|
{ immediate: true }
|
|
113
113
|
)
|
|
@@ -133,15 +133,15 @@ const changeStorage = (storage: UI_I_DatastoreTableItem): void => {
|
|
|
133
133
|
const onHideStorageModal = (): void => {
|
|
134
134
|
storageModalIsShow.value = false
|
|
135
135
|
}
|
|
136
|
-
const changeLocation = (
|
|
137
|
-
const value = +
|
|
136
|
+
const changeLocation = (event: UI_I_HTMLSelectElement): void => {
|
|
137
|
+
const value = +event.target.value
|
|
138
138
|
if (value === -1) {
|
|
139
139
|
storageModalIsShow.value = true
|
|
140
140
|
return
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
selectedLocation.value =
|
|
144
|
-
const storage = storages.value.find((item) => item.id ===
|
|
143
|
+
selectedLocation.value = event.target.value
|
|
144
|
+
const storage = storages.value.find((item) => item.id === event.target.value)
|
|
145
145
|
storage && emits('change', storage)
|
|
146
146
|
}
|
|
147
147
|
|