bfg-common 1.2.19 → 1.2.21
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/datepicker/Datepicker.vue +612 -612
- package/components/atoms/list/SelectList.vue +62 -62
- 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 +206 -206
- package/components/atoms/table/dataGrid/DataGridPage.vue +189 -189
- package/components/atoms/tabs/Tabs.vue +189 -189
- package/components/atoms/tooltip/Signpost.vue +224 -224
- package/components/common/BadBrowser.vue +58 -0
- 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/Diagram.vue +186 -186
- package/components/common/diagramMain/DiagramMain.vue +986 -986
- package/components/common/diagramMain/adapter/AdapterItem.vue +227 -227
- package/components/common/diagramMain/adapter/AdapterItems.vue +57 -57
- 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/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/help/navbar/left/Left.vue +159 -159
- package/components/common/help/navbar/left/utils/constructAccordion.ts +27 -27
- package/components/common/mainNavigationPanel/MainNavigationPanel.vue +359 -359
- package/components/common/modals/Rename.vue +165 -165
- package/components/common/perPage/PerPage.vue +51 -51
- package/components/common/recursionTree/RecursionTree.vue +201 -201
- package/components/common/vm/actions/add/config/capabilities.ts +338 -338
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/VirtualHardware.vue +657 -657
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/CoresPerSocket.vue +109 -109
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/Cpu.vue +383 -383
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/Limit.vue +234 -234
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/config/options.ts +28 -28
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/Memory.vue +316 -316
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/memory/config/memoryOptions.ts +35 -35
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +445 -445
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +288 -288
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/reservation/Reservation.vue +235 -235
- package/components/common/vm/actions/add/customizeHardware/virtualHardware/videoCard/VideoCard.vue +177 -177
- package/components/common/vm/actions/add/customizeHardware/vmoptions/bootOptions/order/Order.vue +197 -197
- package/components/common/vm/actions/add/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +181 -181
- package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/CopyPaste.vue +51 -51
- package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/RemoteConsoleOptions.vue +253 -253
- package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +55 -55
- package/components/common/vm/actions/add/select/storage/config/config.ts +154 -154
- package/components/common/vm/actions/clone/Clone.vue +544 -544
- package/components/common/vm/actions/clone/select/options/Options.vue +65 -65
- package/components/common/vm/actions/clone/utils.ts +43 -43
- 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/composables/useLocal.ts +38 -38
- package/minify.js +146 -146
- package/models/store/interfaces.ts +37 -37
- package/models/store/storage/interfaces.ts +32 -32
- package/models/store/types.ts +32 -32
- package/modules/fixContentBuild/utils/methods.ts +114 -114
- package/package.json +1 -1
- package/public/spice-console/application/codec.js +257 -257
- package/public/spice-console/lib/rasterEngine.js +907 -907
- package/public/spice-console/network/spicechannel.js +369 -369
- package/utils/contentBuild.ts +34 -34
|
@@ -1,234 +1,234 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="">
|
|
3
|
-
<atoms-stack-block :has-children="false">
|
|
4
|
-
<template #stackBlockKey>
|
|
5
|
-
{{ localization.limit }}
|
|
6
|
-
</template>
|
|
7
|
-
<template #stackBlockContent>
|
|
8
|
-
<div class="flex-align-center">
|
|
9
|
-
<div class="tooltip-top-left combobox-container flex-align-center">
|
|
10
|
-
<atoms-tooltip-error
|
|
11
|
-
:has-error="!!limitLocalAndApiErrorsTexts"
|
|
12
|
-
:selector="`#vm-wizard-${props.componentType}-limit input`"
|
|
13
|
-
@remove="onRemoveValidationError"
|
|
14
|
-
>
|
|
15
|
-
<template #elem>
|
|
16
|
-
<atoms-combobox
|
|
17
|
-
:id="`vm-wizard-${props.componentType}-limit`"
|
|
18
|
-
v-model="limitLocalByLocalization"
|
|
19
|
-
:items="limitOptionsLocal"
|
|
20
|
-
:disabled="props.disabled"
|
|
21
|
-
@click.stop
|
|
22
|
-
@select="onSelectLimit"
|
|
23
|
-
/>
|
|
24
|
-
</template>
|
|
25
|
-
<template #content>{{ limitLocalAndApiErrorsTexts }}</template>
|
|
26
|
-
</atoms-tooltip-error>
|
|
27
|
-
</div>
|
|
28
|
-
<div class="select">
|
|
29
|
-
<select
|
|
30
|
-
id="vm-wizard-limit-type-select"
|
|
31
|
-
v-model="limitTypeLocal"
|
|
32
|
-
:disabled="props.disabled"
|
|
33
|
-
>
|
|
34
|
-
<option
|
|
35
|
-
v-for="(item, key) in limitTypeOptions"
|
|
36
|
-
:key="key"
|
|
37
|
-
:value="item.value"
|
|
38
|
-
>
|
|
39
|
-
{{ item.text }}
|
|
40
|
-
</option>
|
|
41
|
-
</select>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</template>
|
|
45
|
-
</atoms-stack-block>
|
|
46
|
-
</div>
|
|
47
|
-
</template>
|
|
48
|
-
|
|
49
|
-
<script setup lang="ts">
|
|
50
|
-
import {
|
|
51
|
-
limitOptionsFunc,
|
|
52
|
-
limitTypeOptionsFunc,
|
|
53
|
-
} from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/config/options'
|
|
54
|
-
import { UI_I_Localization } from '~/models/interfaces'
|
|
55
|
-
import { UI_I_ErrorValidationField } from '~/models/store/interfaces'
|
|
56
|
-
import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
|
|
57
|
-
|
|
58
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
59
|
-
|
|
60
|
-
const props = withDefaults(
|
|
61
|
-
defineProps<{
|
|
62
|
-
limit: string
|
|
63
|
-
limitType: string
|
|
64
|
-
type: 'mb' | 'mhz'
|
|
65
|
-
componentType: string
|
|
66
|
-
errorValidationFields: UI_I_ErrorValidationField<string>[]
|
|
67
|
-
disabled?: boolean
|
|
68
|
-
limitOptions?: UI_I_OptionItem[]
|
|
69
|
-
multiply?: number
|
|
70
|
-
}>(),
|
|
71
|
-
{
|
|
72
|
-
limitOptions: undefined,
|
|
73
|
-
multiply: 1,
|
|
74
|
-
}
|
|
75
|
-
)
|
|
76
|
-
const emits = defineEmits<{
|
|
77
|
-
(event: 'update:limit', value: string): void
|
|
78
|
-
(event: 'update:limit-type', value: string): void
|
|
79
|
-
(event: 'invalid', value: boolean): void
|
|
80
|
-
(event: 'remove-error-by-title', value: string): void
|
|
81
|
-
}>()
|
|
82
|
-
|
|
83
|
-
const typeError = computed<string>(() => `${props.componentType}.limit_mb`)
|
|
84
|
-
|
|
85
|
-
const apiErrorLocal = computed<string>(() => {
|
|
86
|
-
return (
|
|
87
|
-
props.errorValidationFields?.find(
|
|
88
|
-
(message) => message.field === typeError.value
|
|
89
|
-
)?.error_message || ''
|
|
90
|
-
)
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
const binaryKeys: [string, string] =
|
|
94
|
-
props.type === 'mb' ? ['mb', 'gb'] : ['mhz', 'ghz']
|
|
95
|
-
|
|
96
|
-
const limitOptionsLocal = computed<UI_I_OptionItem[]>(
|
|
97
|
-
() => props.limitOptions || limitOptionsFunc(localization.value, binaryKeys)
|
|
98
|
-
)
|
|
99
|
-
const limitTypeOptions = ref<UI_I_OptionItem[]>(
|
|
100
|
-
limitTypeOptionsFunc(localization.value, binaryKeys)
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
const limitLocalByLocalization = computed<string>({
|
|
104
|
-
get() {
|
|
105
|
-
return limitLocal.value === 'Unlimited'
|
|
106
|
-
? localization.value.unlimited
|
|
107
|
-
: limitLocal.value
|
|
108
|
-
},
|
|
109
|
-
set(newValue) {
|
|
110
|
-
limitLocal.value =
|
|
111
|
-
newValue === localization.value.unlimited ? 'Unlimited' : newValue
|
|
112
|
-
},
|
|
113
|
-
})
|
|
114
|
-
const limitLocal = computed<string>({
|
|
115
|
-
get() {
|
|
116
|
-
return props.limit
|
|
117
|
-
},
|
|
118
|
-
set(newValue) {
|
|
119
|
-
emits('update:limit', '' + newValue)
|
|
120
|
-
},
|
|
121
|
-
})
|
|
122
|
-
const limitTypeLocal = computed<string>({
|
|
123
|
-
get() {
|
|
124
|
-
return props.limitType
|
|
125
|
-
},
|
|
126
|
-
set(newValue) {
|
|
127
|
-
emits('update:limit-type', newValue)
|
|
128
|
-
},
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
const { $binary } = useNuxtApp()
|
|
132
|
-
const onSelectLimit = ({
|
|
133
|
-
value,
|
|
134
|
-
type,
|
|
135
|
-
}: {
|
|
136
|
-
value: number | 'Unlimited'
|
|
137
|
-
type: string
|
|
138
|
-
}): void => {
|
|
139
|
-
limitLocal.value = '' + value
|
|
140
|
-
if (limitTypeLocal.value !== type) {
|
|
141
|
-
limitTypeLocal.value = type
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// if (limitTypeLocal.value === binaryKeys[0] || value === 'Unlimited') {
|
|
145
|
-
// limitLocal.value = '' + value
|
|
146
|
-
// return
|
|
147
|
-
// }
|
|
148
|
-
//
|
|
149
|
-
// limitLocal.value =
|
|
150
|
-
// '' + $binary.universalFromTo(value, binaryKeys[0], binaryKeys[1], 8)
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
const limitErrorLocalText = computed<string>(() => {
|
|
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(
|
|
161
|
-
+limitLocal.value,
|
|
162
|
-
limitTypeLocal.value,
|
|
163
|
-
limitOptionsLocal.value[1].value.type,
|
|
164
|
-
0
|
|
165
|
-
)
|
|
166
|
-
const minValue = limitOptionsLocal.value[0].value.value
|
|
167
|
-
const maxValue = limitOptionsLocal.value[1].value.value
|
|
168
|
-
if (valueForMin < minValue) {
|
|
169
|
-
return localization.value.limitMustBe.replace(
|
|
170
|
-
'{0}',
|
|
171
|
-
`${minValue} ${localization.value[binaryKeys[0]]}`
|
|
172
|
-
)
|
|
173
|
-
}
|
|
174
|
-
if (props.limitOptions && valueForMax > maxValue) {
|
|
175
|
-
return localization.value.limitMustBeMax.replace(
|
|
176
|
-
'{0}',
|
|
177
|
-
`${maxValue} ${localization.value[binaryKeys[0]]}`
|
|
178
|
-
)
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const validValue = /^\d+(\.\d+)?$/.test(limitLocal.value)
|
|
182
|
-
if (
|
|
183
|
-
!validValue &&
|
|
184
|
-
(limitLocal.value !== limitOptionsLocal.value[1].value.value ||
|
|
185
|
-
props.limitOptions)
|
|
186
|
-
) {
|
|
187
|
-
return localization.value.inputContainsInvalidCharacters
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (limitLocal.value !== 'Unlimited') {
|
|
191
|
-
const value = $binary.universalFromTo(
|
|
192
|
-
+limitLocal.value,
|
|
193
|
-
limitTypeLocal.value,
|
|
194
|
-
binaryKeys[0],
|
|
195
|
-
0
|
|
196
|
-
)
|
|
197
|
-
if (value % props.multiply !== 0) {
|
|
198
|
-
return localization.value.valueShouldMultiple.replace(
|
|
199
|
-
'{0}',
|
|
200
|
-
`${props.multiply} ${binaryKeys[0].toUpperCase()}`
|
|
201
|
-
)
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
return ''
|
|
206
|
-
})
|
|
207
|
-
const limitInvalid = computed<boolean>(() => !!limitErrorLocalText.value)
|
|
208
|
-
watch(
|
|
209
|
-
limitInvalid,
|
|
210
|
-
(newValue) => {
|
|
211
|
-
emits('invalid', newValue)
|
|
212
|
-
},
|
|
213
|
-
{ immediate: true }
|
|
214
|
-
)
|
|
215
|
-
|
|
216
|
-
const limitLocalAndApiErrorsTexts = computed<string>(() => {
|
|
217
|
-
const localError = limitErrorLocalText.value
|
|
218
|
-
const apiError = apiErrorLocal.value
|
|
219
|
-
|
|
220
|
-
let result = ''
|
|
221
|
-
if (localError && !apiError) result = localError
|
|
222
|
-
if (!localError && apiError) result = apiError
|
|
223
|
-
if (localError && apiError) result = localError + ', ' + apiError
|
|
224
|
-
if (!localError && apiError) result = apiError
|
|
225
|
-
|
|
226
|
-
return result
|
|
227
|
-
})
|
|
228
|
-
|
|
229
|
-
const onRemoveValidationError = (): void => {
|
|
230
|
-
emits('remove-error-by-title', typeError.value)
|
|
231
|
-
}
|
|
232
|
-
</script>
|
|
233
|
-
|
|
234
|
-
<style scoped></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="">
|
|
3
|
+
<atoms-stack-block :has-children="false">
|
|
4
|
+
<template #stackBlockKey>
|
|
5
|
+
{{ localization.limit }}
|
|
6
|
+
</template>
|
|
7
|
+
<template #stackBlockContent>
|
|
8
|
+
<div class="flex-align-center">
|
|
9
|
+
<div class="tooltip-top-left combobox-container flex-align-center">
|
|
10
|
+
<atoms-tooltip-error
|
|
11
|
+
:has-error="!!limitLocalAndApiErrorsTexts"
|
|
12
|
+
:selector="`#vm-wizard-${props.componentType}-limit input`"
|
|
13
|
+
@remove="onRemoveValidationError"
|
|
14
|
+
>
|
|
15
|
+
<template #elem>
|
|
16
|
+
<atoms-combobox
|
|
17
|
+
:id="`vm-wizard-${props.componentType}-limit`"
|
|
18
|
+
v-model="limitLocalByLocalization"
|
|
19
|
+
:items="limitOptionsLocal"
|
|
20
|
+
:disabled="props.disabled"
|
|
21
|
+
@click.stop
|
|
22
|
+
@select="onSelectLimit"
|
|
23
|
+
/>
|
|
24
|
+
</template>
|
|
25
|
+
<template #content>{{ limitLocalAndApiErrorsTexts }}</template>
|
|
26
|
+
</atoms-tooltip-error>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="select">
|
|
29
|
+
<select
|
|
30
|
+
id="vm-wizard-limit-type-select"
|
|
31
|
+
v-model="limitTypeLocal"
|
|
32
|
+
:disabled="props.disabled"
|
|
33
|
+
>
|
|
34
|
+
<option
|
|
35
|
+
v-for="(item, key) in limitTypeOptions"
|
|
36
|
+
:key="key"
|
|
37
|
+
:value="item.value"
|
|
38
|
+
>
|
|
39
|
+
{{ item.text }}
|
|
40
|
+
</option>
|
|
41
|
+
</select>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
</atoms-stack-block>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script setup lang="ts">
|
|
50
|
+
import {
|
|
51
|
+
limitOptionsFunc,
|
|
52
|
+
limitTypeOptionsFunc,
|
|
53
|
+
} from '~/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/config/options'
|
|
54
|
+
import { UI_I_Localization } from '~/models/interfaces'
|
|
55
|
+
import { UI_I_ErrorValidationField } from '~/models/store/interfaces'
|
|
56
|
+
import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
|
|
57
|
+
|
|
58
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
59
|
+
|
|
60
|
+
const props = withDefaults(
|
|
61
|
+
defineProps<{
|
|
62
|
+
limit: string
|
|
63
|
+
limitType: string
|
|
64
|
+
type: 'mb' | 'mhz'
|
|
65
|
+
componentType: string
|
|
66
|
+
errorValidationFields: UI_I_ErrorValidationField<string>[]
|
|
67
|
+
disabled?: boolean
|
|
68
|
+
limitOptions?: UI_I_OptionItem[]
|
|
69
|
+
multiply?: number
|
|
70
|
+
}>(),
|
|
71
|
+
{
|
|
72
|
+
limitOptions: undefined,
|
|
73
|
+
multiply: 1,
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
const emits = defineEmits<{
|
|
77
|
+
(event: 'update:limit', value: string): void
|
|
78
|
+
(event: 'update:limit-type', value: string): void
|
|
79
|
+
(event: 'invalid', value: boolean): void
|
|
80
|
+
(event: 'remove-error-by-title', value: string): void
|
|
81
|
+
}>()
|
|
82
|
+
|
|
83
|
+
const typeError = computed<string>(() => `${props.componentType}.limit_mb`)
|
|
84
|
+
|
|
85
|
+
const apiErrorLocal = computed<string>(() => {
|
|
86
|
+
return (
|
|
87
|
+
props.errorValidationFields?.find(
|
|
88
|
+
(message) => message.field === typeError.value
|
|
89
|
+
)?.error_message || ''
|
|
90
|
+
)
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
const binaryKeys: [string, string] =
|
|
94
|
+
props.type === 'mb' ? ['mb', 'gb'] : ['mhz', 'ghz']
|
|
95
|
+
|
|
96
|
+
const limitOptionsLocal = computed<UI_I_OptionItem[]>(
|
|
97
|
+
() => props.limitOptions || limitOptionsFunc(localization.value, binaryKeys)
|
|
98
|
+
)
|
|
99
|
+
const limitTypeOptions = ref<UI_I_OptionItem[]>(
|
|
100
|
+
limitTypeOptionsFunc(localization.value, binaryKeys)
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
const limitLocalByLocalization = computed<string>({
|
|
104
|
+
get() {
|
|
105
|
+
return limitLocal.value === 'Unlimited'
|
|
106
|
+
? localization.value.unlimited
|
|
107
|
+
: limitLocal.value
|
|
108
|
+
},
|
|
109
|
+
set(newValue) {
|
|
110
|
+
limitLocal.value =
|
|
111
|
+
newValue === localization.value.unlimited ? 'Unlimited' : newValue
|
|
112
|
+
},
|
|
113
|
+
})
|
|
114
|
+
const limitLocal = computed<string>({
|
|
115
|
+
get() {
|
|
116
|
+
return props.limit
|
|
117
|
+
},
|
|
118
|
+
set(newValue) {
|
|
119
|
+
emits('update:limit', '' + newValue)
|
|
120
|
+
},
|
|
121
|
+
})
|
|
122
|
+
const limitTypeLocal = computed<string>({
|
|
123
|
+
get() {
|
|
124
|
+
return props.limitType
|
|
125
|
+
},
|
|
126
|
+
set(newValue) {
|
|
127
|
+
emits('update:limit-type', newValue)
|
|
128
|
+
},
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
const { $binary } = useNuxtApp()
|
|
132
|
+
const onSelectLimit = ({
|
|
133
|
+
value,
|
|
134
|
+
type,
|
|
135
|
+
}: {
|
|
136
|
+
value: number | 'Unlimited'
|
|
137
|
+
type: string
|
|
138
|
+
}): void => {
|
|
139
|
+
limitLocal.value = '' + value
|
|
140
|
+
if (limitTypeLocal.value !== type) {
|
|
141
|
+
limitTypeLocal.value = type
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// if (limitTypeLocal.value === binaryKeys[0] || value === 'Unlimited') {
|
|
145
|
+
// limitLocal.value = '' + value
|
|
146
|
+
// return
|
|
147
|
+
// }
|
|
148
|
+
//
|
|
149
|
+
// limitLocal.value =
|
|
150
|
+
// '' + $binary.universalFromTo(value, binaryKeys[0], binaryKeys[1], 8)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const limitErrorLocalText = computed<string>(() => {
|
|
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(
|
|
161
|
+
+limitLocal.value,
|
|
162
|
+
limitTypeLocal.value,
|
|
163
|
+
limitOptionsLocal.value[1].value.type,
|
|
164
|
+
0
|
|
165
|
+
)
|
|
166
|
+
const minValue = limitOptionsLocal.value[0].value.value
|
|
167
|
+
const maxValue = limitOptionsLocal.value[1].value.value
|
|
168
|
+
if (valueForMin < minValue) {
|
|
169
|
+
return localization.value.limitMustBe.replace(
|
|
170
|
+
'{0}',
|
|
171
|
+
`${minValue} ${localization.value[binaryKeys[0]]}`
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
if (props.limitOptions && valueForMax > maxValue) {
|
|
175
|
+
return localization.value.limitMustBeMax.replace(
|
|
176
|
+
'{0}',
|
|
177
|
+
`${maxValue} ${localization.value[binaryKeys[0]]}`
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const validValue = /^\d+(\.\d+)?$/.test(limitLocal.value)
|
|
182
|
+
if (
|
|
183
|
+
!validValue &&
|
|
184
|
+
(limitLocal.value !== limitOptionsLocal.value[1].value.value ||
|
|
185
|
+
props.limitOptions)
|
|
186
|
+
) {
|
|
187
|
+
return localization.value.inputContainsInvalidCharacters
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (limitLocal.value !== 'Unlimited') {
|
|
191
|
+
const value = $binary.universalFromTo(
|
|
192
|
+
+limitLocal.value,
|
|
193
|
+
limitTypeLocal.value,
|
|
194
|
+
binaryKeys[0],
|
|
195
|
+
0
|
|
196
|
+
)
|
|
197
|
+
if (value % props.multiply !== 0) {
|
|
198
|
+
return localization.value.valueShouldMultiple.replace(
|
|
199
|
+
'{0}',
|
|
200
|
+
`${props.multiply} ${binaryKeys[0].toUpperCase()}`
|
|
201
|
+
)
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return ''
|
|
206
|
+
})
|
|
207
|
+
const limitInvalid = computed<boolean>(() => !!limitErrorLocalText.value)
|
|
208
|
+
watch(
|
|
209
|
+
limitInvalid,
|
|
210
|
+
(newValue) => {
|
|
211
|
+
emits('invalid', newValue)
|
|
212
|
+
},
|
|
213
|
+
{ immediate: true }
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
const limitLocalAndApiErrorsTexts = computed<string>(() => {
|
|
217
|
+
const localError = limitErrorLocalText.value
|
|
218
|
+
const apiError = apiErrorLocal.value
|
|
219
|
+
|
|
220
|
+
let result = ''
|
|
221
|
+
if (localError && !apiError) result = localError
|
|
222
|
+
if (!localError && apiError) result = apiError
|
|
223
|
+
if (localError && apiError) result = localError + ', ' + apiError
|
|
224
|
+
if (!localError && apiError) result = apiError
|
|
225
|
+
|
|
226
|
+
return result
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
const onRemoveValidationError = (): void => {
|
|
230
|
+
emits('remove-error-by-title', typeError.value)
|
|
231
|
+
}
|
|
232
|
+
</script>
|
|
233
|
+
|
|
234
|
+
<style scoped></style>
|
package/components/common/vm/actions/add/customizeHardware/virtualHardware/limit/config/options.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { UI_I_Localization } from '~/models/interfaces'
|
|
2
|
-
import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
|
|
3
|
-
|
|
4
|
-
export const limitOptionsFunc = (
|
|
5
|
-
localization: UI_I_Localization,
|
|
6
|
-
binaryKeys: [string, string]
|
|
7
|
-
): UI_I_OptionItem[] => {
|
|
8
|
-
return [
|
|
9
|
-
{
|
|
10
|
-
text: `${localization.minimum}: 0 ${localization[binaryKeys[0]]}`,
|
|
11
|
-
value: { value: 0, type: binaryKeys[0] },
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
text: `${localization.maximum}: ${localization.unlimited}`,
|
|
15
|
-
value: { value: 'Unlimited', type: binaryKeys[0] },
|
|
16
|
-
},
|
|
17
|
-
]
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const limitTypeOptionsFunc = (
|
|
21
|
-
localization: UI_I_Localization,
|
|
22
|
-
binaryKeys: [string, string]
|
|
23
|
-
): UI_I_OptionItem[] => {
|
|
24
|
-
return [
|
|
25
|
-
{ text: localization[binaryKeys[0]], value: binaryKeys[0] },
|
|
26
|
-
{ text: localization[binaryKeys[1]], value: binaryKeys[1] },
|
|
27
|
-
]
|
|
28
|
-
}
|
|
1
|
+
import { UI_I_Localization } from '~/models/interfaces'
|
|
2
|
+
import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
|
|
3
|
+
|
|
4
|
+
export const limitOptionsFunc = (
|
|
5
|
+
localization: UI_I_Localization,
|
|
6
|
+
binaryKeys: [string, string]
|
|
7
|
+
): UI_I_OptionItem[] => {
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
text: `${localization.minimum}: 0 ${localization[binaryKeys[0]]}`,
|
|
11
|
+
value: { value: 0, type: binaryKeys[0] },
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
text: `${localization.maximum}: ${localization.unlimited}`,
|
|
15
|
+
value: { value: 'Unlimited', type: binaryKeys[0] },
|
|
16
|
+
},
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const limitTypeOptionsFunc = (
|
|
21
|
+
localization: UI_I_Localization,
|
|
22
|
+
binaryKeys: [string, string]
|
|
23
|
+
): UI_I_OptionItem[] => {
|
|
24
|
+
return [
|
|
25
|
+
{ text: localization[binaryKeys[0]], value: binaryKeys[0] },
|
|
26
|
+
{ text: localization[binaryKeys[1]], value: binaryKeys[1] },
|
|
27
|
+
]
|
|
28
|
+
}
|