bfg-common 1.2.205 → 1.2.206
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.
- package/components/atoms/wizard/utils/utils.ts +31 -1
- package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/common.ts +0 -33
- package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/connectionSettings.ts +3 -8
- package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/selectVmkernelAdapter.ts +1 -3
- package/components/common/vm/actions/add/utils.ts +0 -16
- package/components/common/wizards/network/add/steps/SelectedTargetDevice.vue +1 -1
- package/components/common/wizards/network/add/validations/common.ts +0 -32
- package/components/common/wizards/network/add/validations/connectionSettings.ts +3 -8
- package/components/common/wizards/network/add/validations/ipFourSettings.ts +4 -10
- package/components/common/wizards/network/add/validations/networkValidation.ts +9 -1
- package/components/common/wizards/network/add/validations/portProperties.ts +3 -7
- package/components/common/wizards/network/add/validations/targetDevice.ts +2 -6
- package/package.json +1 -1
|
@@ -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
|
|
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 === '',
|
|
@@ -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:
|
|
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,
|
|
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),
|