bfg-common 1.3.538 → 1.3.539
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.
|
@@ -42,8 +42,12 @@ export const checkValidityName = async (
|
|
|
42
42
|
return { valid: true, msg: null }
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export const validateNameAndGenerateDataId = (
|
|
46
|
-
|
|
45
|
+
export const validateNameAndGenerateDataId = (
|
|
46
|
+
name: string,
|
|
47
|
+
_errorMessage: string,
|
|
48
|
+
defaultDataId?: string
|
|
49
|
+
): string => {
|
|
50
|
+
let baseDataId = defaultDataId || 'storage-name-alert-error'
|
|
47
51
|
|
|
48
52
|
const patterns = [
|
|
49
53
|
{
|
|
@@ -55,14 +59,13 @@ export const validateNameAndGenerateDataId = (name: string, _errorMessage: strin
|
|
|
55
59
|
{
|
|
56
60
|
regex: /^.{3,64}$/,
|
|
57
61
|
error_message:
|
|
58
|
-
|
|
62
|
+
/invalid name length, must be between: \d+ and \d+ characters/,
|
|
59
63
|
suffix: '-invalid-name-length',
|
|
60
64
|
},
|
|
61
65
|
]
|
|
62
66
|
|
|
63
67
|
// Проверка error_message на соответствие шаблонам
|
|
64
68
|
|
|
65
|
-
|
|
66
69
|
for (const pattern of patterns) {
|
|
67
70
|
if (!pattern.regex.test(name)) {
|
|
68
71
|
return `${baseDataId}${pattern.suffix}`
|
package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/DeviceSelection.vue
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div class="device-selection">
|
|
3
3
|
<atoms-alert
|
|
4
4
|
v-show="errors.length"
|
|
5
|
-
test-id="
|
|
5
|
+
:test-id="errorAlertDataId"
|
|
6
6
|
status="alert-danger"
|
|
7
7
|
:items="errors"
|
|
8
8
|
@remove="onCloseAlertDanger"
|
|
@@ -119,6 +119,7 @@ import {
|
|
|
119
119
|
import { defaultFormFunc } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/config/defaultForm'
|
|
120
120
|
import { hostsOptionsFunc } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/config/selectOptions'
|
|
121
121
|
import { checkValidityName } from '~/components/common/wizards/datastore/add/lib/utils'
|
|
122
|
+
import { validateNameAndGenerateDataId } from '~/components/common/wizards/datastore/add/lib/utils'
|
|
122
123
|
|
|
123
124
|
const props = defineProps<{
|
|
124
125
|
mode: UI_T_WizardDatastoreMode
|
|
@@ -178,6 +179,7 @@ const onHideAlertInfo = (): void => {
|
|
|
178
179
|
}
|
|
179
180
|
|
|
180
181
|
const errors = ref<string[]>([])
|
|
182
|
+
const errorAlertDataId = ref<string>('')
|
|
181
183
|
const formErrors = ref<UI_I_ValidationTouchResult[]>([])
|
|
182
184
|
|
|
183
185
|
/* Lun disk table */
|
|
@@ -246,7 +248,14 @@ const showValidationErrors = (
|
|
|
246
248
|
errorText = '',
|
|
247
249
|
alert = false
|
|
248
250
|
): void => {
|
|
249
|
-
if (alert)
|
|
251
|
+
if (alert) {
|
|
252
|
+
errors.value = [errorText]
|
|
253
|
+
errorAlertDataId.value = validateNameAndGenerateDataId(
|
|
254
|
+
form.value.name.value,
|
|
255
|
+
errorText,
|
|
256
|
+
'device-selection-alert-error'
|
|
257
|
+
)
|
|
258
|
+
}
|
|
250
259
|
formErrors.value = data
|
|
251
260
|
}
|
|
252
261
|
|