bfg-common 1.2.222 → 1.2.224

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.
@@ -33,7 +33,7 @@
33
33
  @check-name="emits('check-name', $event)"
34
34
  />
35
35
  <common-vm-actions-common-select-compute-resource
36
- v-if="props.project === 'sphere'"
36
+ v-if="isSphere"
37
37
  v-show="selectedStep.id === 3"
38
38
  v-model="vmForm.computeResource"
39
39
  :compute-resource-submit="computeResourceSubmit"
@@ -227,6 +227,8 @@ const emits = defineEmits<{
227
227
  (event: 'clear-compute-resource-tree'): void // для сферы
228
228
  }>()
229
229
 
230
+ const isSphere = computed<boolean>(() => props.project === 'sphere')
231
+
230
232
  const { $recursion } = useNuxtApp()
231
233
 
232
234
  const localization = computed<UI_I_Localization>(() => useLocal())
@@ -235,7 +237,7 @@ const wizard: Wizard = new Wizard(
235
237
  stepsFunc(localization.value),
236
238
  stepsSchemeInitial
237
239
  )
238
- if (props.project === 'sphere') wizard.changeScheme(1)
240
+ if (isSphere.value) wizard.changeScheme(1)
239
241
  const wasCompleted = computed<boolean>(() => wizard.wasCompleted())
240
242
  const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
241
243
  const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
@@ -259,29 +261,26 @@ const validationFunc = async (
259
261
 
260
262
  wizard.setLoader(true)
261
263
  if (
262
- wizard.isValidateForStep(1, currentStep.id, nextStep.id) ||
263
- wizard.isValidateForStep(2, currentStep.id, nextStep.id)
264
+ wizard.isValidateForStep(
265
+ isSphere.value ? 2 : 1,
266
+ currentStep.id,
267
+ nextStep.id
268
+ )
264
269
  ) {
265
- let nameValidation: any = {}
266
-
267
- nameValidation = await checkName(value)
270
+ const nameValidation = await checkName(value)
268
271
 
269
- value = nameValidation.value
272
+ value = nameValidation.newValue
270
273
  stepHasError = stepHasError || nameValidation.stepHasError
271
274
  } else if (wizard.isValidateForStep(4, currentStep.id, nextStep.id)) {
272
- let storageValidation: any = {}
275
+ const storageValidation = await checkStorage(value)
273
276
 
274
- storageValidation = await checkStorage(value)
275
-
276
- value = storageValidation.value
277
+ value = storageValidation.newValue
277
278
 
278
279
  stepHasError = stepHasError || storageValidation.stepHasError
279
280
  } else if (wizard.isValidateForStep(8, currentStep.id, nextStep.id)) {
280
- let storageValidation: any = {}
281
-
282
- storageValidation = await checkCustomizeHardware(value)
281
+ const storageValidation = await checkCustomizeHardware(value)
283
282
 
284
- value = storageValidation.value
283
+ value = storageValidation.newValue
285
284
 
286
285
  stepHasError = stepHasError || storageValidation.stepHasError
287
286
  }
@@ -293,29 +292,34 @@ const validationFunc = async (
293
292
  stepShouldStop,
294
293
  }
295
294
  }
296
- const checkName = async (value: UI_I_WizardStep[]): Promise<any> => {
295
+ const checkName = async (
296
+ value: UI_I_WizardStep[]
297
+ ): Promise<UI_I_ValidationReturn> => {
297
298
  let stepHasError = false
298
299
 
299
300
  return new Promise((resolve) => {
301
+ const step = isSphere.value ? 2 : 1
300
302
  nameFormSubmit.value = (isValid: boolean) => {
301
303
  if (!isValid) {
302
- stepHasError = wizard.setValidation(1, 'name', {
304
+ stepHasError = wizard.setValidation(step, 'name', {
303
305
  fieldMessage: 'aaa',
304
306
  alertMessage: 'aaa',
305
307
  })
306
- } else if (wizard.hasMessage(1, 'name')) {
307
- value = wizard.removeValidation(1, 'name', value)
308
+ } else if (wizard.hasMessage(step, 'name')) {
309
+ value = wizard.removeValidation(step, 'name', value)
308
310
  }
309
311
 
310
312
  resolve({
311
- value,
312
313
  stepHasError,
314
+ newValue: value,
313
315
  })
314
316
  nameFormSubmit.value = null
315
317
  }
316
318
  })
317
319
  }
318
- const checkStorage = async (value: UI_I_WizardStep[]): Promise<any> => {
320
+ const checkStorage = async (
321
+ value: UI_I_WizardStep[]
322
+ ): Promise<UI_I_ValidationReturn> => {
319
323
  let stepHasError = false
320
324
 
321
325
  return new Promise((resolve) => {
@@ -330,8 +334,8 @@ const checkStorage = async (value: UI_I_WizardStep[]): Promise<any> => {
330
334
  }
331
335
 
332
336
  resolve({
333
- value,
334
337
  stepHasError,
338
+ newValue: value,
335
339
  })
336
340
  storageSubmit.value = null
337
341
  }
@@ -339,7 +343,7 @@ const checkStorage = async (value: UI_I_WizardStep[]): Promise<any> => {
339
343
  }
340
344
  const checkCustomizeHardware = async (
341
345
  value: UI_I_WizardStep[]
342
- ): Promise<any> => {
346
+ ): Promise<UI_I_ValidationReturn> => {
343
347
  let stepHasError = false
344
348
 
345
349
  return new Promise((resolve) => {
@@ -354,8 +358,8 @@ const checkCustomizeHardware = async (
354
358
  }
355
359
 
356
360
  resolve({
357
- value,
358
361
  stepHasError,
362
+ newValue: value,
359
363
  })
360
364
  storageSubmit.value = null
361
365
  }
@@ -381,7 +385,7 @@ const vmFormCash = ref<UI_I_VmFormCash>({
381
385
 
382
386
  const onChangeName = (name: string, node: UI_I_TreeNode): void => {
383
387
  vmForm.value.name = name
384
- if (props.project === 'sphere') {
388
+ if (isSphere.value) {
385
389
  vmForm.value.locationPath = $recursion.createAbsolutePathRecursion(
386
390
  node,
387
391
  'id',
@@ -473,7 +477,9 @@ watch(
473
477
  }
474
478
  )
475
479
 
476
- const validateSendData = async (value: UI_I_WizardStep[]): Promise<any> => {
480
+ const validateSendData = async (
481
+ value: UI_I_WizardStep[]
482
+ ): Promise<UI_I_ValidationReturn> => {
477
483
  wizard.setLoader(true)
478
484
  let stepHasError = false
479
485
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.2.222",
4
+ "version": "1.2.224",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",