bfg-common 1.2.223 → 1.2.225

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,23 +261,23 @@ 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
-
266
270
  const nameValidation = await checkName(value)
267
271
 
268
272
  value = nameValidation.newValue
269
273
  stepHasError = stepHasError || nameValidation.stepHasError
270
274
  } else if (wizard.isValidateForStep(4, currentStep.id, nextStep.id)) {
271
-
272
275
  const storageValidation = await checkStorage(value)
273
276
 
274
277
  value = storageValidation.newValue
275
278
 
276
279
  stepHasError = stepHasError || storageValidation.stepHasError
277
280
  } else if (wizard.isValidateForStep(8, currentStep.id, nextStep.id)) {
278
-
279
281
  const storageValidation = await checkCustomizeHardware(value)
280
282
 
281
283
  value = storageValidation.newValue
@@ -290,18 +292,21 @@ const validationFunc = async (
290
292
  stepShouldStop,
291
293
  }
292
294
  }
293
- const checkName = async (value: UI_I_WizardStep[]): Promise<UI_I_ValidationReturn> => {
295
+ const checkName = async (
296
+ value: UI_I_WizardStep[]
297
+ ): Promise<UI_I_ValidationReturn> => {
294
298
  let stepHasError = false
295
299
 
296
300
  return new Promise((resolve) => {
301
+ const step = isSphere.value ? 2 : 1
297
302
  nameFormSubmit.value = (isValid: boolean) => {
298
303
  if (!isValid) {
299
- stepHasError = wizard.setValidation(1, 'name', {
304
+ stepHasError = wizard.setValidation(step, 'name', {
300
305
  fieldMessage: 'aaa',
301
306
  alertMessage: 'aaa',
302
307
  })
303
- } else if (wizard.hasMessage(1, 'name')) {
304
- value = wizard.removeValidation(1, 'name', value)
308
+ } else if (wizard.hasMessage(step, 'name')) {
309
+ value = wizard.removeValidation(step, 'name', value)
305
310
  }
306
311
 
307
312
  resolve({
@@ -312,7 +317,9 @@ const checkName = async (value: UI_I_WizardStep[]): Promise<UI_I_ValidationRetur
312
317
  }
313
318
  })
314
319
  }
315
- const checkStorage = async (value: UI_I_WizardStep[]): Promise<UI_I_ValidationReturn> => {
320
+ const checkStorage = async (
321
+ value: UI_I_WizardStep[]
322
+ ): Promise<UI_I_ValidationReturn> => {
316
323
  let stepHasError = false
317
324
 
318
325
  return new Promise((resolve) => {
@@ -378,7 +385,7 @@ const vmFormCash = ref<UI_I_VmFormCash>({
378
385
 
379
386
  const onChangeName = (name: string, node: UI_I_TreeNode): void => {
380
387
  vmForm.value.name = name
381
- if (props.project === 'sphere') {
388
+ if (isSphere.value) {
382
389
  vmForm.value.locationPath = $recursion.createAbsolutePathRecursion(
383
390
  node,
384
391
  'id',
@@ -470,7 +477,9 @@ watch(
470
477
  }
471
478
  )
472
479
 
473
- const validateSendData = async (value: UI_I_WizardStep[]): Promise<UI_I_ValidationReturn> => {
480
+ const validateSendData = async (
481
+ value: UI_I_WizardStep[]
482
+ ): Promise<UI_I_ValidationReturn> => {
474
483
  wizard.setLoader(true)
475
484
  let stepHasError = false
476
485
 
@@ -38,7 +38,12 @@ export const stepsFunc = (
38
38
  subTitle: localization.specifyUniqueNameTargetLocation,
39
39
  status: UI_E_WIZARD_STATUS.INACTIVE,
40
40
  isValid: true,
41
- fields: {},
41
+ fields: {
42
+ name: {
43
+ field: '',
44
+ alert: '',
45
+ },
46
+ },
42
47
  },
43
48
  // Sphere
44
49
  {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.2.223",
4
+ "version": "1.2.225",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",