bfg-common 1.4.579 → 1.4.580

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.
Files changed (66) hide show
  1. package/assets/img/icons/icons-sprite-dark-1.svg +407 -437
  2. package/assets/img/icons/icons-sprite-dark-2.svg +343 -347
  3. package/assets/img/icons/icons-sprite-dark-3.svg +227 -227
  4. package/assets/img/icons/icons-sprite-dark-4.svg +255 -259
  5. package/assets/img/icons/icons-sprite-dark-5.svg +488 -488
  6. package/assets/img/icons/icons-sprite-dark-6.svg +94 -94
  7. package/assets/img/icons/icons-sprite-light-1.svg +407 -437
  8. package/assets/img/icons/icons-sprite-light-2.svg +343 -347
  9. package/assets/img/icons/icons-sprite-light-3.svg +227 -227
  10. package/assets/img/icons/icons-sprite-light-4.svg +255 -259
  11. package/assets/img/icons/icons-sprite-light-5.svg +488 -488
  12. package/assets/img/icons/icons-sprite-light-6.svg +94 -94
  13. package/assets/scss/common/icons/icons-6.scss +156 -156
  14. package/assets/scss/common/theme.scss +321 -321
  15. package/components/common/browse/blocks/lib/models/types.ts +1 -1
  16. package/components/common/browse/lib/models/interfaces.ts +5 -5
  17. package/components/common/diagramMain/Diagram.vue +377 -364
  18. package/components/common/diagramMain/DiagramMain.vue +894 -872
  19. package/components/common/diagramMain/Header.vue +211 -211
  20. package/components/common/diagramMain/adapter/AdapterItem.vue +2 -0
  21. package/components/common/diagramMain/adapter/AdapterItems.vue +61 -61
  22. package/components/common/diagramMain/adapter/Contents.vue +207 -189
  23. package/components/common/diagramMain/lib/config/initial.ts +50 -50
  24. package/components/common/diagramMain/lib/config/positions.ts +194 -194
  25. package/components/common/diagramMain/lib/models/enums.ts +44 -44
  26. package/components/common/diagramMain/lib/models/types.ts +21 -21
  27. package/components/common/diagramMain/lib/utils/utils.ts +331 -331
  28. package/components/common/diagramMain/modals/ManagePhysicalAdaptersModal.vue +330 -330
  29. package/components/common/diagramMain/modals/editSettings/ConfirmTeamingSettingsModal.vue +40 -40
  30. package/components/common/diagramMain/modals/editSettings/EditSettings.vue +497 -497
  31. package/components/common/diagramMain/modals/editSettings/EditSettingsModal.vue +812 -812
  32. package/components/common/diagramMain/modals/editSettings/tabs/NetworkProperties.vue +214 -214
  33. package/components/common/diagramMain/modals/editSettings/tabs/Security.vue +189 -189
  34. package/components/common/diagramMain/modals/editSettings/tabs/SwitchProperties.vue +163 -163
  35. package/components/common/diagramMain/modals/editSettings/tabs/TeamingFailover.vue +175 -175
  36. package/components/common/diagramMain/modals/editSettings/tabs/TrafficShaping.vue +398 -398
  37. package/components/common/diagramMain/modals/editSettings/tabs/port/IpvFourSettings.vue +346 -346
  38. package/components/common/diagramMain/modals/editSettings/tabs/port/PortProperties.vue +205 -205
  39. package/components/common/diagramMain/modals/lib/config/diagramConfig.ts +23 -23
  40. package/components/common/diagramMain/modals/lib/config/initial.ts +180 -180
  41. package/components/common/diagramMain/modals/lib/config/vmKernelAdapter.ts +90 -90
  42. package/components/common/diagramMain/modals/lib/mappers/mappers.ts +87 -87
  43. package/components/common/diagramMain/modals/lib/utils/index.ts +24 -24
  44. package/components/common/diagramMain/modals/migrateVmkernelAdapter/MigrateVmkernelAdapter.vue +537 -537
  45. package/components/common/diagramMain/modals/migrateVmkernelAdapter/lib/config/steps.ts +114 -114
  46. package/components/common/diagramMain/modals/migrateVmkernelAdapter/steps/ConnectionSettings.vue +169 -169
  47. package/components/common/diagramMain/modals/migrateVmkernelAdapter/steps/SelectVmkernelAdapter.vue +159 -159
  48. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/common.ts +14 -14
  49. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/connectionSettings.ts +137 -137
  50. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/selectVmkernelAdapter.ts +52 -52
  51. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/validations.ts +19 -19
  52. package/components/common/diagramMain/modals/viewSettings/info/InfoNew.vue +156 -155
  53. package/components/common/diagramMain/modals/viewSettings/viewSettingsModal/ViewSettingsModalNew.vue +68 -63
  54. package/components/common/diagramMain/network/Contents.vue +491 -488
  55. package/components/common/diagramMain/network/noNetwork/NoNetworkNew.vue +1 -1
  56. package/components/common/diagramMain/port/Port.vue +2 -0
  57. package/components/common/diagramMain/port/Ports.vue +47 -47
  58. package/components/common/layout/theHeader/TheHeaderNew.vue +4 -10
  59. package/components/common/layout/theHeader/userMenu/userMenuNew/UserMenuNew.vue +4 -4
  60. package/components/common/layout/theHeader/userMenu/userMenuNew/lib/config/dropMenu.ts +1 -1
  61. package/components/common/pages/home/headline/HeadlineNew.vue +48 -71
  62. package/components/common/pages/home/resource/ResourceNew.vue +58 -63
  63. package/components/common/pages/home/widgets/WidgetsNew.vue +74 -79
  64. package/components/common/split/horizontal/HorizontalNew.vue +331 -354
  65. package/components/common/wizards/network/add/lib/config/steps.ts +464 -464
  66. package/package.json +2 -2
