bfg-common 1.3.426 → 1.3.427

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.
@@ -72,6 +72,7 @@
72
72
  import type {
73
73
  UI_I_WizardStep,
74
74
  UI_I_ValidationReturn,
75
+ UI_I_AsyncCheckReturn,
75
76
  } from '~/components/atoms/wizard/lib/models/interfaces'
76
77
  import Wizard from '~/components/atoms/wizard/lib/utils/utils'
77
78
  import {
@@ -94,6 +95,7 @@ import {
94
95
  } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
95
96
  // import { stepItemsFunc } from '~/components/common/wizards/datastore/add/lib/config/stepItems'
96
97
  import { constructDataReadyViewFunc } from '~/components/common/wizards/datastore/add/readyComplete/lib/config/propertiesDetails'
98
+ import { checkValidityName } from '~/components/common/wizards/datastoreNew/add/lib/utils'
97
99
 
98
100
  const props = defineProps<{
99
101
  project: UI_T_Project
@@ -159,18 +161,45 @@ const datastoreForm = ref<UI_I_CreateDatastoreForm>({
159
161
  },
160
162
  })
161
163
 
162
- const checkIpFourSettingsSync = (
164
+ const checkNetwork = async (
165
+ label: string,
166
+ localization: UI_I_Localization
167
+ // emits: UI_I_AddNetworkingEmits
168
+ ): Promise<UI_I_AsyncCheckReturn> => {
169
+ if (label) {
170
+ return new Promise((resolve, _reject) =>
171
+ checkValidityName(label, (message: string) => {
172
+ resolve({
173
+ isValid: message === '',
174
+ message: message === '' ? '' : message,
175
+ })
176
+ })
177
+ )
178
+ } else {
179
+ return {
180
+ isValid: false,
181
+ message: localization.specifyDatastoreName,
182
+ }
183
+ }
184
+ }
185
+
186
+ const checkNameAsync = async (
163
187
  localization: UI_I_Localization,
164
- data: string,
165
- wizard: Wizard,
166
- value: UI_I_WizardStep[]
167
- ): UI_I_ValidationReturn => {
188
+ value: UI_I_WizardStep[],
189
+ label: string,
190
+ wizard: Wizard
191
+ ): Promise<UI_I_ValidationReturn> => {
168
192
  let stepHasError = false
169
193
 
170
- if (!data) {
194
+ const labelValidation: {
195
+ isValid: boolean
196
+ message: string
197
+ } = await checkNetwork(label, localization)
198
+
199
+ if (!labelValidation.isValid) {
171
200
  stepHasError = wizard.setValidation(1, 'datastoreName', {
172
- fieldMessage: localization.specifyDatastoreName,
173
- alertMessage: '',
201
+ fieldMessage: labelValidation.message,
202
+ alertMessage: label ? labelValidation.message : '',
174
203
  })
175
204
  } else if (wizard.hasMessage(1, 'datastoreName')) {
176
205
  value = wizard.removeValidation(1, 'datastoreName', value)
@@ -182,68 +211,6 @@ const checkIpFourSettingsSync = (
182
211
  }
183
212
  }
184
213
 
185
- // const checkNetwork = async (
186
- // label: string,
187
- // localization: UI_I_Localization,
188
- // emits: UI_I_AddNetworkingEmits
189
- // ): Promise<UI_I_AsyncCheckReturn> => {
190
- // if (label) {
191
- // return new Promise((resolve, _reject) =>
192
- // emits('check-network-label', label, (message: string) => {
193
- // if (message === '') {
194
- // resolve({
195
- // isValid: true,
196
- // message: '',
197
- // })
198
- // }
199
- //
200
- // if (message !== '') {
201
- // resolve({
202
- // isValid: false,
203
- // message,
204
- // })
205
- // }
206
- // })
207
- // )
208
- // } else {
209
- // return {
210
- // isValid: false,
211
- // message: localization.networkLabelInvalidMessage,
212
- // }
213
- // }
214
- // }
215
-
216
- // export const checkNetworkAsync = async (
217
- // value: UI_I_WizardStep[],
218
- // label: string,
219
- // stepId: number,
220
- // fieldName: string,
221
- // emits: UI_I_AddNetworkingEmits,
222
- // localization: UI_I_Localization,
223
- // wizard: Wizard
224
- // ): Promise<UI_I_ValidationReturn> => {
225
- // let stepHasError = false
226
- //
227
- // const labelValidation: {
228
- // isValid: boolean
229
- // message: string
230
- // } = await checkNetwork(label, localization, emits)
231
- //
232
- // if (!labelValidation.isValid) {
233
- // stepHasError = wizard.setValidation(stepId, fieldName, {
234
- // fieldMessage: labelValidation.message,
235
- // alertMessage: labelValidation.message,
236
- // })
237
- // } else if (wizard.hasMessage(stepId, fieldName)) {
238
- // value = wizard.removeValidation(stepId, fieldName, value)
239
- // }
240
- //
241
- // return {
242
- // newValue: value,
243
- // stepHasError,
244
- // }
245
- // }
246
-
247
214
  const validationFunc = async (
248
215
  value: UI_I_WizardStep[],
249
216
  currentStep: UI_I_WizardStep,
@@ -252,11 +219,11 @@ const validationFunc = async (
252
219
  let stepHasError = false
253
220
 
254
221
  if (wizard.isValidateForStep(1, currentStep.id, nextStep.id)) {
255
- const nameValidation = checkIpFourSettingsSync(
222
+ const nameValidation = await checkNameAsync(
256
223
  localization.value,
224
+ value,
257
225
  form.value.name,
258
- wizard,
259
- value
226
+ wizard
260
227
  )
261
228
 
262
229
  value = nameValidation.newValue
@@ -8,7 +8,7 @@ export type UI_T_KerberosAuthentication =
8
8
 
9
9
  export type UI_T_WizardDatastoreMode = 'procurator' | 'sphere'
10
10
 
11
- export interface UI_I_DatastoreValidityName {
12
- valid: boolean
13
- msg: any
14
- }
11
+ // export interface UI_I_DatastoreValidityName {
12
+ // valid: boolean
13
+ // msg: any
14
+ // }
@@ -1,8 +1,8 @@
1
1
  import { API_UI_I_Error } from '~/lib/models/store/interfaces'
2
2
  import {
3
- UI_I_DatastoreValidityName,
3
+ // UI_I_DatastoreValidityName,
4
4
  UI_T_WizardDatastoreMode,
5
- } from '~/components/common/wizards/datastore/add/lib/models/types'
5
+ } from '~/components/common/wizards/datastoreNew/add/lib/models/types'
6
6
  // import {
7
7
  // UI_I_CreateDatastoreBodyRequest,
8
8
  // I_CreateStorageUuid,
@@ -19,8 +19,9 @@ import {
19
19
 
20
20
  export const checkValidityName = async (
21
21
  name: string,
22
+ sendMessage: (message: string) => void,
22
23
  mode: UI_T_WizardDatastoreMode = 'procurator'
23
- ): Promise<UI_I_DatastoreValidityName> => {
24
+ ): Promise<void> => {
24
25
  // TODO move to projects!!!
25
26
 
26
27
  const kind = 10 // TODO move in global space
@@ -35,11 +36,12 @@ export const checkValidityName = async (
35
36
 
36
37
  if (error.value && error.value.data.error_code !== 0) {
37
38
  const existError = error.value.data?.error_message || error.value.data
38
-
39
- return { valid: false, msg: existError }
39
+ sendMessage(existError)
40
+ return
41
+ // return { valid: false, msg: existError }
40
42
  }
41
-
42
- return { valid: true, msg: null }
43
+ sendMessage('')
44
+ // return { valid: true, msg: null }
43
45
  }
44
46
 
45
47
  // export const getStoragePoolName = async <T>(
@@ -2,6 +2,7 @@
2
2
  <div class="local-step">
3
3
  <common-wizards-datastore-new-add-local-create-name
4
4
  v-if="isShowCreateLocalNameBlock"
5
+ v-model="model.name"
5
6
  :alert-messages="props.alertMessages"
6
7
  :messages-fields="props.messagesFields"
7
8
  @hide-alert="(e) => emits('hide-alert', e)"
@@ -17,7 +17,7 @@
17
17
  <div class="flex-align-center">
18
18
  <input
19
19
  id="datastore-name"
20
- v-model.trim="form.name.value"
20
+ v-model.trim="createDatastoreNameLocal"
21
21
  data-id="datastore-name-input"
22
22
  type="text"
23
23
  class="clr-input"
@@ -50,6 +50,7 @@ const props = defineProps<{
50
50
  alertMessages: string[]
51
51
  messagesFields: UI_I_ArbitraryObject<UI_I_ErrorFields>
52
52
  }>()
53
+ const createDatastoreNameLocal = defineModel<string>()
53
54
  const emits = defineEmits<{
54
55
  (event: 'hide-alert', value: number): void
55
56
  (event: 'loading', value: boolean): void
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.3.426",
4
+ "version": "1.3.427",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",