bfg-common 1.3.533 → 1.3.535

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,6 +42,31 @@ export const checkValidityName = async (
42
42
  return { valid: true, msg: null }
43
43
  }
44
44
 
45
+ export const generateDataId = (errorMessage: string): string => {
46
+ let baseDataId = 'storage-name-alert-error'
47
+
48
+ const patterns = [
49
+ {
50
+ regex:
51
+ /invalid name, must only contain letters, numbers, and '_', '-' '.' symbols/,
52
+ suffix: '-invalid-name-symbols',
53
+ },
54
+ {
55
+ regex: /invalid name length, must be between: \d+ and \d+ characters/,
56
+ suffix: '-invalid-name-length',
57
+ },
58
+ ]
59
+
60
+ // Проверка error_message на соответствие шаблонам
61
+ for (const pattern of patterns) {
62
+ if (pattern.regex.test(errorMessage)) {
63
+ return `${baseDataId}${pattern.suffix}`
64
+ }
65
+ }
66
+
67
+ return baseDataId
68
+ }
69
+
45
70
  // export const getStoragePoolName = async <T>(
46
71
  // url: string,
47
72
  // params: T
@@ -2,7 +2,7 @@
2
2
  <div class="create-datastore-name">
3
3
  <atoms-alert
4
4
  v-show="errors.length"
5
- test-id="creat-storage-name-alert-error"
5
+ :test-id="errorAlertDataId"
6
6
  status="alert-danger"
7
7
  :items="errors"
8
8
  @remove="onRemoveValidationErrors"
@@ -41,6 +41,7 @@ import { UI_I_Localization } from '~/lib/models/interfaces'
41
41
  import { UI_I_FormValidationDataStore } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
42
42
  import { defaultFormFunc } from '~/components/common/wizards/datastore/add/local/createName/lib/config/defaultForm'
43
43
  import { checkValidityName } from '~/components/common/wizards/datastore/add/lib/utils'
44
+ import { generateDataId } from '~/components/common/wizards/datastore/add/lib/utils'
44
45
 
45
46
  const props = defineProps<{
46
47
  localCreateNameSubmit: number
@@ -82,9 +83,11 @@ const nameErrorText = computed<string>(() => {
82
83
  })
83
84
  /* Validation Name input end */
84
85
 
86
+ const errorAlertDataId = ref<string>('')
85
87
  const errors = ref<string[]>([])
86
88
  const showValidationErrors = (data: string[]): void => {
87
89
  errors.value = data
90
+ errorAlertDataId.value = generateDataId(data[0])
88
91
  }
89
92
  const onRemoveValidationErrors = (): void => {
90
93
  errors.value = []
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.3.533",
4
+ "version": "1.3.535",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",