@@ -1,159 +1,159 @@
1
- <template>
2
- <div class="wizard-content-container">
3
- <div class="wizard-content wizard-content-port">
4
- <atoms-alert
5
- v-if="props.alertMessages.length"
6
- status="alert-danger"
7
- :items="props.alertMessages"
8
- test-id="adapter-alert"
9
- @remove="onHideAlert"
10
- />
11
- <div class="table-top-margin-container">
12
- <atoms-table-simple-table
13
- :head-items="tableHeadItems"
14
- :body-items="tableBodyItems"
15
- :selected-row-key="selectedRowKey"
16
- editable
17
- @select="onSelectRow"
18
- />
19
- </div>
20
- <common-diagram-main-modals-view-settings-info
21
- :show="!!selectedRowData.length"
22
- :modal-tabs="modalTabs"
23
- :view-settings-fields="viewSettingsFields"
24
- :with-collapse="false"
25
- />
26
- <div
27
- v-show="!selectedRowData.length"
28
- class="table-fixed-height no-item-info"
29
- >
30
- <span>{{ localization.common.noItemSelected }}</span>
31
- </div>
32
- </div>
33
- </div>
34
- </template>
35
-
36
- <script setup lang="ts">
37
- import type { UI_I_ArbitraryObject, UI_I_Localization } from '~/lib/models/interfaces'
38
- import type {
39
- UI_I_BodyItems,
40
- UI_I_ReadyCompleteFields,
41
- UI_I_SelectVmkernelAdapter,
42
- UI_I_TableHead,
43
- } from '~/components/common/wizards/network/add/lib/models/interfaces'
44
- import type {
45
- UI_I_ModalTabs,
46
- UI_I_SelectedVmkernelAdapterTableRaw,
47
- UI_I_VmkernelAdapterTableData,
48
- } from '~/components/common/diagramMain/lib/models/interfaces'
49
- import {
50
- vmKernelAdapterViewSettingsModalTabsFunc,
51
- vmKernelAdapterViewSettingsTableHeadFunc,
52
- vmKernelAdapterTableBodyMapperFunc,
53
- vmKernelAdapterViewSettingsFunc,
54
- } from '~/components/common/diagramMain/modals/lib/config'
55
-
56
- const props = defineProps<{
57
- tableData: UI_I_VmkernelAdapterTableData[]
58
- vmkernelAdapter: UI_I_SelectVmkernelAdapter
59
- alertMessages: string[]
60
- }>()
61
-
62
- const localization = computed<UI_I_Localization>(() => useLocal())
63
-
64
- const modalTabs = computed<UI_I_ModalTabs[]>(() =>
65
- vmKernelAdapterViewSettingsModalTabsFunc(localization.value)
66
- )
67
-
68
- const viewSettingsFields = computed<UI_I_ReadyCompleteFields[]>(() =>
69
- vmKernelAdapterViewSettingsFunc(localization.value)
70
- )
71
-
72
- const tableHeadItems = computed<UI_I_TableHead[]>(() =>
73
- vmKernelAdapterViewSettingsTableHeadFunc(localization.value)
74
- )
75
-
76
- const tableBodyItems = computed<UI_I_BodyItems[][]>(() =>
77
- props.tableData.map(vmKernelAdapterTableBodyMapperFunc)
78
- )
79
-
80
- const selectedRowData = ref<UI_I_SelectedVmkernelAdapterTableRaw[]>(
81
- tableBodyItems.value.find(
82
- (item) => item[0].text === props.vmkernelAdapter.vm
83
- ) || []
84
- )
85
-
86
- const selectedRowKey = ref<number>(
87
- tableBodyItems.value.findIndex(
88
- (item) => item[0].text === props.vmkernelAdapter.vm
89
- )
90
- )
91
-
92
- const fields = ref<UI_I_SelectVmkernelAdapter>(
93
- useDeepCopy(props.vmkernelAdapter)
94
- )
95
-
96
- const onSelectRow = (index: number): void => {
97
- selectedRowData.value = tableBodyItems.value[index]
98
-
99
- const selectedVmkernelAdapter =
100
- selectedRowData.value &&
101
- selectedRowData.value[0] &&
102
- selectedRowData.value[0].text
103
-
104
- selectedVmkernelAdapter && (fields.value.vm = selectedVmkernelAdapter)
105
- }
106
-
107
- const emits = defineEmits<{
108
- (
109
- event: 'change-vmkernel-adapter',
110
- vmkernelAdapter: UI_I_SelectVmkernelAdapter
111
- ): void
112
- (event: 'hide-alert', stepId: 0): void
113
- }>()
114
-
115
- watch(
116
- fields,
117
- (newFields: UI_I_SelectVmkernelAdapter) => {
118
- emits('change-vmkernel-adapter', newFields)
119
- },
120
- { deep: true, immediate: true }
121
- )
122
-
123
- const onHideAlert = (): void => {
124
- emits('hide-alert', 0)
125
- }
126
- </script>
127
-
128
- <style scoped lang="scss">
129
- .wizard-content-container {
130
- display: flex;
131
- flex-direction: column;
132
- align-items: stretch;
133
- flex: 1 1 100%;
134
- box-sizing: border-box;
135
- padding: 0px 15px 0px 10px;
136
- overflow-y: auto;
137
- color: #333;
138
- order: 2;
139
- width: 100%;
140
- }
141
- .table-top-margin-container {
142
- margin-top: 20px;
143
- }
144
-
145
- :deep(.table-fixed-height) {
146
- max-height: 143px;
147
- min-height: 143px;
148
- }
149
- .no-item-info {
150
- span {
151
- font-size: 16px;
152
- font-weight: 700;
153
- color: #a0a0a0;
154
- }
155
- display: flex;
156
- justify-content: center;
157
- align-items: center;
158
- }
159
- </style>
1
+ <template>
2
+ <div class="wizard-content-container">
3
+ <div class="wizard-content wizard-content-port">
4
+ <atoms-alert
5
+ v-if="props.alertMessages.length"
6
+ status="alert-danger"
7
+ :items="props.alertMessages"
8
+ test-id="adapter-alert"
9
+ @remove="onHideAlert"
10
+ />
11
+ <div class="table-top-margin-container">
12
+ <atoms-table-simple-table
13
+ :head-items="tableHeadItems"
14
+ :body-items="tableBodyItems"
15
+ :selected-row-key="selectedRowKey"
16
+ editable
17
+ @select="onSelectRow"
18
+ />
19
+ </div>
20
+ <common-diagram-main-modals-view-settings-info
21
+ :show="!!selectedRowData.length"
22
+ :modal-tabs="modalTabs"
23
+ :view-settings-fields="viewSettingsFields"
24
+ :with-collapse="false"
25
+ />
26
+ <div
27
+ v-show="!selectedRowData.length"
28
+ class="table-fixed-height no-item-info"
29
+ >
30
+ <span>{{ localization.common.noItemSelected }}</span>
31
+ </div>
32
+ </div>
33
+ </div>
34
+ </template>
35
+
36
+ <script setup lang="ts">
37
+ import type { UI_I_ArbitraryObject, UI_I_Localization } from '~/lib/models/interfaces'
38
+ import type {
39
+ UI_I_BodyItems,
40
+ UI_I_ReadyCompleteFields,
41
+ UI_I_SelectVmkernelAdapter,
42
+ UI_I_TableHead,
43
+ } from '~/components/common/wizards/network/add/lib/models/interfaces'
44
+ import type {
45
+ UI_I_ModalTabs,
46
+ UI_I_SelectedVmkernelAdapterTableRaw,
47
+ UI_I_VmkernelAdapterTableData,
48
+ } from '~/components/common/diagramMain/lib/models/interfaces'
49
+ import {
50
+ vmKernelAdapterViewSettingsModalTabsFunc,
51
+ vmKernelAdapterViewSettingsTableHeadFunc,
52
+ vmKernelAdapterTableBodyMapperFunc,
53
+ vmKernelAdapterViewSettingsFunc,
54
+ } from '~/components/common/diagramMain/modals/lib/config'
55
+
56
+ const props = defineProps<{
57
+ tableData: UI_I_VmkernelAdapterTableData[]
58
+ vmkernelAdapter: UI_I_SelectVmkernelAdapter
59
+ alertMessages: string[]
60
+ }>()
61
+
62
+ const localization = computed<UI_I_Localization>(() => useLocal())
63
+
64
+ const modalTabs = computed<UI_I_ModalTabs[]>(() =>
65
+ vmKernelAdapterViewSettingsModalTabsFunc(localization.value)
66
+ )
67
+
68
+ const viewSettingsFields = computed<UI_I_ReadyCompleteFields[]>(() =>
69
+ vmKernelAdapterViewSettingsFunc(localization.value)
70
+ )
71
+
72
+ const tableHeadItems = computed<UI_I_TableHead[]>(() =>
73
+ vmKernelAdapterViewSettingsTableHeadFunc(localization.value)
74
+ )
75
+
76
+ const tableBodyItems = computed<UI_I_BodyItems[][]>(() =>
77
+ props.tableData.map(vmKernelAdapterTableBodyMapperFunc)
78
+ )
79
+
80
+ const selectedRowData = ref<UI_I_SelectedVmkernelAdapterTableRaw[]>(
81
+ tableBodyItems.value.find(
82
+ (item) => item[0].text === props.vmkernelAdapter.vm
83
+ ) || []
84
+ )
85
+
86
+ const selectedRowKey = ref<number>(
87
+ tableBodyItems.value.findIndex(
88
+ (item) => item[0].text === props.vmkernelAdapter.vm
89
+ )
90
+ )
91
+
92
+ const fields = ref<UI_I_SelectVmkernelAdapter>(
93
+ useDeepCopy(props.vmkernelAdapter)
94
+ )
95
+
96
+ const onSelectRow = (index: number): void => {
97
+ selectedRowData.value = tableBodyItems.value[index]
98
+
99
+ const selectedVmkernelAdapter =
100
+ selectedRowData.value &&
101
+ selectedRowData.value[0] &&
102
+ selectedRowData.value[0].text
103
+
104
+ selectedVmkernelAdapter && (fields.value.vm = selectedVmkernelAdapter)
105
+ }
106
+
107
+ const emits = defineEmits<{
108
+ (
109
+ event: 'change-vmkernel-adapter',
110
+ vmkernelAdapter: UI_I_SelectVmkernelAdapter
111
+ ): void
112
+ (event: 'hide-alert', stepId: 0): void
113
+ }>()
114
+
115
+ watch(
116
+ fields,
117
+ (newFields: UI_I_SelectVmkernelAdapter) => {
118
+ emits('change-vmkernel-adapter', newFields)
119
+ },
120
+ { deep: true, immediate: true }
121
+ )
122
+
123
+ const onHideAlert = (): void => {
124
+ emits('hide-alert', 0)
125
+ }
126
+ </script>
127
+
128
+ <style scoped lang="scss">
129
+ .wizard-content-container {
130
+ display: flex;
131
+ flex-direction: column;
132
+ align-items: stretch;
133
+ flex: 1 1 100%;
134
+ box-sizing: border-box;
135
+ padding: 0px 15px 0px 10px;
136
+ overflow-y: auto;
137
+ color: #333;
138
+ order: 2;
139
+ width: 100%;
140
+ }
141
+ .table-top-margin-container {
142
+ margin-top: 20px;
143
+ }
144
+
145
+ :deep(.table-fixed-height) {
146
+ max-height: 143px;
147
+ min-height: 143px;
148
+ }
149
+ .no-item-info {
150
+ span {
151
+ font-size: 16px;
152
+ font-weight: 700;
153
+ color: #a0a0a0;
154
+ }
155
+ display: flex;
156
+ justify-content: center;
157
+ align-items: center;
158
+ }
159
+ </style>
@@ -1,14 +1,14 @@
1
- export const isIntegerNumberInRange = (
2
- value: number | string | undefined,
3
- down: number,
4
- up: number
5
- ): boolean =>
6
- isNaN(Number(value)) ||
7
- Number(value) < down ||
8
- Number(value) > up ||
9
- Number(value) !== Math.round(Number(value))
10
-
11
- export const checkVlanId = (vlanId: string): boolean =>
12
- vlanId !== 'None (0)' &&
13
- vlanId !== 'All (4095)' &&
14
- (isIntegerNumberInRange(vlanId, 0, 4095) || vlanId === '')
1
+ export const isIntegerNumberInRange = (
2
+ value: number | string | undefined,
3
+ down: number,
4
+ up: number
5
+ ): boolean =>
6
+ isNaN(Number(value)) ||
7
+ Number(value) < down ||
8
+ Number(value) > up ||
9
+ Number(value) !== Math.round(Number(value))
10
+
11
+ export const checkVlanId = (vlanId: string): boolean =>
12
+ vlanId !== 'None (0)' &&
13
+ vlanId !== 'All (4095)' &&
14
+ (isIntegerNumberInRange(vlanId, 0, 4095) || vlanId === '')
@@ -1,137 +1,137 @@
1
- import type { UI_I_ConnectionSettings } from '~/components/common/wizards/network/add/lib/models/interfaces'
2
- import type { UI_I_MigrateVmkernelAdapterEmits } from '~/components/common/diagramMain/lib/models/interfaces'
3
- import type { UI_I_Localization } from '~/lib/models/interfaces'
4
- import type {
5
- UI_I_AsyncCheckReturn,
6
- UI_I_ValidationReturn,
7
- UI_I_WizardStep,
8
- } from '~/components/atoms/wizard/lib/models/interfaces'
9
- import { UI_E_MigrationValidationFields } from '~/components/common/diagramMain/lib/models/enums'
10
- import type Wizard from '~/components/atoms/wizard/lib/utils/utils'
11
- import { checkVlanId } from '~/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/common'
12
-
13
- export const validateVlanIdConnectionSettingsLocal = (
14
- localization: UI_I_Localization,
15
- data: UI_I_ConnectionSettings,
16
- wizard: Wizard
17
- ): void => {
18
- wizard.validateFieldLocal(
19
- 1,
20
- UI_E_MigrationValidationFields.CONNECTION_SETTINGS_VLAN,
21
- checkVlanId(data.vlanId),
22
- localization.common.vlanIdInvalidMessage,
23
- localization.common.vlanIdInvalidMessage
24
- )
25
- }
26
-
27
- export const validateNetworkConnectionSettingsLocal = (
28
- localization: UI_I_Localization,
29
- data: UI_I_ConnectionSettings,
30
- wizard: Wizard
31
- ): void => {
32
- wizard.validateFieldLocal(
33
- 1,
34
- UI_E_MigrationValidationFields.CONNECTION_SETTINGS_NETWORK,
35
- data.networkLabel === '',
36
- localization.common.networkLabelInvalidMessage,
37
- localization.common.networkLabelInvalidMessage
38
- )
39
- }
40
-
41
- export const checkConnectionSettingsSync = (
42
- localization: UI_I_Localization,
43
- data: UI_I_ConnectionSettings,
44
- wizard: Wizard,
45
- value: UI_I_WizardStep[]
46
- ): UI_I_ValidationReturn => {
47
- let stepHasError = false
48
-
49
- if (checkVlanId(data.vlanId)) {
50
- stepHasError = wizard.setValidation(
51
- 1,
52
- UI_E_MigrationValidationFields.CONNECTION_SETTINGS_VLAN,
53
- {
54
- fieldMessage: localization.common.vlanIdInvalidMessage,
55
- alertMessage: localization.common.vlanIdInvalidMessage,
56
- }
57
- )
58
- } else if (
59
- wizard.hasMessage(
60
- 1,
61
- UI_E_MigrationValidationFields.CONNECTION_SETTINGS_VLAN
62
- )
63
- ) {
64
- value = wizard.removeValidation(
65
- 1,
66
- UI_E_MigrationValidationFields.CONNECTION_SETTINGS_VLAN,
67
- value
68
- )
69
- }
70
-
71
- return {
72
- newValue: value,
73
- stepHasError,
74
- }
75
- }
76
-
77
- const checkNetwork = async (
78
- label: string,
79
- localization: UI_I_Localization,
80
- emits: UI_I_MigrateVmkernelAdapterEmits
81
- ): Promise<UI_I_AsyncCheckReturn> => {
82
- if (label) {
83
- return new Promise((resolve, _reject) =>
84
- emits('check-network-label', label, (message: string) => {
85
- if (message === '') {
86
- resolve({
87
- isValid: true,
88
- message: '',
89
- })
90
- }
91
-
92
- if (message !== '') {
93
- resolve({
94
- isValid: false,
95
- message,
96
- })
97
- }
98
- })
99
- )
100
- } else {
101
- return {
102
- isValid: false,
103
- message: localization.common.networkLabelInvalidMessage,
104
- }
105
- }
106
- }
107
-
108
- export const checkNetworkAsync = async (
109
- value: UI_I_WizardStep[],
110
- label: string,
111
- stepId: number,
112
- fieldName: string,
113
- emits: UI_I_MigrateVmkernelAdapterEmits,
114
- localization: UI_I_Localization,
115
- wizard: Wizard
116
- ): Promise<UI_I_ValidationReturn> => {
117
- let stepHasError = false
118
-
119
- const labelValidation: {
120
- isValid: boolean
121
- message: string
122
- } = await checkNetwork(label, localization, emits)
123
-
124
- if (!labelValidation.isValid) {
125
- stepHasError = wizard.setValidation(stepId, fieldName, {
126
- fieldMessage: labelValidation.message,
127
- alertMessage: labelValidation.message,
128
- })
129
- } else if (wizard.hasMessage(stepId, fieldName)) {
130
- value = wizard.removeValidation(stepId, fieldName, value)
131
- }
132
-
133
- return {
134
- newValue: value,
135
- stepHasError,
136
- }
137
- }
1
+ import type { UI_I_ConnectionSettings } from '~/components/common/wizards/network/add/lib/models/interfaces'
2
+ import type { UI_I_MigrateVmkernelAdapterEmits } from '~/components/common/diagramMain/lib/models/interfaces'
3
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
4
+ import type {
5
+ UI_I_AsyncCheckReturn,
6
+ UI_I_ValidationReturn,
7
+ UI_I_WizardStep,
8
+ } from '~/components/atoms/wizard/lib/models/interfaces'
9
+ import { UI_E_MigrationValidationFields } from '~/components/common/diagramMain/lib/models/enums'
10
+ import type Wizard from '~/components/atoms/wizard/lib/utils/utils'
11
+ import { checkVlanId } from '~/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/common'
12
+
13
+ export const validateVlanIdConnectionSettingsLocal = (
14
+ localization: UI_I_Localization,
15
+ data: UI_I_ConnectionSettings,
16
+ wizard: Wizard
17
+ ): void => {
18
+ wizard.validateFieldLocal(
19
+ 1,
20
+ UI_E_MigrationValidationFields.CONNECTION_SETTINGS_VLAN,
21
+ checkVlanId(data.vlanId),
22
+ localization.common.vlanIdInvalidMessage,
23
+ localization.common.vlanIdInvalidMessage
24
+ )
25
+ }
26
+
27
+ export const validateNetworkConnectionSettingsLocal = (
28
+ localization: UI_I_Localization,
29
+ data: UI_I_ConnectionSettings,
30
+ wizard: Wizard
31
+ ): void => {
32
+ wizard.validateFieldLocal(
33
+ 1,
34
+ UI_E_MigrationValidationFields.CONNECTION_SETTINGS_NETWORK,
35
+ data.networkLabel === '',
36
+ localization.common.networkLabelInvalidMessage,
37
+ localization.common.networkLabelInvalidMessage
38
+ )
39
+ }
40
+
41
+ export const checkConnectionSettingsSync = (
42
+ localization: UI_I_Localization,
43
+ data: UI_I_ConnectionSettings,
44
+ wizard: Wizard,
45
+ value: UI_I_WizardStep[]
46
+ ): UI_I_ValidationReturn => {
47
+ let stepHasError = false
48
+
49
+ if (checkVlanId(data.vlanId)) {
50
+ stepHasError = wizard.setValidation(
51
+ 1,
52
+ UI_E_MigrationValidationFields.CONNECTION_SETTINGS_VLAN,
53
+ {
54
+ fieldMessage: localization.common.vlanIdInvalidMessage,
55
+ alertMessage: localization.common.vlanIdInvalidMessage,
56
+ }
57
+ )
58
+ } else if (
59
+ wizard.hasMessage(
60
+ 1,
61
+ UI_E_MigrationValidationFields.CONNECTION_SETTINGS_VLAN
62
+ )
63
+ ) {
64
+ value = wizard.removeValidation(
65
+ 1,
66
+ UI_E_MigrationValidationFields.CONNECTION_SETTINGS_VLAN,
67
+ value
68
+ )
69
+ }
70
+
71
+ return {
72
+ newValue: value,
73
+ stepHasError,
74
+ }
75
+ }
76
+
77
+ const checkNetwork = async (
78
+ label: string,
79
+ localization: UI_I_Localization,
80
+ emits: UI_I_MigrateVmkernelAdapterEmits
81
+ ): Promise<UI_I_AsyncCheckReturn> => {
82
+ if (label) {
83
+ return new Promise((resolve, _reject) =>
84
+ emits('check-network-label', label, (message: string) => {
85
+ if (message === '') {
86
+ resolve({
87
+ isValid: true,
88
+ message: '',
89
+ })
90
+ }
91
+
92
+ if (message !== '') {
93
+ resolve({
94
+ isValid: false,
95
+ message,
96
+ })
97
+ }
98
+ })
99
+ )
100
+ } else {
101
+ return {
102
+ isValid: false,
103
+ message: localization.common.networkLabelInvalidMessage,
104
+ }
105
+ }
106
+ }
107
+
108
+ export const checkNetworkAsync = async (
109
+ value: UI_I_WizardStep[],
110
+ label: string,
111
+ stepId: number,
112
+ fieldName: string,
113
+ emits: UI_I_MigrateVmkernelAdapterEmits,
114
+ localization: UI_I_Localization,
115
+ wizard: Wizard
116
+ ): Promise<UI_I_ValidationReturn> => {
117
+ let stepHasError = false
118
+
119
+ const labelValidation: {
120
+ isValid: boolean
121
+ message: string
122
+ } = await checkNetwork(label, localization, emits)
123
+
124
+ if (!labelValidation.isValid) {
125
+ stepHasError = wizard.setValidation(stepId, fieldName, {
126
+ fieldMessage: labelValidation.message,
127
+ alertMessage: labelValidation.message,
128
+ })
129
+ } else if (wizard.hasMessage(stepId, fieldName)) {
130
+ value = wizard.removeValidation(stepId, fieldName, value)
131
+ }
132
+
133
+ return {
134
+ newValue: value,
135
+ stepHasError,
136
+ }
137
+ }