bfg-common 1.2.186 → 1.2.187
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/assets/localization/local_be.json +9 -2
- package/assets/localization/local_en.json +9 -2
- package/assets/localization/local_hy.json +9 -2
- package/assets/localization/local_kk.json +9 -2
- package/assets/localization/local_ru.json +9 -2
- package/assets/localization/local_zh.json +9 -2
- package/assets/scss/common/theme.scss +27 -25
- package/components/atoms/table/simpleTable/SimpleTable.vue +5 -2
- package/components/atoms/wizard/Wizard.vue +4 -4
- package/components/atoms/wizard/models/interfaces.ts +4 -3
- package/components/atoms/wizard/utils/utils.ts +106 -27
- package/components/common/diagramMain/DiagramMain.vue +10 -46
- package/components/common/diagramMain/modals/config/index.ts +0 -6
- package/components/common/diagramMain/modals/config/vmKernelAdapter.ts +2 -2
- package/components/common/diagramMain/modals/editSettings/tabs/NetworkProperties.vue +1 -1
- package/components/common/diagramMain/modals/editSettings/tabs/port/IpvFourSettings.vue +339 -339
- package/components/common/diagramMain/modals/migrateVmkernelAdapter/MigrateVmkernelAdapter.vue +531 -0
- package/components/common/diagramMain/modals/migrateVmkernelAdapter/config/steps.ts +114 -0
- package/components/common/diagramMain/modals/migrateVmkernelAdapter/steps/ConnectionSettings.vue +161 -0
- package/components/common/diagramMain/modals/{steps → migrateVmkernelAdapter/steps}/SelectVmkernelAdapter.vue +24 -86
- package/components/common/diagramMain/modals/{steps → migrateVmkernelAdapter/steps}/VmkernelAdapterReadyComplete.vue +7 -11
- package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/common.ts +47 -0
- package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/connectionSettings.ts +146 -0
- package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/selectVmkernelAdapter.ts +54 -0
- package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/validations.ts +19 -0
- package/components/common/diagramMain/models/enums.ts +6 -7
- package/components/common/diagramMain/models/interfaces.ts +28 -29
- package/components/common/diagramMain/models/types.ts +0 -1
- package/components/common/monitor/advanced/Advanced.vue +5 -4
- package/components/common/wizards/network/add/Add.vue +874 -0
- package/components/common/{addNetworking → wizards/network/add}/config/index.ts +2 -16
- package/components/common/{addNetworking → wizards/network/add}/config/initialData.ts +4 -19
- package/components/common/{addNetworking → wizards/network/add}/config/portPropertiesStep.ts +1 -1
- package/components/common/{addNetworking → wizards/network/add}/config/selectSwitch.ts +1 -1
- package/components/common/{addNetworking → wizards/network/add}/config/sendData.ts +1 -1
- package/components/common/{addNetworking/config/addNetworkingSteps.ts → wizards/network/add/config/steps.ts} +107 -60
- package/components/common/{addNetworking → wizards/network/add}/modals/SelectNetwork.vue +2 -2
- package/components/common/{addNetworking → wizards/network/add}/modals/SelectStandardSwitch.vue +2 -2
- package/components/common/{addNetworking → wizards/network/add}/modals/SelectSwitch.vue +2 -2
- package/components/common/wizards/network/add/models/enums.ts +17 -0
- package/components/common/{addNetworking → wizards/network/add}/models/interfaces.ts +30 -37
- package/components/common/wizards/network/add/models/types.ts +2 -0
- package/components/common/wizards/network/add/steps/ConnectionSettings.vue +148 -0
- package/components/common/{addNetworking → wizards/network/add}/steps/CreateStandardSwitch.vue +0 -7
- package/components/common/wizards/network/add/steps/IpFourSettings.vue +245 -0
- package/components/common/{addNetworking → wizards/network/add}/steps/PhysicalAdapter.vue +1 -12
- package/components/common/{addNetworking → wizards/network/add}/steps/PortProperties.vue +57 -180
- package/components/common/{addNetworking → wizards/network/add}/steps/ReadyComplete.vue +1 -10
- package/components/common/{addNetworking → wizards/network/add}/steps/SelectConnectionType.vue +3 -15
- package/components/common/{addNetworking → wizards/network/add}/steps/SelectedTargetDevice.vue +103 -209
- package/components/common/wizards/network/add/utils/index.ts +4 -0
- package/components/common/wizards/network/add/validations/common.ts +58 -0
- package/components/common/wizards/network/add/validations/connectionSettings.ts +75 -0
- package/components/common/wizards/network/add/validations/createStandardSwitch.ts +58 -0
- package/components/common/wizards/network/add/validations/ipFourSettings.ts +188 -0
- package/components/common/wizards/network/add/validations/networkValidation.ts +73 -0
- package/components/common/wizards/network/add/validations/portProperties.ts +87 -0
- package/components/common/wizards/network/add/validations/targetDevice.ts +113 -0
- package/components/common/wizards/network/add/validations/validations.ts +43 -0
- package/components/common/wizards/vm/migrate/select/computeResource/ComputeResource.vue +2 -0
- package/package.json +1 -1
- package/components/common/addNetworking/AddNetworking.vue +0 -1123
- package/components/common/addNetworking/Wizard.vue +0 -286
- package/components/common/addNetworking/config/temporaryData.ts +0 -8
- package/components/common/addNetworking/config/validation.ts +0 -23
- package/components/common/addNetworking/models/enums.ts +0 -7
- package/components/common/addNetworking/models/types.ts +0 -13
- package/components/common/addNetworking/steps/ConnectionSettings.vue +0 -269
- package/components/common/addNetworking/steps/Header.vue +0 -53
- package/components/common/addNetworking/steps/IpFourSettings.vue +0 -361
- package/components/common/addNetworking/utils/index.ts +0 -212
- package/components/common/diagramMain/modals/MigrateVmkernelAdapter.vue +0 -603
- package/components/common/diagramMain/modals/config/migrateVmkernelAdapterSteps.ts +0 -81
- package/components/common/diagramMain/modals/config/validation.ts +0 -3
- package/components/common/diagramMain/modals/steps/ConnectionSettings.vue +0 -221
- package/components/common/diagramMain/modals/steps/Header.vue +0 -60
- /package/components/common/{addNetworking → wizards/network/add}/mappers/mappers.ts +0 -0
package/components/common/{addNetworking → wizards/network/add}/steps/SelectConnectionType.vue
RENAMED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="wizard-content-container add-networking-step">
|
|
3
|
-
<common-add-networking-steps-header
|
|
4
|
-
:title="props.title"
|
|
5
|
-
:text="props.text"
|
|
6
|
-
/>
|
|
7
3
|
<div class="wizard-content">
|
|
8
4
|
<form @change="onChangeConnectionType">
|
|
9
5
|
<div class="radio">
|
|
@@ -59,23 +55,18 @@
|
|
|
59
55
|
<script setup lang="ts">
|
|
60
56
|
import { UI_I_Localization } from '~/models/interfaces'
|
|
61
57
|
|
|
62
|
-
// Props from up
|
|
63
58
|
const props = defineProps<{
|
|
64
|
-
title: string
|
|
65
|
-
text: string
|
|
66
|
-
stepId: number
|
|
67
59
|
connectionType: string
|
|
68
60
|
}>()
|
|
69
61
|
|
|
70
|
-
// UI_I_Localization
|
|
71
62
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
72
63
|
|
|
73
|
-
// Changing data
|
|
74
64
|
const emits = defineEmits<{
|
|
75
65
|
(event: 'change-connection-type', connectionType: string): void
|
|
76
66
|
}>()
|
|
77
|
-
const onChangeConnectionType = (newConnectionType:
|
|
78
|
-
|
|
67
|
+
const onChangeConnectionType = (newConnectionType: Event): void => {
|
|
68
|
+
const target = newConnectionType.target as HTMLFormElement
|
|
69
|
+
emits('change-connection-type', target?.value)
|
|
79
70
|
}
|
|
80
71
|
</script>
|
|
81
72
|
|
|
@@ -84,7 +75,6 @@ const onChangeConnectionType = (newConnectionType: any): void => {
|
|
|
84
75
|
height: auto;
|
|
85
76
|
width: inherit;
|
|
86
77
|
margin: 0;
|
|
87
|
-
padding-top: 12px;
|
|
88
78
|
|
|
89
79
|
.radio {
|
|
90
80
|
min-height: 20px;
|
|
@@ -101,6 +91,4 @@ const onChangeConnectionType = (newConnectionType: any): void => {
|
|
|
101
91
|
color: #333;
|
|
102
92
|
}
|
|
103
93
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
94
|
</style>
|
package/components/common/{addNetworking → wizards/network/add}/steps/SelectedTargetDevice.vue
RENAMED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="wizard-content-container add-networking-step">
|
|
3
|
-
<common-add-networking-steps-header
|
|
4
|
-
:title="props.title"
|
|
5
|
-
:text="props.text"
|
|
6
|
-
/>
|
|
7
3
|
<div class="wizard-content">
|
|
8
4
|
<atoms-alert
|
|
9
|
-
v-if="
|
|
5
|
+
v-if="props.alertMessages.length"
|
|
10
6
|
status="alert-danger"
|
|
11
|
-
:items="props.
|
|
12
|
-
@remove="
|
|
7
|
+
:items="props.alertMessages"
|
|
8
|
+
@remove="onHideAlert"
|
|
13
9
|
/>
|
|
14
10
|
<form>
|
|
15
11
|
<div v-show="props.connectionType === '0'">
|
|
@@ -31,14 +27,42 @@
|
|
|
31
27
|
}"
|
|
32
28
|
>
|
|
33
29
|
<div>
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
<atoms-tooltip-error
|
|
31
|
+
:has-error="
|
|
32
|
+
fields.selected === '0' &&
|
|
33
|
+
!!props.messagesFields.network.field
|
|
34
|
+
"
|
|
39
35
|
>
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
<template #elem>
|
|
37
|
+
<fieldset class="fieldset-block">
|
|
38
|
+
<div>
|
|
39
|
+
<input
|
|
40
|
+
v-model="fields.network"
|
|
41
|
+
type="text"
|
|
42
|
+
disabled
|
|
43
|
+
:class="[
|
|
44
|
+
'tooltip-field show-arrow',
|
|
45
|
+
{
|
|
46
|
+
'danger-not-valid':
|
|
47
|
+
fields.selected === '0' &&
|
|
48
|
+
props.messagesFields.network.field,
|
|
49
|
+
},
|
|
50
|
+
]"
|
|
51
|
+
/>
|
|
52
|
+
<button
|
|
53
|
+
type="button"
|
|
54
|
+
class="btn btn-link"
|
|
55
|
+
@click="onShowModal('select-network')"
|
|
56
|
+
>
|
|
57
|
+
{{ localization.browseDoted }}
|
|
58
|
+
</button>
|
|
59
|
+
</div>
|
|
60
|
+
</fieldset>
|
|
61
|
+
</template>
|
|
62
|
+
<template #content>
|
|
63
|
+
{{ props.messagesFields.network.field }}
|
|
64
|
+
</template>
|
|
65
|
+
</atoms-tooltip-error>
|
|
42
66
|
</div>
|
|
43
67
|
</fieldset>
|
|
44
68
|
</div>
|
|
@@ -66,8 +90,7 @@
|
|
|
66
90
|
<div>
|
|
67
91
|
<atoms-tooltip-error
|
|
68
92
|
:has-error="
|
|
69
|
-
fields.selected === '1' &&
|
|
70
|
-
!!fieldsErrorMessages.standardSwitch
|
|
93
|
+
fields.selected === '1' && !!props.messagesFields.switch.field
|
|
71
94
|
"
|
|
72
95
|
>
|
|
73
96
|
<template #elem>
|
|
@@ -82,7 +105,7 @@
|
|
|
82
105
|
{
|
|
83
106
|
'danger-not-valid':
|
|
84
107
|
fields.selected === '1' &&
|
|
85
|
-
|
|
108
|
+
props.messagesFields.switch.field,
|
|
86
109
|
},
|
|
87
110
|
]"
|
|
88
111
|
/>
|
|
@@ -97,7 +120,7 @@
|
|
|
97
120
|
</fieldset>
|
|
98
121
|
</template>
|
|
99
122
|
<template #content>
|
|
100
|
-
{{
|
|
123
|
+
{{ props.messagesFields.switch.field }}
|
|
101
124
|
</template>
|
|
102
125
|
</atoms-tooltip-error>
|
|
103
126
|
</div>
|
|
@@ -124,14 +147,42 @@
|
|
|
124
147
|
}"
|
|
125
148
|
>
|
|
126
149
|
<div>
|
|
127
|
-
<
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
150
|
+
<atoms-tooltip-error
|
|
151
|
+
:has-error="
|
|
152
|
+
fields.selected === '2' &&
|
|
153
|
+
!!props.messagesFields.switch2.field
|
|
154
|
+
"
|
|
132
155
|
>
|
|
133
|
-
|
|
134
|
-
|
|
156
|
+
<template #elem>
|
|
157
|
+
<fieldset class="fieldset-block">
|
|
158
|
+
<div>
|
|
159
|
+
<input
|
|
160
|
+
v-model="fields.switch"
|
|
161
|
+
type="text"
|
|
162
|
+
disabled
|
|
163
|
+
:class="[
|
|
164
|
+
'tooltip-field show-arrow',
|
|
165
|
+
{
|
|
166
|
+
'danger-not-valid':
|
|
167
|
+
fields.selected === '2' &&
|
|
168
|
+
props.messagesFields.switch2.field,
|
|
169
|
+
},
|
|
170
|
+
]"
|
|
171
|
+
/>
|
|
172
|
+
<button
|
|
173
|
+
type="button"
|
|
174
|
+
class="btn btn-link"
|
|
175
|
+
@click="onShowModal('select-switch')"
|
|
176
|
+
>
|
|
177
|
+
{{ localization.browseDoted }}
|
|
178
|
+
</button>
|
|
179
|
+
</div>
|
|
180
|
+
</fieldset>
|
|
181
|
+
</template>
|
|
182
|
+
<template #content>
|
|
183
|
+
{{ props.messagesFields.switch2.field }}
|
|
184
|
+
</template>
|
|
185
|
+
</atoms-tooltip-error>
|
|
135
186
|
</div>
|
|
136
187
|
</fieldset>
|
|
137
188
|
</div>
|
|
@@ -162,7 +213,11 @@
|
|
|
162
213
|
<div class="margin-left-property-value-group">
|
|
163
214
|
<div class="property-value-group tooltip-field-container">
|
|
164
215
|
<fieldset>
|
|
165
|
-
<atoms-tooltip-error
|
|
216
|
+
<atoms-tooltip-error
|
|
217
|
+
:has-error="
|
|
218
|
+
!!props.messagesFields['new_switch.mtu'].field
|
|
219
|
+
"
|
|
220
|
+
>
|
|
166
221
|
<template #elem>
|
|
167
222
|
<input
|
|
168
223
|
id="mtu"
|
|
@@ -172,14 +227,15 @@
|
|
|
172
227
|
:class="[
|
|
173
228
|
'tooltip-field show-arrow',
|
|
174
229
|
{
|
|
175
|
-
'danger-not-valid':
|
|
230
|
+
'danger-not-valid':
|
|
231
|
+
props.messagesFields['new_switch.mtu'].field,
|
|
176
232
|
},
|
|
177
233
|
]"
|
|
178
234
|
@click.stop
|
|
179
235
|
/>
|
|
180
236
|
</template>
|
|
181
237
|
<template #content>
|
|
182
|
-
{{
|
|
238
|
+
{{ props.messagesFields['new_switch.mtu'].field }}
|
|
183
239
|
</template>
|
|
184
240
|
</atoms-tooltip-error>
|
|
185
241
|
</fieldset>
|
|
@@ -209,7 +265,7 @@
|
|
|
209
265
|
width="576px"
|
|
210
266
|
height="468px"
|
|
211
267
|
:title="localization.selectSwitch"
|
|
212
|
-
:data="
|
|
268
|
+
:data="[]"
|
|
213
269
|
:show="isShowSwitchModal"
|
|
214
270
|
@select-switch="onSelectSwitch"
|
|
215
271
|
@hide="onHideSwitchModal"
|
|
@@ -220,7 +276,7 @@
|
|
|
220
276
|
width="576px"
|
|
221
277
|
height="468px"
|
|
222
278
|
:title="localization.selectNetwork"
|
|
223
|
-
:data="
|
|
279
|
+
:data="[]"
|
|
224
280
|
:show="isShowNetworkModal"
|
|
225
281
|
@select-network="onSelectNetwork"
|
|
226
282
|
@hide="onHideNetworkModal"
|
|
@@ -234,195 +290,42 @@ import {
|
|
|
234
290
|
UI_I_TargetDevice,
|
|
235
291
|
UI_I_Switch,
|
|
236
292
|
UI_I_Network,
|
|
237
|
-
|
|
238
|
-
} from '~/components/
|
|
239
|
-
import
|
|
240
|
-
|
|
241
|
-
temporaryNetworks,
|
|
242
|
-
targetDeviceFieldsErrorMessages,
|
|
243
|
-
} from '~/components/common/addNetworking/config'
|
|
244
|
-
import { UI_T_TargetDeviceFieldName } from '~/components/common/addNetworking/models/types'
|
|
293
|
+
} from '~/components/common/wizards/network/add/models/interfaces'
|
|
294
|
+
import { UI_I_ErrorFields } from '~/components/atoms/wizard/models/interfaces'
|
|
295
|
+
import type Wizard from '~/components/atoms/wizard/utils/utils'
|
|
296
|
+
import { validateMtuTargetDeviceLocal } from '~/components/common/wizards/network/add/validations/validations'
|
|
245
297
|
|
|
246
|
-
// Props from up
|
|
247
298
|
const props = defineProps<{
|
|
248
|
-
title: string
|
|
249
|
-
text: string
|
|
250
|
-
stepId: number
|
|
251
|
-
connectionType: string
|
|
252
299
|
targetDevice: UI_I_TargetDevice
|
|
253
|
-
|
|
254
|
-
errorMessages: string[]
|
|
300
|
+
connectionType: string
|
|
255
301
|
standardSwitchesInitial: UI_I_Switch[]
|
|
256
|
-
|
|
302
|
+
alertMessages: string[]
|
|
303
|
+
messagesFields: UI_I_ArbitraryObject<UI_I_ErrorFields>
|
|
304
|
+
wizard: Wizard
|
|
257
305
|
}>()
|
|
258
306
|
|
|
259
|
-
// UI_I_Localization
|
|
260
307
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
261
308
|
|
|
262
|
-
// Define emits for changing data and validation messages
|
|
263
309
|
const emits = defineEmits<{
|
|
264
310
|
(event: 'change-target-device', targetDevice: UI_I_TargetDevice): void
|
|
265
|
-
(
|
|
266
|
-
event: 'change-error-messages',
|
|
267
|
-
errorMessages: string[],
|
|
268
|
-
stepIndex: number
|
|
269
|
-
): void
|
|
270
|
-
(event: 'hide-error-message-alert'): void
|
|
271
|
-
(event: 'set-error-empty', fieldName: string): void
|
|
311
|
+
(event: 'hide-alert', stepId: 2): void
|
|
272
312
|
}>()
|
|
273
313
|
|
|
274
314
|
const isConnectionTypeFirstTwo = computed<boolean>(() =>
|
|
275
315
|
['0', '1'].includes(props.connectionType)
|
|
276
316
|
)
|
|
277
317
|
|
|
278
|
-
// Validation error check for this step
|
|
279
|
-
const hasValidationError = computed<boolean>(
|
|
280
|
-
() => props.isShowErrorMessageAlert && !!props.errorMessages.length
|
|
281
|
-
)
|
|
282
|
-
|
|
283
318
|
const fields = ref<UI_I_TargetDevice>(useDeepCopy(props.targetDevice))
|
|
284
319
|
|
|
285
|
-
|
|
286
|
-
targetDeviceFieldsErrorMessages
|
|
287
|
-
)
|
|
288
|
-
|
|
289
|
-
const messageTexts = (
|
|
290
|
-
local: UI_I_Localization
|
|
291
|
-
): UI_I_ArbitraryObject<string> => ({
|
|
292
|
-
network: local.networkInvalidMessage,
|
|
293
|
-
switch: local.switchInvalidMessage,
|
|
294
|
-
standardSwitch: local.standardSwitchInvalidMessage,
|
|
295
|
-
mtu: local.mtuInvalidMessage,
|
|
296
|
-
})
|
|
297
|
-
|
|
298
|
-
const isIntegerNumberInRange = (
|
|
299
|
-
value: number | string | undefined,
|
|
300
|
-
down: number,
|
|
301
|
-
up: number
|
|
302
|
-
) =>
|
|
303
|
-
isNaN(Number(value)) ||
|
|
304
|
-
Number(value) < down ||
|
|
305
|
-
Number(value) > up ||
|
|
306
|
-
Number(value) !== Math.round(Number(value))
|
|
307
|
-
|
|
308
|
-
const setMessageOnChangedField = (
|
|
309
|
-
selected: string,
|
|
310
|
-
values: UI_I_TargetDevice,
|
|
311
|
-
name: UI_T_TargetDeviceFieldName,
|
|
312
|
-
text: string
|
|
313
|
-
): void => {
|
|
314
|
-
if (
|
|
315
|
-
selected === '3' &&
|
|
316
|
-
name === 'mtu' &&
|
|
317
|
-
(values.mtu === 0 ? '0' : values.mtu) &&
|
|
318
|
-
isIntegerNumberInRange(values.mtu, 1280, 65535)
|
|
319
|
-
) {
|
|
320
|
-
fieldsErrorMessages.value[name] = text
|
|
321
|
-
return
|
|
322
|
-
}
|
|
323
|
-
if (selected === '0' && name === 'network' && !values.network) {
|
|
324
|
-
fieldsErrorMessages.value[name] = text
|
|
325
|
-
return
|
|
326
|
-
}
|
|
327
|
-
if (selected === '2' && name === 'switch' && !values.switch) {
|
|
328
|
-
fieldsErrorMessages.value[name] = text
|
|
329
|
-
return
|
|
330
|
-
}
|
|
331
|
-
if (selected === '1' && name === 'standardSwitch' && !values.standardSwitch) {
|
|
332
|
-
fieldsErrorMessages.value[name] = text
|
|
333
|
-
return
|
|
334
|
-
}
|
|
335
|
-
fieldsErrorMessages.value[name] = ''
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
watch(
|
|
339
|
-
() => props.error,
|
|
340
|
-
(newError) => {
|
|
341
|
-
fieldsErrorMessages.value = {
|
|
342
|
-
network: '',
|
|
343
|
-
switch: '',
|
|
344
|
-
standardSwitch: newError.switch,
|
|
345
|
-
mtu: newError['new_switch.mtu'],
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
const fieldsErrorMessagesFiltered = Object.values(
|
|
349
|
-
fieldsErrorMessages.value
|
|
350
|
-
).filter(
|
|
351
|
-
(errorMessage: string | undefined) =>
|
|
352
|
-
errorMessage !== '' && errorMessage !== undefined
|
|
353
|
-
)
|
|
354
|
-
|
|
355
|
-
emits('change-error-messages', fieldsErrorMessagesFiltered, props.stepId)
|
|
356
|
-
},
|
|
357
|
-
{ deep: true, immediate: true }
|
|
358
|
-
)
|
|
359
|
-
|
|
360
|
-
const oldFields = ref<any>(useDeepCopy(fields.value))
|
|
361
|
-
|
|
362
|
-
const cacheOldFields = (newFields: UI_I_TargetDevice): void => {
|
|
363
|
-
oldFields.value = useDeepCopy(newFields)
|
|
364
|
-
}
|
|
320
|
+
let prevMtu = fields.value.mtu
|
|
365
321
|
|
|
366
|
-
const setErrorEmpty = (
|
|
367
|
-
newValue: UI_I_TargetDevice,
|
|
368
|
-
oldValue: UI_I_TargetDevice,
|
|
369
|
-
fieldName: keyof UI_I_TargetDevice,
|
|
370
|
-
errFieldName: string
|
|
371
|
-
): void => {
|
|
372
|
-
;(newValue[fieldName] !== oldValue[fieldName] ||
|
|
373
|
-
newValue.selected !== oldValue.selected) &&
|
|
374
|
-
emits('set-error-empty', errFieldName)
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
// Changing data and validate they
|
|
378
322
|
watch(
|
|
379
323
|
fields,
|
|
380
324
|
(newFields: UI_I_TargetDevice) => {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
setErrorEmpty(newFields, oldFields.value, 'standardSwitch', 'switch')
|
|
384
|
-
setErrorEmpty(newFields, oldFields.value, 'network', 'network')
|
|
385
|
-
setErrorEmpty(newFields, oldFields.value, 'switch', 'switch')
|
|
386
|
-
setErrorEmpty(newFields, oldFields.value, 'mtu', 'new_switch.mtu')
|
|
387
|
-
|
|
388
|
-
cacheOldFields(newFields)
|
|
389
|
-
|
|
390
|
-
setMessageOnChangedField(
|
|
391
|
-
newFields.selected,
|
|
392
|
-
newFields,
|
|
393
|
-
'mtu',
|
|
394
|
-
messageTexts(localization.value).mtu
|
|
395
|
-
)
|
|
396
|
-
|
|
397
|
-
setMessageOnChangedField(
|
|
398
|
-
newFields.selected,
|
|
399
|
-
newFields,
|
|
400
|
-
'network',
|
|
401
|
-
messageTexts(localization.value).network
|
|
402
|
-
)
|
|
325
|
+
newFields.mtu !== prevMtu &&
|
|
326
|
+
validateMtuTargetDeviceLocal(localization.value, newFields, props.wizard)
|
|
403
327
|
|
|
404
|
-
|
|
405
|
-
newFields.selected,
|
|
406
|
-
newFields,
|
|
407
|
-
'switch',
|
|
408
|
-
messageTexts(localization.value).switch
|
|
409
|
-
)
|
|
410
|
-
|
|
411
|
-
setMessageOnChangedField(
|
|
412
|
-
newFields.selected,
|
|
413
|
-
newFields,
|
|
414
|
-
'standardSwitch',
|
|
415
|
-
messageTexts(localization.value).standardSwitch
|
|
416
|
-
)
|
|
417
|
-
|
|
418
|
-
const fieldsErrorMessagesFiltered = Object.values(
|
|
419
|
-
fieldsErrorMessages.value
|
|
420
|
-
).filter((errorMessage: string) => errorMessage !== '')
|
|
421
|
-
|
|
422
|
-
fieldsErrorMessagesFiltered.length === 0 &&
|
|
423
|
-
emits('hide-error-message-alert')
|
|
424
|
-
|
|
425
|
-
emits('change-error-messages', fieldsErrorMessagesFiltered, props.stepId)
|
|
328
|
+
prevMtu = newFields.mtu
|
|
426
329
|
|
|
427
330
|
emits('change-target-device', newFields)
|
|
428
331
|
},
|
|
@@ -459,9 +362,7 @@ const onShowModal = (value: string): void => {
|
|
|
459
362
|
|
|
460
363
|
// Switches selection functionality
|
|
461
364
|
const onSelectSwitch = (selectedSwitchId: string): void => {
|
|
462
|
-
fields.value.switch =
|
|
463
|
-
(switchData: UI_I_Switch) => switchData.id === selectedSwitchId
|
|
464
|
-
)?.name
|
|
365
|
+
fields.value.switch = ''
|
|
465
366
|
}
|
|
466
367
|
const onSelectStandardSwitch = (selectedSwitchId: string): void => {
|
|
467
368
|
const selectedSwitch = props.standardSwitchesInitial.find(
|
|
@@ -470,9 +371,7 @@ const onSelectStandardSwitch = (selectedSwitchId: string): void => {
|
|
|
470
371
|
fields.value.standardSwitch = selectedSwitch?.name
|
|
471
372
|
}
|
|
472
373
|
const onSelectNetwork = (selectedNetworkId: string): void => {
|
|
473
|
-
fields.value.network =
|
|
474
|
-
(networkData: UI_I_Network) => networkData.id === selectedNetworkId
|
|
475
|
-
)?.name
|
|
374
|
+
fields.value.network = ''
|
|
476
375
|
}
|
|
477
376
|
|
|
478
377
|
watch(
|
|
@@ -485,13 +384,9 @@ watch(
|
|
|
485
384
|
{ deep: true, immediate: true }
|
|
486
385
|
)
|
|
487
386
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
emits('hide-error-message-alert')
|
|
387
|
+
const onHideAlert = (): void => {
|
|
388
|
+
emits('hide-alert', 1)
|
|
491
389
|
}
|
|
492
|
-
onUnmounted(() => {
|
|
493
|
-
emits('hide-error-message-alert')
|
|
494
|
-
})
|
|
495
390
|
</script>
|
|
496
391
|
|
|
497
392
|
<style scoped lang="scss">
|
|
@@ -511,7 +406,6 @@ onUnmounted(() => {
|
|
|
511
406
|
height: auto;
|
|
512
407
|
width: inherit;
|
|
513
408
|
margin: 0;
|
|
514
|
-
padding-top: 12px;
|
|
515
409
|
|
|
516
410
|
fieldset {
|
|
517
411
|
display: flex;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type Wizard from '~/components/atoms/wizard/utils/utils'
|
|
2
|
+
|
|
3
|
+
export const isIntegerNumberInRange = (
|
|
4
|
+
value: number | string | undefined,
|
|
5
|
+
down: number,
|
|
6
|
+
up: number
|
|
7
|
+
): boolean =>
|
|
8
|
+
isNaN(Number(value)) ||
|
|
9
|
+
Number(value) < down ||
|
|
10
|
+
Number(value) > up ||
|
|
11
|
+
Number(value) !== Math.round(Number(value))
|
|
12
|
+
|
|
13
|
+
export const checkIfValidIP = (str: string): boolean => {
|
|
14
|
+
const regexExp =
|
|
15
|
+
/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/gi
|
|
16
|
+
|
|
17
|
+
return regexExp.test(str)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const checkVlanId = (vlanId: string): boolean =>
|
|
21
|
+
vlanId !== 'None (0)' &&
|
|
22
|
+
vlanId !== 'All (4095)' &&
|
|
23
|
+
(isIntegerNumberInRange(vlanId, 0, 4095) || vlanId === '')
|
|
24
|
+
|
|
25
|
+
export const checkMtu = (mtu: number): boolean => {
|
|
26
|
+
return !!(mtu === 0 ? '0' : mtu) && isIntegerNumberInRange(mtu, 1280, 65535)
|
|
27
|
+
}
|
|
28
|
+
|
|
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
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { UI_I_ConnectionSettings } from '~/components/common/wizards/network/add/models/interfaces'
|
|
2
|
+
import { UI_E_ValidationFields } from '~/components/common/wizards/network/add/models/enums'
|
|
3
|
+
import { UI_I_Localization } from '~/models/interfaces'
|
|
4
|
+
import type Wizard from '~/components/atoms/wizard/utils/utils'
|
|
5
|
+
import {
|
|
6
|
+
UI_I_ValidationReturn,
|
|
7
|
+
UI_I_WizardStep,
|
|
8
|
+
} from '~/components/atoms/wizard/models/interfaces'
|
|
9
|
+
import {
|
|
10
|
+
validateFieldLocal,
|
|
11
|
+
checkVlanId,
|
|
12
|
+
} from '~/components/common/wizards/network/add/validations/common'
|
|
13
|
+
|
|
14
|
+
export const validateVlanIdConnectionSettingsLocal = (
|
|
15
|
+
localization: UI_I_Localization,
|
|
16
|
+
data: UI_I_ConnectionSettings,
|
|
17
|
+
wizard: Wizard
|
|
18
|
+
): void => {
|
|
19
|
+
validateFieldLocal(
|
|
20
|
+
wizard,
|
|
21
|
+
5,
|
|
22
|
+
UI_E_ValidationFields.CONNECTION_SETTINGS_VLAN,
|
|
23
|
+
checkVlanId(data.vlanId),
|
|
24
|
+
localization.vlanIdInvalidMessage,
|
|
25
|
+
localization.vlanIdInvalidMessage
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const validateNetworkConnectionSettingsLocal = (
|
|
30
|
+
localization: UI_I_Localization,
|
|
31
|
+
data: UI_I_ConnectionSettings,
|
|
32
|
+
wizard: Wizard
|
|
33
|
+
): void => {
|
|
34
|
+
validateFieldLocal(
|
|
35
|
+
wizard,
|
|
36
|
+
5,
|
|
37
|
+
UI_E_ValidationFields.CONNECTION_SETTINGS_NETWORK,
|
|
38
|
+
data.networkLabel === '',
|
|
39
|
+
localization.networkLabelInvalidMessage,
|
|
40
|
+
localization.networkLabelInvalidMessage
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const checkConnectionSettingsSync = (
|
|
45
|
+
localization: UI_I_Localization,
|
|
46
|
+
data: UI_I_ConnectionSettings,
|
|
47
|
+
wizard: Wizard,
|
|
48
|
+
value: UI_I_WizardStep[]
|
|
49
|
+
): UI_I_ValidationReturn => {
|
|
50
|
+
let stepHasError = false
|
|
51
|
+
|
|
52
|
+
if (checkVlanId(data.vlanId)) {
|
|
53
|
+
stepHasError = wizard.setValidation(
|
|
54
|
+
5,
|
|
55
|
+
UI_E_ValidationFields.CONNECTION_SETTINGS_VLAN,
|
|
56
|
+
{
|
|
57
|
+
fieldMessage: localization.vlanIdInvalidMessage,
|
|
58
|
+
alertMessage: localization.vlanIdInvalidMessage,
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
} else if (
|
|
62
|
+
wizard.hasMessage(5, UI_E_ValidationFields.CONNECTION_SETTINGS_VLAN)
|
|
63
|
+
) {
|
|
64
|
+
value = wizard.removeValidation(
|
|
65
|
+
5,
|
|
66
|
+
UI_E_ValidationFields.CONNECTION_SETTINGS_VLAN,
|
|
67
|
+
value
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
newValue: value,
|
|
73
|
+
stepHasError,
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
UI_I_AdapterStatus,
|
|
3
|
+
UI_I_Adapter,
|
|
4
|
+
} from '~/components/common/diagramMain/models/interfaces'
|
|
5
|
+
import { UI_I_Localization } from '~/models/interfaces'
|
|
6
|
+
import {
|
|
7
|
+
UI_I_ValidationReturn,
|
|
8
|
+
UI_I_WizardStep,
|
|
9
|
+
} from '~/components/atoms/wizard/models/interfaces'
|
|
10
|
+
|
|
11
|
+
export const checkAdaptersSync = (
|
|
12
|
+
localization: UI_I_Localization,
|
|
13
|
+
data: UI_I_AdapterStatus,
|
|
14
|
+
value: UI_I_WizardStep[],
|
|
15
|
+
currentStepId: number,
|
|
16
|
+
nextStepId: number,
|
|
17
|
+
freeAdapters: UI_I_Adapter[],
|
|
18
|
+
showNoActiveAdaptersModal: () => void,
|
|
19
|
+
showNoConnectedActiveAdaptersModal: () => void
|
|
20
|
+
): UI_I_ValidationReturn => {
|
|
21
|
+
const stepShouldStop = {
|
|
22
|
+
ifOnCurrentStep: false,
|
|
23
|
+
ifFromAnyStep: false,
|
|
24
|
+
stoppageStepId: 2,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const isOnStoppageStep = currentStepId === stepShouldStop.stoppageStepId
|
|
28
|
+
|
|
29
|
+
if (isOnStoppageStep && data.active.length === 0) {
|
|
30
|
+
stepShouldStop.ifOnCurrentStep = true
|
|
31
|
+
showNoActiveAdaptersModal()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (stepShouldStop.ifOnCurrentStep)
|
|
35
|
+
return {
|
|
36
|
+
newValue: value,
|
|
37
|
+
stepHasError: false,
|
|
38
|
+
stepShouldStop,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const activeAndConnectedAdapters = data.active.filter(
|
|
42
|
+
(adapterName: string) =>
|
|
43
|
+
freeAdapters.find(
|
|
44
|
+
(freeAdapter: UI_I_Adapter) => freeAdapter.name === adapterName
|
|
45
|
+
)?.carrier
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
if (isOnStoppageStep && activeAndConnectedAdapters.length === 0) {
|
|
49
|
+
stepShouldStop.ifOnCurrentStep = true
|
|
50
|
+
showNoConnectedActiveAdaptersModal()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
newValue: value,
|
|
55
|
+
stepHasError: false,
|
|
56
|
+
stepShouldStop,
|
|
57
|
+
}
|
|
58
|
+
}
|