bfg-common 1.3.456 → 1.3.457

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.
@@ -166,7 +166,7 @@ const datastoreForm = ref<UI_I_CreateDatastoreForm>({
166
166
  },
167
167
  })
168
168
 
169
- const checkNetwork = async (
169
+ const checkName = async (
170
170
  label: string,
171
171
  localization: UI_I_Localization,
172
172
  wizard: Wizard
@@ -188,11 +188,12 @@ const checkNetwork = async (
188
188
  }
189
189
  }
190
190
  }
191
-
192
- const checkNameAsync = async (
191
+ const checkDatastoreNameAsync = async (
193
192
  localization: UI_I_Localization,
194
193
  value: UI_I_WizardStep[],
195
194
  label: string,
195
+ stepId: number,
196
+ fieldName: string,
196
197
  wizard: Wizard
197
198
  ): Promise<UI_I_ValidationReturn> => {
198
199
  let stepHasError = false
@@ -200,15 +201,15 @@ const checkNameAsync = async (
200
201
  const labelValidation: {
201
202
  isValid: boolean
202
203
  message: string
203
- } = await checkNetwork(label, localization, wizard)
204
+ } = await checkName(label, localization, wizard)
204
205
 
205
206
  if (!labelValidation.isValid) {
206
- stepHasError = wizard.setValidation(1, 'datastoreName', {
207
+ stepHasError = wizard.setValidation(stepId, fieldName, {
207
208
  fieldMessage: labelValidation.message,
208
209
  alertMessage: label ? labelValidation.message : '',
209
210
  })
210
- } else if (wizard.hasMessage(1, 'datastoreName')) {
211
- value = wizard.removeValidation(1, 'datastoreName', value)
211
+ } else if (wizard.hasMessage(stepId, fieldName)) {
212
+ value = wizard.removeValidation(stepId, fieldName, value)
212
213
  }
213
214
 
214
215
  return {
@@ -269,50 +270,21 @@ const checkNameAndDeviceAsync = async (
269
270
  }
270
271
  }
271
272
 
272
- const checkNameAndConfiguration = async (
273
- form: any,
274
- localization: UI_I_Localization,
275
- wizard: Wizard
276
- // emits: UI_I_AddNetworkingEmits
277
- ): Promise<UI_I_AsyncCheckReturn> => {
278
- if (form.name && form.folder && form.server) {
279
- return new Promise((resolve, _reject) =>
280
- checkValidityName(form.name, wizard, (message: string) => {
281
- resolve({
282
- isValid: message === '',
283
- message: message === '' ? '' : message,
284
- })
285
- })
286
- )
287
- } else {
288
- return {
289
- isValid: false,
290
- message: !form.name
291
- ? localization.specifyDatastoreName
292
- : localization.selectHostToContinueAlert,
293
- }
294
- }
295
- }
296
- const checkNameAndNfsConfigurationAsync = async (
273
+ const checkNfsFolderSync = (
297
274
  localization: UI_I_Localization,
298
- value: UI_I_WizardStep[],
299
- form: any,
300
- wizard: Wizard
301
- ): Promise<UI_I_ValidationReturn> => {
275
+ name: string,
276
+ wizard: Wizard,
277
+ value: UI_I_WizardStep[]
278
+ ): UI_I_ValidationReturn => {
302
279
  let stepHasError = false
303
280
 
304
- const labelValidation: {
305
- isValid: boolean
306
- message: string
307
- } = await checkNameAndConfiguration(form, localization, wizard)
308
-
309
- if (!labelValidation.isValid) {
310
- stepHasError = wizard.setValidation(5, 'name', {
311
- fieldMessage: labelValidation.message,
312
- alertMessage: form.name ? labelValidation.message : '',
281
+ if (!name) {
282
+ stepHasError = wizard.setValidation(5, 'folder', {
283
+ fieldMessage: localization.noHostOrClusterSelected,
284
+ alertMessage: '',
313
285
  })
314
- } else if (wizard.hasMessage(5, 'name')) {
315
- value = wizard.removeValidation(5, 'name', value)
286
+ } else if (wizard.hasMessage(5, 'folder')) {
287
+ value = wizard.removeValidation(5, 'folder', value)
316
288
  }
317
289
 
318
290
  return {
@@ -329,10 +301,12 @@ const validationFunc = async (
329
301
  let stepHasError = false
330
302
 
331
303
  if (wizard.isValidateForStep(1, currentStep.id, nextStep.id)) {
332
- const nameValidation = await checkNameAsync(
304
+ const nameValidation = await checkDatastoreNameAsync(
333
305
  localization.value,
334
306
  value,
335
307
  form.value.name,
308
+ 1,
309
+ 'datastoreName',
336
310
  wizard
337
311
  )
338
312
 
@@ -355,16 +329,25 @@ const validationFunc = async (
355
329
  }
356
330
 
357
331
  if (wizard.isValidateForStep(5, currentStep.id, nextStep.id)) {
358
- const nameValidation = await checkNameAndNfsConfigurationAsync(
332
+ const nameValidation = await checkDatastoreNameAsync(
359
333
  localization.value,
360
334
  value,
361
- form.value,
335
+ form.value.name,
336
+ 5,
337
+ 'name',
362
338
  wizard
363
339
  )
364
340
 
365
341
  value = nameValidation.newValue
366
342
 
367
- stepHasError = nameValidation.stepHasError
343
+ const folderValidation = checkNfsFolderSync(
344
+ localization.value,
345
+ form.value.folder,
346
+ wizard,
347
+ value
348
+ )
349
+
350
+ stepHasError = folderValidation.stepHasError || nameValidation.stepHasError
368
351
  }
369
352
 
370
353
  return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.3.456",
4
+ "version": "1.3.457",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",