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.
@@ -1,28 +1,12 @@
1
1
  import type { UI_I_WizardStep } from '~/components/atoms/wizard/models/interfaces'
2
2
 
3
- import { UI_I_ArbitraryObject } from '~/models/interfaces'
4
3
  import { UI_E_Fields } from '~/components/common/vm/actions/common/models/enums'
5
- import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
6
4
  import { UI_I_Localization } from '~/models/interfaces'
7
5
  import { UI_I_VerticalStepItem } from '~/components/atoms/models/interfaces'
8
6
  import { UI_T_Project } from '~/models/types'
9
7
  import { UI_E_WIZARD_STATUS } from '~/components/atoms/wizard/models/enums'
10
8
  import { checkAllField } from '~/components/common/vm/actions/utils'
11
9
 
12
- export const objectToOptionItem = (
13
- // TODO переместить в более глобальное место
14
- obj: UI_I_ArbitraryObject<string>
15
- ): UI_I_OptionItem[] => {
16
- const result = []
17
- for (const key in obj) {
18
- result.push({
19
- text: obj[key],
20
- value: key,
21
- })
22
- }
23
- return result
24
- }
25
-
26
10
  export const getStepPositionByField = (field: string): number => {
27
11
  if (checkAllField(field)) {
28
12
  return UI_E_Fields[field]
@@ -308,7 +308,7 @@ const localization = computed<UI_I_Localization>(() => useLocal())
308
308
 
309
309
  const emits = defineEmits<{
310
310
  (event: 'change-target-device', targetDevice: UI_I_TargetDevice): void
311
- (event: 'hide-alert', stepId: 2): void
311
+ (event: 'hide-alert', stepId: 1): void
312
312
  }>()
313
313
 
314
314
  const isConnectionTypeFirstTwo = computed<boolean>(() =>
@@ -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,
@@ -26,33 +24,3 @@ export const checkMtu = (mtu: number): boolean => {
26
24
  return !!(mtu === 0 ? '0' : mtu) && isIntegerNumberInRange(mtu, 1280, 65535)
27
25
  }
28
26
 
29
- export const validateFieldLocal = (
30
- wizard: Wizard,
31
- stepId: number,
32
- field: string,
33
- rule: boolean | boolean[],
34
- fieldMessage: string | string[],
35
- alertMessage: string | string[]
36
- ): void => {
37
- if (typeof rule === 'boolean') {
38
- if (rule) {
39
- wizard.setValidation(stepId, field, {
40
- fieldMessage: fieldMessage as string,
41
- alertMessage: alertMessage as string,
42
- })
43
- } else if (wizard.hasMessage(stepId, field)) {
44
- wizard.removeValidationLocal(stepId, field)
45
- }
46
- } else {
47
- const ruleIndex = rule.indexOf(true)
48
-
49
- if (ruleIndex !== -1) {
50
- wizard.setValidation(stepId, field, {
51
- fieldMessage: fieldMessage[ruleIndex],
52
- alertMessage: alertMessage[ruleIndex],
53
- })
54
- } else if (wizard.hasMessage(stepId, field)) {
55
- wizard.removeValidationLocal(stepId, field)
56
- }
57
- }
58
- }
@@ -6,18 +6,14 @@ import {
6
6
  UI_I_ValidationReturn,
7
7
  UI_I_WizardStep,
8
8
  } from '~/components/atoms/wizard/models/interfaces'
9
- import {
10
- validateFieldLocal,
11
- checkVlanId,
12
- } from '~/components/common/wizards/network/add/validations/common'
9
+ import { checkVlanId } from '~/components/common/wizards/network/add/validations/common'
13
10
 
14
11
  export const validateVlanIdConnectionSettingsLocal = (
15
12
  localization: UI_I_Localization,
16
13
  data: UI_I_ConnectionSettings,
17
14
  wizard: Wizard
18
15
  ): void => {
19
- validateFieldLocal(
20
- wizard,
16
+ wizard.validateFieldLocal(
21
17
  5,
22
18
  UI_E_ValidationFields.CONNECTION_SETTINGS_VLAN,
23
19
  checkVlanId(data.vlanId),
@@ -31,8 +27,7 @@ export const validateNetworkConnectionSettingsLocal = (
31
27
  data: UI_I_ConnectionSettings,
32
28
  wizard: Wizard
33
29
  ): void => {
34
- validateFieldLocal(
35
- wizard,
30
+ wizard.validateFieldLocal(
36
31
  5,
37
32
  UI_E_ValidationFields.CONNECTION_SETTINGS_NETWORK,
38
33
  data.networkLabel === '',
@@ -6,18 +6,14 @@ import {
6
6
  UI_I_ValidationReturn,
7
7
  UI_I_WizardStep,
8
8
  } from '~/components/atoms/wizard/models/interfaces'
9
- import {
10
- validateFieldLocal,
11
- checkIfValidIP,
12
- } from '~/components/common/wizards/network/add/validations/common'
9
+ import { checkIfValidIP } from '~/components/common/wizards/network/add/validations/common'
13
10
 
14
11
  export const validateAddressIpFourSettingsLocal = (
15
12
  localization: UI_I_Localization,
16
13
  data: UI_I_IpFourSettings,
17
14
  wizard: Wizard
18
15
  ): void => {
19
- validateFieldLocal(
20
- wizard,
16
+ wizard.validateFieldLocal(
21
17
  4,
22
18
  UI_E_ValidationFields.IPV_SETTINGS_IPV,
23
19
  [!data.static.ipFourAddress, !checkIfValidIP(data.static.ipFourAddress)],
@@ -31,8 +27,7 @@ export const validateMaskIpFourSettingsLocal = (
31
27
  data: UI_I_IpFourSettings,
32
28
  wizard: Wizard
33
29
  ): void => {
34
- validateFieldLocal(
35
- wizard,
30
+ wizard.validateFieldLocal(
36
31
  4,
37
32
  UI_E_ValidationFields.IPV_SETTINGS_MASK,
38
33
  [!data.static.subnetMask, !checkIfValidIP(data.static.subnetMask)],
@@ -46,8 +41,7 @@ export const validateGatewayIpFourSettingsLocal = (
46
41
  data: UI_I_IpFourSettings,
47
42
  wizard: Wizard
48
43
  ): void => {
49
- validateFieldLocal(
50
- wizard,
44
+ wizard.validateFieldLocal(
51
45
  4,
52
46
  UI_E_ValidationFields.IPV_SETTINGS_GATEWAY,
53
47
  [
@@ -2,7 +2,8 @@ import { UI_I_AddNetworkingEmits } from '~/components/common/wizards/network/add
2
2
  import { UI_I_Localization } from '~/models/interfaces'
3
3
  import type Wizard from '~/components/atoms/wizard/utils/utils'
4
4
  import {
5
- UI_I_AsyncCheckReturn, UI_I_ValidationReturn,
5
+ UI_I_AsyncCheckReturn,
6
+ UI_I_ValidationReturn,
6
7
  UI_I_WizardStep,
7
8
  } from '~/components/atoms/wizard/models/interfaces'
8
9
 
@@ -57,6 +58,13 @@ export const checkNetworkAsync = async (
57
58
 
58
59
  wizard.setLoader(false)
59
60
 
61
+ if (labelValidation.message === 'onHideLoader') {
62
+ return {
63
+ newValue: value,
64
+ stepHasError: true,
65
+ }
66
+ }
67
+
60
68
  if (!labelValidation.isValid) {
61
69
  stepHasError = wizard.setValidation(stepId, fieldName, {
62
70
  fieldMessage: labelValidation.message,
@@ -4,7 +4,6 @@ import { UI_I_Localization } from '~/models/interfaces'
4
4
  import type Wizard from '~/components/atoms/wizard/utils/utils'
5
5
  import {UI_I_ValidationReturn, UI_I_WizardStep} from '~/components/atoms/wizard/models/interfaces'
6
6
  import {
7
- validateFieldLocal,
8
7
  checkVlanId,
9
8
  checkMtu,
10
9
  } from '~/components/common/wizards/network/add/validations/common'
@@ -14,8 +13,7 @@ export const validateNetworkPortPropertiesLocal = (
14
13
  data: UI_I_PortProperties,
15
14
  wizard: Wizard
16
15
  ): void => {
17
- validateFieldLocal(
18
- wizard,
16
+ wizard.validateFieldLocal(
19
17
  3,
20
18
  UI_E_ValidationFields.PORT_PROPERTIES_NETWORK,
21
19
  data.networkLabel === '',
@@ -29,8 +27,7 @@ export const validateVlanIdPortPropertiesLocal = (
29
27
  data: UI_I_PortProperties,
30
28
  wizard: Wizard
31
29
  ): void => {
32
- validateFieldLocal(
33
- wizard,
30
+ wizard.validateFieldLocal(
34
31
  3,
35
32
  UI_E_ValidationFields.PORT_PROPERTIES_VLAN,
36
33
  checkVlanId(data.vlanId),
@@ -44,8 +41,7 @@ export const validateMtuPortPropertiesLocal = (
44
41
  data: UI_I_PortProperties,
45
42
  wizard: Wizard
46
43
  ): void => {
47
- validateFieldLocal(
48
- wizard,
44
+ wizard.validateFieldLocal(
49
45
  3,
50
46
  UI_E_ValidationFields.PORT_PROPERTIES_MTU,
51
47
  data.mtu.option === '1' && checkMtu(data.mtu.size),
@@ -6,18 +6,14 @@ import {
6
6
  UI_I_ValidationReturn,
7
7
  UI_I_WizardStep,
8
8
  } from '~/components/atoms/wizard/models/interfaces'
9
- import {
10
- validateFieldLocal,
11
- checkMtu,
12
- } from '~/components/common/wizards/network/add/validations/common'
9
+ import { checkMtu } from '~/components/common/wizards/network/add/validations/common'
13
10
 
14
11
  export const validateMtuTargetDeviceLocal = (
15
12
  localization: UI_I_Localization,
16
13
  data: UI_I_TargetDevice,
17
14
  wizard: Wizard
18
15
  ): void => {
19
- validateFieldLocal(
20
- wizard,
16
+ wizard.validateFieldLocal(
21
17
  1,
22
18
  UI_E_ValidationFields.TARGET_DEVICE_MTU,
23
19
  data.selected === '3' && checkMtu(data.mtu || 0),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.2.205",
4
+ "version": "1.2.207",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",