bfg-common 1.3.442 → 1.3.443

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.
@@ -43,7 +43,6 @@
43
43
  :is-main-filter="props.isMainFilter"
44
44
  :host-id="props.hostId"
45
45
  @hide-alert="onHideAlert"
46
- @loading="(e) => (loading = e)"
47
46
  @submit="onSaveAndNextSharedStorm"
48
47
  @main-filter="emits('main-filter', $event)"
49
48
  />
@@ -233,9 +232,9 @@ const checkNetwork2 = async (
233
232
  } else {
234
233
  return {
235
234
  isValid: false,
236
- message: !form.lunDisk.length
237
- ? localization.selectHostToContinueAlert
238
- : localization.specifyDatastoreName,
235
+ message: !form.name
236
+ ? localization.specifyDatastoreName
237
+ : localization.selectHostToContinueAlert,
239
238
  }
240
239
  }
241
240
  }
@@ -253,12 +252,12 @@ const checkName2Async = async (
253
252
  } = await checkNetwork2(form, localization)
254
253
 
255
254
  if (!labelValidation.isValid) {
256
- stepHasError = wizard.setValidation(1, 'datastoreName', {
255
+ stepHasError = wizard.setValidation(2, 'datastoreName', {
257
256
  fieldMessage: labelValidation.message,
258
257
  alertMessage: form.name ? labelValidation.message : '',
259
258
  })
260
- } else if (wizard.hasMessage(1, 'datastoreName')) {
261
- value = wizard.removeValidation(1, 'datastoreName', value)
259
+ } else if (wizard.hasMessage(2, 'datastoreName')) {
260
+ value = wizard.removeValidation(2, 'datastoreName', value)
262
261
  }
263
262
 
264
263
  return {
@@ -32,7 +32,12 @@ export const stepsFunc = (
32
32
  title: localization.nameAndDeviceSelection,
33
33
  subTitle: localization.nameAndDeviceSelectionDesc,
34
34
  status: UI_E_WIZARD_STATUS.INACTIVE,
35
- fields: {},
35
+ fields: {
36
+ datastoreName: {
37
+ alert: '',
38
+ field: '',
39
+ },
40
+ },
36
41
  isValid: true,
37
42
  testId: 'select-name-and-device-selection',
38
43
  },
@@ -12,7 +12,6 @@
12
12
  :is-main-filter="props.isMainFilter"
13
13
  :host-id="props.hostId"
14
14
  @hide-alert="(e) => emits('hide-alert', e)"
15
- @loading="(e) => emits('loading', e)"
16
15
  @main-filter="emits('main-filter', $event)"
17
16
  />
18
17
 
@@ -60,7 +59,6 @@ const model = defineModel<any>()
60
59
  const emits = defineEmits<{
61
60
  // (event: 'submit', value: { name: string; lunDisk: string[] }): void
62
61
  (event: 'hide-alert', value: boolean): void
63
- (event: 'loading', value: boolean): void
64
62
  (event: 'main-filter', value: string): void
65
63
  }>()
66
64
 
@@ -1,6 +1,5 @@
1
1
  <template>
2
2
  <div class="device-selection">
3
- {{ }}
4
3
  <atoms-alert
5
4
  v-show="props.alertMessages.length"
6
5
  test-id="device-selection-errors"
@@ -14,10 +13,7 @@
14
13
  {{ localization.name }}
15
14
  </label>
16
15
 
17
- <div
18
- class="clr-control-container"
19
- :class="formErrors.errors?.name?.length && 'clr-error'"
20
- >
16
+ <div class="clr-control-container" :class="nameErrorText && 'clr-error'">
21
17
  <div class="flex-align-center">
22
18
  <input
23
19
  id="device-selection-input"
@@ -32,7 +28,7 @@
32
28
  </div>
33
29
 
34
30
  <div class="clr-subtext ng-star-inserted">
35
- {{ formErrors?.errors?.name?.[0] || '' }}
31
+ {{ nameErrorText }}
36
32
  </div>
37
33
  </div>
38
34
  </div>
@@ -112,16 +108,13 @@ import {
112
108
  import {
113
109
  UI_I_CreateStorageLunDiskItem,
114
110
  UI_I_DeviceSelectionSendData,
115
- UI_I_FormValidationDataStore,
116
111
  UI_I_LunDiskSpherePayload,
117
112
  UI_I_SelectHostOptions,
118
- } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
113
+ } from '~/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/interfaces'
119
114
  import type { UI_I_ErrorFields } from '~/components/atoms/wizard/lib/models/interfaces'
120
115
  // import { Ui_T_HostSelectedType } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/types'
121
116
  import { UI_T_DatastoreType } from '~/components/common/wizards/datastoreNew/add/lib/models/types'
122
- import { defaultFormFunc } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/config/defaultForm'
123
117
  import { hostsOptionsFunc } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/config/selectOptions'
124
- import { checkValidityName } from '~/components/common/wizards/datastoreNew/add/lib/utils'
125
118
 
126
119
  const props = defineProps<{
127
120
  project: UI_T_Project
@@ -135,7 +128,6 @@ const props = defineProps<{
135
128
  }>()
136
129
  const model = defineModel<any>()
137
130
  const emits = defineEmits<{
138
- (event: 'loading', value: boolean): void
139
131
  (event: 'hide-alert', value: number): void
140
132
  (event: 'submit', value: UI_I_DeviceSelectionSendData): void
141
133
  (event: 'main-filter', value: string): void
@@ -143,44 +135,29 @@ const emits = defineEmits<{
143
135
 
144
136
  const localization = computed<UI_I_Localization>(() => useLocal())
145
137
  const { $store } = useNuxtApp()
146
- const { $validation } = useNuxtApp()
147
138
 
148
139
  const isInitDatastoreNameValidation = ref<boolean>(false)
149
140
  const initValidation = (): void => {
150
141
  isInitDatastoreNameValidation.value = true
151
- const valid = validation.touch()
152
- if (!valid.isValid) {
153
- showValidationErrors(valid)
154
- }
155
142
  }
156
143
  const onInput = (): void => {
157
- const valid = validation.touch()
158
-
159
144
  if (!isInitDatastoreNameValidation.value) return
160
-
161
- valid.isValid ? removeInputValidation() : showValidationErrors(valid)
162
145
  }
163
146
 
164
- const validation = $validation.call({})
165
- const defaultForm: UI_I_FormValidationDataStore = defaultFormFunc(
166
- localization.value
167
- )
168
- const form = ref<UI_I_FormValidationDataStore>(useDeepCopy(defaultForm))
147
+ const nameErrorText = computed<string>(() => {
148
+ if (props.messagesFields?.datastoreName?.field && !model.value.name) {
149
+ return props.messagesFields.datastoreName.field
150
+ }
169
151
 
170
- const setForm = (): void => {
171
- form.value = useDeepCopy(defaultForm)
172
- validation.setForm(form)
173
- }
174
- setForm()
152
+ if (!isInitDatastoreNameValidation.value) return ''
153
+ return !model.value.name ? localization.value.specifyDatastoreName : ''
154
+ })
175
155
 
176
156
  const alertInfo = ref<boolean>(true)
177
157
  const onHideAlertInfo = (): void => {
178
158
  alertInfo.value = false
179
159
  }
180
160
 
181
- const errors = ref<string[]>([])
182
- const formErrors = ref<UI_I_ValidationTouchResult[]>([])
183
-
184
161
  /* Lun disk table */
185
162
 
186
163
  const pagination = ref<UI_I_Pagination>({
@@ -189,8 +166,6 @@ const pagination = ref<UI_I_Pagination>({
189
166
  })
190
167
  const sort = ref<string | null>(null)
191
168
 
192
- // const selectedLunDisk = ref<number[]>([])
193
-
194
169
  const updatePagination = (event: UI_I_Pagination): void => {
195
170
  pagination.value = event
196
171
  }
@@ -230,20 +205,9 @@ const onSelectHost = (): void => {
230
205
 
231
206
  const showValidationErrors = (
232
207
  data: UI_I_ValidationTouchResult[],
233
- errorText = '',
234
- alert = false
235
- ): void => {
236
- if (alert) errors.value = [errorText]
237
- formErrors.value = data
238
- }
239
-
240
- const resetValidation = (): void => {
241
- errors.value = []
242
- formErrors.value = []
243
- }
244
- const removeInputValidation = (): void => {
245
- formErrors.value = []
246
- }
208
+ _errorText = '',
209
+ _alert = false
210
+ ): void => {}
247
211
  const validatePropertiesForSphere = (): boolean => {
248
212
  if (props.datastoreType === 'local') {
249
213
  return !selectedHost.value
@@ -300,10 +264,9 @@ const collectDataForReview = (
300
264
  }
301
265
 
302
266
  const submit = async (): Promise<void> => {
303
- const name = form.value.name.value
304
267
  const { project } = props
305
268
 
306
- const valid = validation.touch()
269
+ const valid = { isValid: false }
307
270
  const isShowAlertDanger =
308
271
  project === 'procurator'
309
272
  ? !model.value.lunDisk.length
@@ -322,24 +285,9 @@ const submit = async (): Promise<void> => {
322
285
  }
323
286
 
324
287
  if (!isShowAlertDanger) {
325
- emits('loading', true)
326
-
327
- const { valid: validName, msg } = await checkValidityName(
328
- name,
329
- props.project
330
- )
331
-
332
- emits('loading', false)
333
-
334
- if (!validName) {
335
- showValidationErrors(valid, msg, true)
336
- return
337
- }
338
288
  }
339
289
 
340
- resetValidation()
341
-
342
- const eventData = collectDataForReview(name, project)
290
+ const eventData = collectDataForReview('name', project)
343
291
  emits('submit', eventData)
344
292
  }
345
293
  submit()
@@ -1,10 +1,5 @@
1
- import { UI_I_Validation } from '~/lib/models/plugins/validation/interfaces'
2
1
  import { UI_I_DataTableQuery } from '~/lib/models/table/interfaces'
3
2
 
4
- export interface UI_I_FormValidationDataStore {
5
- name: UI_I_Validation
6
- }
7
-
8
3
  export interface UI_I_LunDiskSpherePayload extends UI_I_DataTableQuery {
9
4
  host: string
10
5
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.3.442",
4
+ "version": "1.3.443",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
@@ -1,18 +0,0 @@
1
- import { UI_I_Localization } from '~/lib/models/interfaces'
2
- import { UI_I_FormValidationDataStore } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
3
-
4
- export const defaultFormFunc = (
5
- localization: UI_I_Localization
6
- ): UI_I_FormValidationDataStore => {
7
- return {
8
- name: {
9
- value: 'Datastore',
10
- validations: [
11
- {
12
- value: 'required',
13
- errorText: localization.specifyDatastoreName,
14
- },
15
- ],
16
- },
17
- }
18
- }