bfg-common 1.2.205 → 1.2.207

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.
@@ -90,7 +90,7 @@ export default class Wizard {
90
90
  setLoader(status: boolean, messages?: string[]): void {
91
91
  this._wizardLoader.value.status = status
92
92
 
93
- if (!messages && this._wizardLoader.value.messages.length > 0) {
93
+ if (!messages && this._wizardLoader.value?.messages.length > 0) {
94
94
  this._wizardLoader.value.messages = []
95
95
  return
96
96
  }
@@ -535,4 +535,34 @@ export default class Wizard {
535
535
  : step
536
536
  )
537
537
  }
538
+
539
+ validateFieldLocal(
540
+ stepId: number,
541
+ field: string,
542
+ rule: boolean | boolean[],
543
+ fieldMessage: string | string[],
544
+ alertMessage: string | string[]
545
+ ): void {
546
+ if (typeof rule === 'boolean') {
547
+ if (rule) {
548
+ this.setValidation(stepId, field, {
549
+ fieldMessage: fieldMessage as string,
550
+ alertMessage: alertMessage as string,
551
+ })
552
+ } else if (this.hasMessage(stepId, field)) {
553
+ this.removeValidationLocal(stepId, field)
554
+ }
555
+ } else {
556
+ const ruleIndex = rule.indexOf(true)
557
+
558
+ if (ruleIndex !== -1) {
559
+ this.setValidation(stepId, field, {
560
+ fieldMessage: fieldMessage[ruleIndex],
561
+ alertMessage: alertMessage[ruleIndex],
562
+ })
563
+ } else if (this.hasMessage(stepId, field)) {
564
+ this.removeValidationLocal(stepId, field)
565
+ }
566
+ }
567
+ }
538
568
  }
@@ -1,5 +1,3 @@
1
- import type Wizard from '~/components/atoms/wizard/utils/utils'
2
-
3
1
  export const isIntegerNumberInRange = (
4
2
  value: number | string | undefined,
5
3
  down: number,
@@ -14,34 +12,3 @@ export const checkVlanId = (vlanId: string): boolean =>
14
12
  vlanId !== 'None (0)' &&
15
13
  vlanId !== 'All (4095)' &&
16
14
  (isIntegerNumberInRange(vlanId, 0, 4095) || vlanId === '')
17
-
18
- export const validateFieldLocal = (
19
- wizard: Wizard,
20
- stepId: number,
21
- field: string,
22
- rule: boolean | boolean[],
23
- fieldMessage: string | string[],
24
- alertMessage: string | string[]
25
- ): void => {
26
- if (typeof rule === 'boolean') {
27
- if (rule) {
28
- wizard.setValidation(stepId, field, {
29
- fieldMessage: fieldMessage as string,
30
- alertMessage: alertMessage as string,
31
- })
32
- } else if (wizard.hasMessage(stepId, field)) {
33
- wizard.removeValidationLocal(stepId, field)
34
- }
35
- } else {
36
- const ruleIndex = rule.indexOf(true)
37
-
38
- if (ruleIndex !== -1) {
39
- wizard.setValidation(stepId, field, {
40
- fieldMessage: fieldMessage[ruleIndex],
41
- alertMessage: alertMessage[ruleIndex],
42
- })
43
- } else if (wizard.hasMessage(stepId, field)) {
44
- wizard.removeValidationLocal(stepId, field)
45
- }
46
- }
47
- }
@@ -8,18 +8,14 @@ import {
8
8
  UI_I_ValidationReturn,
9
9
  UI_I_WizardStep,
10
10
  } from '~/components/atoms/wizard/models/interfaces'
11
- import {
12
- validateFieldLocal,
13
- checkVlanId,
14
- } from '~/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/common'
11
+ import { checkVlanId } from '~/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/common'
15
12
 
16
13
  export const validateVlanIdConnectionSettingsLocal = (
17
14
  localization: UI_I_Localization,
18
15
  data: UI_I_ConnectionSettings,
19
16
  wizard: Wizard
20
17
  ): void => {
21
- validateFieldLocal(
22
- wizard,
18
+ wizard.validateFieldLocal(
23
19
  1,
24
20
  UI_E_MigrationValidationFields.CONNECTION_SETTINGS_VLAN,
25
21
  checkVlanId(data.vlanId),
@@ -33,8 +29,7 @@ export const validateNetworkConnectionSettingsLocal = (
33
29
  data: UI_I_ConnectionSettings,
34
30
  wizard: Wizard
35
31
  ): void => {
36
- validateFieldLocal(
37
- wizard,
32
+ wizard.validateFieldLocal(
38
33
  1,
39
34
  UI_E_MigrationValidationFields.CONNECTION_SETTINGS_NETWORK,
40
35
  data.networkLabel === '',
@@ -3,15 +3,13 @@ import { UI_E_MigrationValidationFields } from '~/components/common/diagramMain/
3
3
  import { UI_I_Localization } from '~/models/interfaces'
4
4
  import type Wizard from '~/components/atoms/wizard/utils/utils'
5
5
  import { UI_I_WizardStep, UI_I_ValidationReturn } from '~/components/atoms/wizard/models/interfaces'
6
- import { validateFieldLocal } from '~/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/common'
7
6
 
8
7
  export const validateSelectedVmLocal = (
9
8
  localization: UI_I_Localization,
10
9
  data: UI_I_SelectVmkernelAdapter,
11
10
  wizard: Wizard
12
11
  ): void => {
13
- validateFieldLocal(
14
- wizard,
12
+ wizard.validateFieldLocal(
15
13
  0,
16
14
  'vm',
17
15
  data.vm === '',