bfg-common 1.1.52 → 1.1.53
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/limit/Limit.vue +28 -21
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/config/options.ts +2 -2
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/Memory.vue +26 -9
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/config/memoryOptions.ts +8 -5
- package/package.json +1 -1
|
@@ -66,9 +66,11 @@ const props = withDefaults(
|
|
|
66
66
|
errorValidationFields: UI_I_ErrorValidationField<string>[]
|
|
67
67
|
disabled?: boolean
|
|
68
68
|
limitOptions?: UI_I_OptionItem[]
|
|
69
|
+
multiply?: number
|
|
69
70
|
}>(),
|
|
70
71
|
{
|
|
71
72
|
limitOptions: undefined,
|
|
73
|
+
multiply: 1,
|
|
72
74
|
}
|
|
73
75
|
)
|
|
74
76
|
const emits = defineEmits<{
|
|
@@ -111,24 +113,10 @@ const limitLocalByLocalization = computed<string>({
|
|
|
111
113
|
})
|
|
112
114
|
const limitLocal = computed<string>({
|
|
113
115
|
get() {
|
|
114
|
-
return
|
|
115
|
-
props.limit,
|
|
116
|
-
binaryKeys[0],
|
|
117
|
-
limitTypeLocal.value,
|
|
118
|
-
8
|
|
119
|
-
)
|
|
116
|
+
return props.limit
|
|
120
117
|
},
|
|
121
118
|
set(newValue) {
|
|
122
|
-
emits(
|
|
123
|
-
'update:limit',
|
|
124
|
-
'' +
|
|
125
|
-
$binary.universalFromTo(
|
|
126
|
-
newValue,
|
|
127
|
-
limitTypeLocal.value,
|
|
128
|
-
binaryKeys[0],
|
|
129
|
-
8
|
|
130
|
-
)
|
|
131
|
-
)
|
|
119
|
+
emits('update:limit', '' + newValue)
|
|
132
120
|
},
|
|
133
121
|
})
|
|
134
122
|
const limitTypeLocal = computed<string>({
|
|
@@ -163,21 +151,27 @@ const onSelectLimit = ({
|
|
|
163
151
|
}
|
|
164
152
|
|
|
165
153
|
const limitErrorLocalText = computed<string>(() => {
|
|
166
|
-
const
|
|
154
|
+
const valueForMin = $binary.universalFromTo(
|
|
155
|
+
+limitLocal.value,
|
|
156
|
+
limitTypeLocal.value,
|
|
157
|
+
limitOptionsLocal.value[0].value.type,
|
|
158
|
+
0
|
|
159
|
+
)
|
|
160
|
+
const valueForMax = $binary.universalFromTo(
|
|
167
161
|
+limitLocal.value,
|
|
168
162
|
limitTypeLocal.value,
|
|
169
|
-
|
|
170
|
-
|
|
163
|
+
limitOptionsLocal.value[1].value.type,
|
|
164
|
+
0
|
|
171
165
|
)
|
|
172
166
|
const minValue = limitOptionsLocal.value[0].value.value
|
|
173
167
|
const maxValue = limitOptionsLocal.value[1].value.value
|
|
174
|
-
if (
|
|
168
|
+
if (valueForMin < minValue) {
|
|
175
169
|
return localization.value.limitMustBe.replace(
|
|
176
170
|
'{0}',
|
|
177
171
|
`${minValue} ${localization.value[binaryKeys[0]]}`
|
|
178
172
|
)
|
|
179
173
|
}
|
|
180
|
-
if (props.limitOptions &&
|
|
174
|
+
if (props.limitOptions && valueForMax > maxValue) {
|
|
181
175
|
return localization.value.limitMustBeMax.replace(
|
|
182
176
|
'{0}',
|
|
183
177
|
`${maxValue} ${localization.value[binaryKeys[0]]}`
|
|
@@ -193,6 +187,19 @@ const limitErrorLocalText = computed<string>(() => {
|
|
|
193
187
|
return localization.value.inputContainsInvalidCharacters
|
|
194
188
|
}
|
|
195
189
|
|
|
190
|
+
const value = $binary.universalFromTo(
|
|
191
|
+
+limitLocal.value,
|
|
192
|
+
limitTypeLocal.value,
|
|
193
|
+
binaryKeys[0],
|
|
194
|
+
0
|
|
195
|
+
)
|
|
196
|
+
if (value % props.multiply !== 0) {
|
|
197
|
+
return localization.value.valueShouldMultiple.replace(
|
|
198
|
+
'{0}',
|
|
199
|
+
`${props.multiply} ${binaryKeys[0].toUpperCase()}`
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
|
|
196
203
|
return ''
|
|
197
204
|
})
|
|
198
205
|
const limitInvalid = computed<boolean>(() => !!limitErrorLocalText.value)
|
package/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/config/options.ts
CHANGED
|
@@ -8,11 +8,11 @@ export const limitOptionsFunc = (
|
|
|
8
8
|
return [
|
|
9
9
|
{
|
|
10
10
|
text: `${localization.minimum}: 0 ${localization[binaryKeys[0]]}`,
|
|
11
|
-
value: { value: 0, type:
|
|
11
|
+
value: { value: 0, type: binaryKeys[0] },
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
text: `${localization.maximum}: ${localization.unlimited}`,
|
|
15
|
-
value: { value: 'Unlimited', type:
|
|
15
|
+
value: { value: 'Unlimited', type: binaryKeys[0] },
|
|
16
16
|
},
|
|
17
17
|
]
|
|
18
18
|
}
|
package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/Memory.vue
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
:disabled="isMemoryDisabled"
|
|
29
29
|
class="input-text-color"
|
|
30
30
|
@click.stop
|
|
31
|
-
@select="
|
|
31
|
+
@select="onSelectMemory"
|
|
32
32
|
/>
|
|
33
33
|
</template>
|
|
34
34
|
<template #content>{{ memorySizeLocalAndApiErrorsTexts }}</template>
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
v-model:limit-type="limitType"
|
|
72
72
|
:error-validation-fields="props.errorValidationFields"
|
|
73
73
|
:limit-options="limitOptions"
|
|
74
|
+
:multiply="2"
|
|
74
75
|
:disabled="isDisabled"
|
|
75
76
|
type="mb"
|
|
76
77
|
component-type="memory"
|
|
@@ -136,7 +137,8 @@ const isMemoryDisabled = computed<boolean>(
|
|
|
136
137
|
|
|
137
138
|
const selectedMemory = ref<number>(4)
|
|
138
139
|
watch(selectedMemory, (newValue) => {
|
|
139
|
-
|
|
140
|
+
const valueInt = parseInt('' + newValue)
|
|
141
|
+
selectedMemory.value = isNaN(valueInt) ? 0 : valueInt
|
|
140
142
|
})
|
|
141
143
|
const memoryType = ref<string>('gb')
|
|
142
144
|
const memoryTypeOptions = ref<UI_I_OptionItem[]>(
|
|
@@ -153,13 +155,23 @@ const memoryInMb = computed<number>(() => {
|
|
|
153
155
|
const memoryOptions = ref<UI_I_OptionItem[]>(
|
|
154
156
|
memoryOptionsFunc(localization.value, minMemoryInMb, props.maxMemory)
|
|
155
157
|
)
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
const onSelectMemory = ({
|
|
159
|
+
value,
|
|
160
|
+
type,
|
|
161
|
+
}: {
|
|
162
|
+
value: number
|
|
163
|
+
type: string
|
|
164
|
+
}): void => {
|
|
165
|
+
selectedMemory.value = value
|
|
166
|
+
if (memoryType.value !== type) {
|
|
167
|
+
memoryType.value = type
|
|
160
168
|
}
|
|
161
|
-
|
|
162
|
-
selectedMemory.value =
|
|
169
|
+
// if (memoryType.value === 'mb') {
|
|
170
|
+
// selectedMemory.value = mb
|
|
171
|
+
// return
|
|
172
|
+
// }
|
|
173
|
+
//
|
|
174
|
+
// selectedMemory.value = $binary.universalFromTo(mb, 'mb', memoryType.value, 12)
|
|
163
175
|
}
|
|
164
176
|
|
|
165
177
|
const memoryErrorLocalText = computed<string>(() => {
|
|
@@ -223,12 +235,17 @@ watch(
|
|
|
223
235
|
|
|
224
236
|
const reservation = ref<string>('2')
|
|
225
237
|
watch(reservation, (newValue) => {
|
|
226
|
-
|
|
238
|
+
const valueInt = parseInt('' + newValue)
|
|
239
|
+
reservation.value = isNaN(valueInt) ? '0' : '' + valueInt
|
|
227
240
|
})
|
|
228
241
|
const reservationType = ref<string>('mb')
|
|
229
242
|
const reserveGuestMemory = ref<boolean>(false)
|
|
230
243
|
|
|
231
244
|
const limit = ref<string>('Unlimited')
|
|
245
|
+
watch(limit, (newValue) => {
|
|
246
|
+
const valueInt = parseInt('' + newValue)
|
|
247
|
+
limit.value !== 'Unlimited' && (limit.value = isNaN(valueInt) ? '0' : '' + valueInt)
|
|
248
|
+
})
|
|
232
249
|
const limitType = ref<string>('mb')
|
|
233
250
|
const limitOptions = computed<UI_I_OptionItem[] | undefined>(() => {
|
|
234
251
|
if (memoryHotPlug.value)
|
|
@@ -7,17 +7,20 @@ export const memoryOptionsFunc = (
|
|
|
7
7
|
max: number
|
|
8
8
|
): UI_I_OptionItem[] => {
|
|
9
9
|
const { $binary } = useNuxtApp()
|
|
10
|
+
const minValueText = $binary.round(min)
|
|
11
|
+
const [value, type] = minValueText.split(' ')
|
|
12
|
+
const maxValue = $binary.mbToGb(max, 0)
|
|
13
|
+
|
|
10
14
|
return [
|
|
11
15
|
{
|
|
12
|
-
text: `${localization.minimum}: ${
|
|
13
|
-
|
|
14
|
-
value: { value: min, type: 'mb' },
|
|
16
|
+
text: `${localization.minimum}: ${minValueText}`,
|
|
17
|
+
value: { value: +value, type: type.toLowerCase() },
|
|
15
18
|
},
|
|
16
19
|
{
|
|
17
|
-
text: `${localization.maximum}: ${
|
|
20
|
+
text: `${localization.maximum}: ${maxValue} ${
|
|
18
21
|
localization.gb
|
|
19
22
|
}`,
|
|
20
|
-
value: { value:
|
|
23
|
+
value: { value: maxValue, type: 'gb' },
|
|
21
24
|
},
|
|
22
25
|
]
|
|
23
26
|
}
|