bfg-common 1.5.653 → 1.5.654

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 (106) hide show
  1. package/CODE_STYLE.md +109 -109
  2. package/assets/img/icons/icons-sprite-dark-3.svg +227 -227
  3. package/assets/img/icons/icons-sprite-dark-5.svg +488 -488
  4. package/assets/img/icons/icons-sprite-light-3.svg +227 -227
  5. package/assets/img/icons/icons-sprite-light-5.svg +488 -488
  6. package/assets/localization/local_be.json +4 -0
  7. package/assets/localization/local_en.json +4 -0
  8. package/assets/localization/local_hy.json +4 -0
  9. package/assets/localization/local_kk.json +4 -0
  10. package/assets/localization/local_ru.json +4 -0
  11. package/assets/localization/local_zh.json +4 -0
  12. package/components/atoms/TheIcon3.vue +50 -50
  13. package/components/atoms/collapse/CollapseNav.vue +170 -170
  14. package/components/atoms/perPage/PerPage.vue +58 -58
  15. package/components/atoms/table/dataGrid/DataGrid.vue +1718 -1718
  16. package/components/atoms/table/dataGrid/DataGridPagination.vue +97 -97
  17. package/components/atoms/table/dataGrid/lib/config/settingsTable.ts +94 -94
  18. package/components/atoms/table/dataGrid/lib/utils/export.ts +16 -16
  19. package/components/common/backup/storage/actions/add/lib/utils.ts +51 -51
  20. package/components/common/browse/blocks/contents/filesNew/Skeleton.vue +18 -18
  21. package/components/common/browse/blocks/lib/models/types.ts +1 -1
  22. package/components/common/browse/lib/models/interfaces.ts +5 -5
  23. package/components/common/diagramMain/network/Contents.vue +497 -497
  24. package/components/common/layout/theHeader/TheHeaderNew.vue +310 -310
  25. package/components/common/layout/theHeader/TheHeaderOld.vue +257 -257
  26. package/components/common/layout/theHeader/helpMenu/About.vue +79 -79
  27. package/components/common/layout/theHeader/helpMenu/aboutOld/AboutOld.vue +79 -79
  28. package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePassword.vue +99 -99
  29. package/components/common/layout/theHeader/userMenu/modals/changePassword/New.vue +193 -193
  30. package/components/common/layout/theHeader/userMenu/modals/preferences/lib/models/types.ts +7 -7
  31. package/components/common/layout/theHeader/userMenu/modals/preferences/security/Old.vue +120 -118
  32. package/components/common/layout/theHeader/userMenu/modals/preferences/security/Security.vue +23 -23
  33. package/components/common/pages/backups/DetailView.vue +52 -52
  34. package/components/common/pages/backups/lib/models/interfaces.ts +36 -36
  35. package/components/common/pages/backups/modals/Modals.vue +243 -243
  36. package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/config/options.ts +6 -6
  37. package/components/common/pages/backups/modals/createBackup/lib/config/readyToCompleteOptions.ts +69 -69
  38. package/components/common/pages/backups/modals/lib/config/restore.ts +115 -115
  39. package/components/common/pages/backups/modals/lib/models/interfaces.ts +186 -186
  40. package/components/common/pages/backups/modals/restore/name/lib/models/interfaces.ts +6 -6
  41. package/components/common/pages/home/lib/models/interfaces.ts +48 -48
  42. package/components/common/pages/home/widgets/hosts/Hosts.vue +27 -27
  43. package/components/common/pages/home/widgets/hosts/lib/config/items.ts +23 -23
  44. package/components/common/pages/home/widgets/vms/VmsOld.vue +35 -35
  45. package/components/common/pages/home/widgets/vms/lib/config/items.ts +19 -19
  46. package/components/common/pages/scheduledTasks/lib/utils/utils.ts +84 -84
  47. package/components/common/readyToComplete/ReadyToComplete.vue +17 -17
  48. package/components/common/select/radio/RadioGroup.vue +137 -137
  49. package/components/common/spiceConsole/Drawer.vue +420 -420
  50. package/components/common/spiceConsole/SpiceConsole.vue +184 -184
  51. package/components/common/spiceConsole/lib/models/interfaces.ts +5 -5
  52. package/components/common/tools/Actions.vue +207 -207
  53. package/components/common/treeView/TreeView.vue +52 -52
  54. package/components/common/vm/actions/clone/lib/config/steps.ts +295 -295
  55. package/components/common/vm/actions/clone/new/New.vue +438 -438
  56. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/lib/config/options.ts +28 -28
  57. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +283 -283
  58. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +156 -156
  59. package/components/common/vm/actions/common/select/compatibility/Old.vue +107 -107
  60. package/components/common/vm/actions/common/select/createType/lib/models/interfaces.ts +5 -5
  61. package/components/common/vm/actions/common/select/options/New.vue +263 -263
  62. package/components/common/vm/actions/common/select/options/Old.vue +109 -109
  63. package/components/common/vm/actions/common/select/options/Options.vue +58 -58
  64. package/components/common/vm/actions/common/select/storage/Old.vue +125 -125
  65. package/components/common/vm/actions/common/select/storage/new/New.vue +311 -311
  66. package/components/common/vm/actions/common/select/storage/new/lib/models/interfaces.ts +5 -5
  67. package/components/common/vm/actions/common/select/storage/new/lib/utils/utils.ts +21 -21
  68. package/components/common/vm/actions/common/select/template/old/Old.vue +50 -50
  69. package/components/common/vm/actions/editSettings/new/Skeleton.vue +88 -88
  70. package/components/common/wizards/common/compatibility/Compatibility.vue +35 -35
  71. package/components/common/wizards/common/compatibility/New.vue +99 -99
  72. package/components/common/wizards/common/compatibility/Old.vue +53 -53
  73. package/components/common/wizards/common/steps/computeResource/New.vue +93 -93
  74. package/components/common/wizards/common/steps/name/Name.vue +178 -178
  75. package/components/common/wizards/common/steps/name/New.vue +221 -221
  76. package/components/common/wizards/common/steps/name/Old.vue +121 -121
  77. package/components/common/wizards/common/steps/name/lib/models/interfaces.ts +4 -4
  78. package/components/common/wizards/common/steps/name/location/New.vue +40 -40
  79. package/components/common/wizards/datastore/add/Add.vue +228 -228
  80. package/components/common/wizards/datastore/add/lib/utils.ts +85 -85
  81. package/components/common/wizards/datastore/add/steps/typeMode/lib/config/typeOptions.ts +43 -43
  82. package/components/common/wizards/network/add/Add.vue +870 -870
  83. package/composables/useAppVersion.ts +21 -21
  84. package/composables/useLocal.ts +6 -6
  85. package/composables/useLocalCommon.ts +39 -39
  86. package/lib/models/interfaces.ts +1 -0
  87. package/package.json +1 -1
  88. package/plugins/console.ts +21 -21
  89. package/plugins/mouse.ts +21 -21
  90. package/plugins/panelStates.ts +70 -70
  91. package/plugins/text.ts +59 -59
  92. package/plugins/time.ts +58 -58
  93. package/public/spice-console/application/clientgui.js +854 -854
  94. package/public/spice-console/application/packetfactory.js +211 -211
  95. package/public/spice-console/application/virtualmouse.js +147 -147
  96. package/public/spice-console/lib/images/bitmap.js +203 -203
  97. package/public/spice-console/network/spicechannel.js +440 -440
  98. package/public/spice-console/process/cursorprocess.js +128 -128
  99. package/public/spice-console/process/inputprocess.js +227 -227
  100. package/public/spice-console/process/mainprocess.js +212 -212
  101. package/public/spice-console/run.js +210 -210
  102. package/store/main/mutations.ts +7 -7
  103. package/store/main/state.ts +7 -7
  104. package/store/tasks/actions.ts +165 -165
  105. package/store/tasks/mappers/recentTasks.ts +123 -123
  106. package/store/tasks/mutations.ts +82 -82
@@ -1,870 +1,870 @@
1
- <template>
2
- <common-wizards-network-add-new
3
- v-if="isNewView"
4
- v-model:connection-type="connectionTypeLocal"
5
- :show="props.show"
6
- :wizard="wizard"
7
- :selected-scheme="selectedScheme"
8
- :host-name="hostNameLocal"
9
- :project="props.project"
10
- :target-device="targetDevice"
11
- :standard-switches-initial="props.standardSwitchesInitial"
12
- :alert-messages="alertMessages"
13
- :selected-standard-switch-id="props.selectedStandardSwitchId"
14
- :selected-switch-id="props.selectedSwitchId"
15
- :free-adapters="props.freeAdapters"
16
- :added-adapters="addedAdapters"
17
- :core-adapters="coreAdapters"
18
- :adapter-status="adapterStatus"
19
- :adapters="props.adapters"
20
- :is-show-no-connected-active-adapters-modal="
21
- isShowNoConnectedActiveAdaptersModal
22
- "
23
- :is-show-no-active-adapters-modal="isShowNoActiveAdaptersModal"
24
- :is-dark-mode="props.isDarkMode"
25
- :port-properties="portProperties"
26
- :mtu-from-switch="mtuFromSwitch"
27
- :tcp-stacks="props.tcpStacks"
28
- :ip-four-settings="ipFourSettings"
29
- :gateway-flag="gatewayFlag"
30
- :connection-settings="connectionSettings"
31
- :ready-complete-fields="readyCompleteFields"
32
- @change-connection-settings="onChangeConnectionSettings"
33
- @change-gateway-flag="onChangeGatewayFlag"
34
- @change-ip-four-settings="onChangeIpFourSettings"
35
- @change-port-properties="onChangePortProperties"
36
- @get-free-adapters="onGetFreeAdapters"
37
- @change-added-adapters="onChangeAddedAdapters"
38
- @change-adapter-status="onChangeAdapterStatus"
39
- @confirm-no-active-adapters-modal="onConfirmNoActiveAdaptersModal"
40
- @hide-no-connected-active-adapters-modal="
41
- onHideNoConnectedActiveAdaptersModal
42
- "
43
- @hide-no-active-adapters-modal="onHideNoActiveAdaptersModal"
44
- @hide-alert="onHideAlert"
45
- @change-target-device="onChangeTargetDevice"
46
- @change-steps="onChangeSteps"
47
- @hide="onHideAddNetworkingModal"
48
- @submit="onSubmit"
49
- />
50
- <common-wizards-network-add-old
51
- v-else
52
- v-model:connection-type="connectionTypeLocal"
53
- :show="props.show"
54
- :wizard="wizard"
55
- :selected-scheme="selectedScheme"
56
- :title="title"
57
- :project="props.project"
58
- :target-device="targetDevice"
59
- :standard-switches-initial="props.standardSwitchesInitial"
60
- :alert-messages="alertMessages"
61
- :selected-standard-switch-id="props.selectedStandardSwitchId"
62
- :selected-switch-id="props.selectedSwitchId"
63
- :free-adapters="props.freeAdapters"
64
- :added-adapters="addedAdapters"
65
- :core-adapters="coreAdapters"
66
- :adapter-status="adapterStatus"
67
- :adapters="props.adapters"
68
- :is-show-no-connected-active-adapters-modal="
69
- isShowNoConnectedActiveAdaptersModal
70
- "
71
- :is-show-no-active-adapters-modal="isShowNoActiveAdaptersModal"
72
- :is-dark-mode="props.isDarkMode"
73
- :port-properties="portProperties"
74
- :mtu-from-switch="mtuFromSwitch"
75
- :tcp-stacks="props.tcpStacks"
76
- :ip-four-settings="ipFourSettings"
77
- :gateway-flag="gatewayFlag"
78
- :connection-settings="connectionSettings"
79
- :ready-complete-fields="readyCompleteFields"
80
- @change-connection-settings="onChangeConnectionSettings"
81
- @change-gateway-flag="onChangeGatewayFlag"
82
- @change-ip-four-settings="onChangeIpFourSettings"
83
- @change-port-properties="onChangePortProperties"
84
- @get-free-adapters="onGetFreeAdapters"
85
- @change-added-adapters="onChangeAddedAdapters"
86
- @change-adapter-status="onChangeAdapterStatus"
87
- @confirm-no-active-adapters-modal="onConfirmNoActiveAdaptersModal"
88
- @hide-no-connected-active-adapters-modal="
89
- onHideNoConnectedActiveAdaptersModal
90
- "
91
- @hide-no-active-adapters-modal="onHideNoActiveAdaptersModal"
92
- @hide-alert="onHideAlert"
93
- @change-target-device="onChangeTargetDevice"
94
- @change-steps="onChangeSteps"
95
- @hide="onHideAddNetworkingModal"
96
- @submit="onSubmit"
97
- />
98
- </template>
99
-
100
- <script setup lang="ts">
101
- import type {
102
- UI_I_ValidationReturn,
103
- UI_I_WizardStep,
104
- UI_I_WizardStepNavigation,
105
- } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
106
- import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
107
- import type {
108
- UI_I_ArbitraryObject,
109
- UI_I_Localization,
110
- UI_I_ItemsWithTotalCounts,
111
- } from '~/lib/models/interfaces'
112
- import type { UI_T_Project } from '~/lib/models/types'
113
- import type {
114
- UI_I_PortProperties,
115
- UI_I_IpFourSettings,
116
- UI_I_ConnectionSettings,
117
- UI_I_TargetDevice,
118
- UI_I_Switch,
119
- UI_I_ReadyCompleteFields,
120
- UI_I_AddNetworkingSecondOrThirdSchemeDataSend,
121
- UI_I_AddNetworkingZeroOrFirstSchemeDataSend,
122
- UI_I_AddNetworkingFourthOrFifthSchemeDataSend,
123
- // UI_I_AddNetworkingEmits,
124
- UI_I_TCPStack,
125
- } from '~/components/common/wizards/network/add/lib/models/interfaces'
126
- import type {
127
- UI_I_Adapter,
128
- UI_I_AdapterStatus,
129
- UI_I_SwitchAdapterItem,
130
- UI_I_DiagramData,
131
- API_UI_I_SwitchItem,
132
- UI_I_AvailableAdapters,
133
- } from '~/components/common/diagramMain/lib/models/interfaces'
134
- import { getAvailableAdapters } from '~/components/common/diagramMain/lib/utils/utils'
135
- import { UI_E_ValidationFields } from '~/components/common/wizards/network/add/lib/models/enums'
136
- import { getVlanId } from '~/components/common/wizards/network/add/lib/utils/utils'
137
- import {
138
- createZeroSchemeReadyCompleteFunc,
139
- createFirstSchemeReadyCompleteFunc,
140
- createSecondSchemeReadyCompleteFunc,
141
- createThirdSchemeReadyCompleteFunc,
142
- createFourthSchemeReadyCompleteFunc,
143
- createFifthSchemeReadyCompleteFunc,
144
- stepsSchemeInitial,
145
- stepsFunc,
146
- connectionSettingsInitial,
147
- portPropertiesInitial,
148
- ipFourSettingsInitial,
149
- targetDeviceInitial,
150
- addNetworkingZeroOrFirstSchemeDataFunc,
151
- addNetworkingSecondOrThirdSchemeDataFunc,
152
- addNetworkingFourthOrFifthSchemeDataFunc,
153
- } from '~/components/common/wizards/network/add/lib/config/config'
154
- import {
155
- checkTargetDeviceSync,
156
- checkAdaptersSync,
157
- checkPortPropertiesSync,
158
- checkIpFourSettingsSync,
159
- checkConnectionSettingsSync,
160
- checkNetworkAsync,
161
- } from '~/components/common/wizards/network/add/validations/validations'
162
-
163
- const props = withDefaults(
164
- defineProps<{
165
- show: boolean
166
- adapters: UI_I_ItemsWithTotalCounts<UI_I_SwitchAdapterItem>
167
- standardSwitchesInitial?: UI_I_Switch[]
168
- freeAdapters?: UI_I_Adapter[]
169
- project?: UI_T_Project
170
- isDarkMode?: boolean
171
- selectedStandardSwitchId?: string
172
- selectedSwitchId?: string
173
- tcpStacks?: UI_I_TCPStack[]
174
- diagramsData?: UI_I_DiagramData[]
175
- isNetworkingLoading?: boolean
176
- hostName?: string
177
- }>(),
178
- {
179
- standardSwitchesInitial: () => [],
180
- freeAdapters: () => [],
181
- project: 'procurator',
182
- isDarkMode: false,
183
- selectedStandardSwitchId: '',
184
- selectedSwitchId: '',
185
- tcpStacks: () => [],
186
- diagramsData: [],
187
- isNetworkingLoading: false,
188
- }
189
- )
190
-
191
- const emits = defineEmits<{
192
- (event: 'hide'): void
193
- (
194
- event: 'add-networking-data-validate',
195
- data:
196
- | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
197
- | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
198
- | UI_I_AddNetworkingFourthOrFifthSchemeDataSend
199
- | API_UI_I_SwitchItem,
200
- type: string,
201
- setValidation: (err_arg: UI_I_ArbitraryObject<string>) => void
202
- ): void
203
- (
204
- event: 'send-add-networking-data',
205
- data:
206
- | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
207
- | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
208
- | UI_I_AddNetworkingFourthOrFifthSchemeDataSend
209
- | API_UI_I_SwitchItem,
210
- type: string,
211
- hideModal: () => void
212
- ): void
213
- (event: 'get-existing-standard-switches'): void
214
- (event: 'get-free-adapters', cb: () => void): void
215
- (
216
- event: 'check-network-label',
217
- label: string,
218
- sendMessage: (message: string) => void
219
- ): void
220
- (event: 'get-tcp-stacks'): void
221
- }>()
222
-
223
- const { $store }: any = useNuxtApp()
224
-
225
- const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
226
-
227
- const localization = computed<UI_I_Localization>(() => useLocal())
228
-
229
- const localHostName = ref<string>('')
230
- const hostNameLocal = computed<string>(
231
- () => props.hostName || localHostName.value
232
- )
233
-
234
- const title = computed<string>(
235
- () => `${hostNameLocal.value} - ${localization.value.common.addNetworking}`
236
- )
237
-
238
- const wizard: Wizard = new Wizard(
239
- stepsFunc(localization.value),
240
- stepsSchemeInitial
241
- )
242
-
243
- const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
244
- const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
245
-
246
- const readyCompleteFields = ref<UI_I_ReadyCompleteFields[]>([])
247
-
248
- // Step's content data (connectionType)
249
- const connectionType = ref<string>('0')
250
-
251
- const connectionTypeLocal = computed<string>({
252
- get() {
253
- return connectionType.value
254
- },
255
- set(newValue: string) {
256
- wizard.resetAfterSelected()
257
- connectionType.value = newValue
258
- targetDevice.value.standardSwitch = props.selectedStandardSwitchId
259
- targetDevice.value.switch = props.selectedSwitchId
260
- },
261
- })
262
-
263
- // Step's content data (createStandardSwitch)
264
- const addedAdapters = ref<string[]>([])
265
- const coreAdapters = ref<string[]>([])
266
-
267
- const onChangeAddedAdapters = (addedAdaptersNew: string[]): void => {
268
- addedAdapters.value = addedAdaptersNew
269
- }
270
-
271
- const adapterStatus = ref<UI_I_AdapterStatus>({
272
- active: [],
273
- standby: [],
274
- unused: [],
275
- })
276
- const onChangeAdapterStatus = (adapterStatusNew: UI_I_AdapterStatus): void => {
277
- adapterStatus.value = adapterStatusNew
278
- }
279
-
280
- // Step's content data and changers (targetDevice)
281
- const targetDevice = ref<UI_I_TargetDevice>(useDeepCopy(targetDeviceInitial))
282
- const mtuFromSwitch = ref<number>(1500)
283
-
284
- const onChangeTargetDevice = (newTargetDevice: UI_I_TargetDevice): void => {
285
- const oldTargetDeviceSelected = useDeepCopy(targetDevice.value).selected
286
- const newTargetDeviceSelected = newTargetDevice.selected
287
-
288
- if (oldTargetDeviceSelected !== newTargetDeviceSelected) {
289
- wizard.resetAfterSelected()
290
- }
291
-
292
- const selectedSwitch = props.standardSwitchesInitial.find(
293
- (currentSwitch: UI_I_Switch) =>
294
- newTargetDevice.standardSwitch === currentSwitch.name
295
- )
296
-
297
- if (newTargetDeviceSelected === '1' && selectedSwitch) {
298
- mtuFromSwitch.value = selectedSwitch?.mtu || 1500
299
- }
300
- if (newTargetDeviceSelected === '3') {
301
- mtuFromSwitch.value = newTargetDevice.mtu || 1500
302
- }
303
-
304
- targetDevice.value = useDeepCopy(newTargetDevice)
305
- }
306
-
307
- // Step's content data and changers (portProperties)
308
- const portProperties = ref<UI_I_PortProperties>(
309
- useDeepCopy(portPropertiesInitial)
310
- )
311
- const onChangePortProperties = (newFields: UI_I_PortProperties): void => {
312
- if (portProperties.value.tcp !== newFields.tcp) {
313
- ipFourSettings.value.static.defaultGateway.value =
314
- props.tcpStacks?.find((tcp: UI_I_TCPStack) => tcp.id === newFields.tcp)
315
- .gateway || ''
316
- }
317
- portProperties.value = newFields
318
- }
319
-
320
- // Step's content data and changers (ipFourSettings)
321
- const ipFourSettings = ref<UI_I_IpFourSettings>(ipFourSettingsInitial)
322
- const onChangeIpFourSettings = (newFields: UI_I_IpFourSettings): void => {
323
- ipFourSettings.value = newFields
324
- }
325
-
326
- const gatewayFlag = ref<boolean>(false)
327
- const onChangeGatewayFlag = (newValue: boolean) => {
328
- gatewayFlag.value = newValue
329
- }
330
-
331
- // Step's content data and changers (connectionSettings)
332
- const connectionSettings = ref<UI_I_ConnectionSettings>(
333
- connectionSettingsInitial
334
- )
335
- const onChangeConnectionSettings = (
336
- newFields: UI_I_ConnectionSettings
337
- ): void => {
338
- connectionSettings.value = newFields
339
- }
340
-
341
- const onHideAlert = (stepId: number, field?: string): void => {
342
- wizard.hideAlertMessagesByStepId(stepId, field)
343
- }
344
-
345
- let flagSwitch = ''
346
-
347
- // Choosing Scheme
348
- watch(
349
- [connectionTypeLocal, targetDevice],
350
- (
351
- newValues: [string, UI_I_TargetDevice],
352
- oldValues: [string, UI_I_TargetDevice]
353
- ) => {
354
- const newCT = newValues[0] // -> newConnectionType
355
- const oldCT = oldValues[0] // -> oldConnectionType
356
- const newTD = newValues[1] // -> newTargetDevice
357
- const oldTD = oldValues[1] // -> oldTargetDevice
358
- if (!oldTD || oldTD.selected !== newTD.selected) {
359
- flagSwitch = ''
360
- addedAdapters.value = []
361
- adapterStatus.value = {
362
- active: [],
363
- standby: [],
364
- unused: [],
365
- }
366
- }
367
- if (newCT !== oldCT) {
368
- newCT === '0' && props.selectedStandardSwitchId
369
- ? (targetDevice.value.selected = '1')
370
- : (targetDevice.value.selected = '0')
371
- newCT === '1' && (targetDevice.value.selected = '1')
372
- newCT === '2' && (targetDevice.value.selected = '2')
373
- }
374
- if (newCT === '0') {
375
- ;(newTD.selected === '0' || newTD.selected === '1') &&
376
- wizard.changeScheme(0)
377
- newTD.selected === '3' && wizard.changeScheme(1)
378
- }
379
- if (newCT === '1') {
380
- newTD.selected === '1' && wizard.changeScheme(2)
381
- newTD.selected === '3' && wizard.changeScheme(3)
382
- }
383
- if (newCT === '2') {
384
- newTD.selected === '2' && wizard.changeScheme(4)
385
- newTD.selected === '3' && wizard.changeScheme(5)
386
- }
387
- },
388
- { deep: true, immediate: true }
389
- )
390
-
391
- const onGetExistingStandardSwitches = (): void => {
392
- emits('get-existing-standard-switches')
393
- }
394
-
395
- const onGetTcpStacks = (): void => {
396
- emits('get-tcp-stacks')
397
- }
398
-
399
- watch(
400
- () => wizard.selectedStepId,
401
- (newSelectedStep: number) => {
402
- if (newSelectedStep === 1) {
403
- onGetExistingStandardSwitches()
404
- }
405
- if (newSelectedStep === 3) {
406
- onGetTcpStacks()
407
- }
408
- if (newSelectedStep === 6 && flagSwitch !== targetDevice.value.switch) {
409
- const nics: UI_I_AdapterStatus = props.standardSwitchesInitial.find(
410
- (currentSwitch: UI_I_Switch) =>
411
- currentSwitch.id === targetDevice.value.switch
412
- ).nics
413
-
414
- const availableAdapters: UI_I_AvailableAdapters = getAvailableAdapters(
415
- props.adapters,
416
- nics
417
- )
418
-
419
- adapterStatus.value = {
420
- active: availableAdapters.activeAdapters || [],
421
- standby: availableAdapters.standbyAdapters || [],
422
- unused: availableAdapters.unusedAdapters || [],
423
- }
424
- coreAdapters.value = [
425
- ...adapterStatus.value.active,
426
- ...adapterStatus.value.standby,
427
- ...adapterStatus.value.unused,
428
- ]
429
- flagSwitch = targetDevice.value.switch
430
- }
431
-
432
- if (newSelectedStep !== 7) return // If last step
433
- if (wizard.isSelectedScheme(0)) {
434
- readyCompleteFields.value = createZeroSchemeReadyCompleteFunc(
435
- isNewView.value,
436
- targetDevice.value,
437
- portProperties.value,
438
- ipFourSettings.value,
439
- localization.value
440
- )
441
- return
442
- }
443
-
444
- if (wizard.isSelectedScheme(1)) {
445
- readyCompleteFields.value = createFirstSchemeReadyCompleteFunc(
446
- isNewView.value,
447
- targetDevice.value,
448
- portProperties.value,
449
- ipFourSettings.value,
450
- addedAdapters.value,
451
- localization.value
452
- )
453
- return
454
- }
455
- if (wizard.isSelectedScheme(2)) {
456
- readyCompleteFields.value = createSecondSchemeReadyCompleteFunc(
457
- isNewView.value,
458
- connectionSettings.value,
459
- targetDevice.value,
460
- localization.value
461
- )
462
- return
463
- }
464
- if (wizard.isSelectedScheme(3)) {
465
- readyCompleteFields.value = createThirdSchemeReadyCompleteFunc(
466
- isNewView.value,
467
- connectionSettings.value,
468
- targetDevice.value,
469
- addedAdapters.value,
470
- localization.value
471
- )
472
- return
473
- }
474
- if (wizard.isSelectedScheme(4)) {
475
- readyCompleteFields.value = createFourthSchemeReadyCompleteFunc(
476
- isNewView.value,
477
- targetDevice.value.switch,
478
- props.diagramsData,
479
- adapterStatus.value,
480
- localization.value
481
- )
482
- return
483
- }
484
- if (wizard.isSelectedScheme(5)) {
485
- readyCompleteFields.value = createFifthSchemeReadyCompleteFunc(
486
- isNewView.value,
487
- targetDevice.value,
488
- adapterStatus.value,
489
- localization.value
490
- )
491
- }
492
- }
493
- )
494
-
495
- // Reset data
496
- const reset = (): void => {
497
- wizard.reset()
498
- connectionTypeLocal.value = '0'
499
- targetDevice.value = useDeepCopy(targetDeviceInitial)
500
- connectionSettings.value = useDeepCopy(connectionSettingsInitial)
501
- portProperties.value = useDeepCopy(portPropertiesInitial)
502
- ipFourSettings.value = useDeepCopy(ipFourSettingsInitial)
503
- coreAdapters.value = []
504
- addedAdapters.value = []
505
- adapterStatus.value = {
506
- active: [],
507
- standby: [],
508
- unused: [],
509
- }
510
- }
511
-
512
- const isShowNoConnectedActiveAdaptersModal = ref(false)
513
- const isShowNoActiveAdaptersModal = ref(false)
514
-
515
- const showNoConnectedActiveAdaptersModal = (): void => {
516
- isShowNoConnectedActiveAdaptersModal.value = true
517
- }
518
- const onHideNoConnectedActiveAdaptersModal = (): void => {
519
- isShowNoConnectedActiveAdaptersModal.value = false
520
- }
521
- const showNoActiveAdaptersModal = (): void => {
522
- isShowNoActiveAdaptersModal.value = true
523
- }
524
- const onHideNoActiveAdaptersModal = (): void => {
525
- isShowNoActiveAdaptersModal.value = false
526
- }
527
-
528
- const onConfirmNoActiveAdaptersModal = (): void => {
529
- onHideNoConnectedActiveAdaptersModal()
530
- onHideNoActiveAdaptersModal()
531
- if (wizard.waitingStepId === 7) {
532
- wizard.changeSteps(
533
- wizard.selectedStepData(
534
- wizard.stepsInSelectedSchemeWithStatus.value.find(
535
- (step: UI_I_WizardStepNavigation) => step.id === 7
536
- )
537
- ),
538
- validationFunc,
539
- props.project === 'sphere' ? null : finalValidationFunc,
540
- true
541
- )
542
- wizard.waitingStepId = -1
543
- return
544
- }
545
- wizard.selectStepHard(wizard.waitingStepId)
546
- }
547
-
548
- const onGetFreeAdapters = (showModal: () => void): void => {
549
- emits('get-free-adapters', showModal)
550
- }
551
-
552
- const checkFinal = async (): Promise<UI_I_ArbitraryObject<string>> => {
553
- let data:
554
- | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
555
- | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
556
- | UI_I_AddNetworkingFourthOrFifthSchemeDataSend
557
- | API_UI_I_SwitchItem
558
- | null = null
559
-
560
- let type: 'network' | 'vmkernel' | 'adapter' | 'new-switch'
561
-
562
- if (wizard.isSelectedScheme(0) || wizard.isSelectedScheme(1)) {
563
- const vlan = getVlanId(portProperties.value.vlanId)
564
-
565
- data = addNetworkingZeroOrFirstSchemeDataFunc(
566
- targetDevice.value,
567
- Number(vlan),
568
- portProperties.value,
569
- ipFourSettings.value,
570
- wizard.isSelectedScheme(1),
571
- adapterStatus.value
572
- )
573
-
574
- type = 'vmkernel'
575
- }
576
-
577
- if (wizard.isSelectedScheme(2) || wizard.isSelectedScheme(3)) {
578
- const vlan = getVlanId(connectionSettings.value.vlanId)
579
-
580
- data = addNetworkingSecondOrThirdSchemeDataFunc(
581
- connectionSettings.value,
582
- targetDevice.value,
583
- Number(vlan),
584
- wizard.isSelectedScheme(2),
585
- adapterStatus.value
586
- )
587
-
588
- type = 'network'
589
- }
590
-
591
- if (wizard.isSelectedScheme(4) || wizard.isSelectedScheme(5)) {
592
- data = addNetworkingFourthOrFifthSchemeDataFunc(
593
- targetDevice.value.switch,
594
- wizard.isSelectedScheme(4),
595
- adapterStatus.value,
596
- props.diagramsData,
597
- targetDevice.value.mtu
598
- )
599
-
600
- type = wizard.isSelectedScheme(4) ? 'adapter' : 'new-switch'
601
- }
602
-
603
- return new Promise((resolve, _reject) =>
604
- emits(
605
- 'add-networking-data-validate',
606
- data,
607
- type,
608
- (err_arg: UI_I_ArbitraryObject<string>): void => {
609
- resolve(err_arg)
610
- }
611
- )
612
- )
613
- }
614
-
615
- const finalValidationFunc = async (
616
- value: UI_I_WizardStep[]
617
- ): Promise<UI_I_ValidationReturn> => {
618
- let stepHasError = false
619
-
620
- const validationFields: {
621
- [key: string]: string
622
- } = await checkFinal()
623
-
624
- for (const fieldName in validationFields) {
625
- const stepId = wizard.getStepIdByFieldName(fieldName)
626
-
627
- if (stepId !== -1) {
628
- stepHasError = wizard.setValidation(stepId, fieldName, {
629
- fieldMessage: validationFields[fieldName],
630
- alertMessage: validationFields[fieldName],
631
- })
632
- }
633
- }
634
-
635
- return {
636
- stepHasError,
637
- newValue: value,
638
- }
639
- }
640
-
641
- const validationFunc = async (
642
- value: UI_I_WizardStep[],
643
- currentStep: UI_I_WizardStep,
644
- nextStep: UI_I_WizardStep
645
- ): Promise<UI_I_ValidationReturn> => {
646
- let stepHasError = false
647
- let stepShouldStop = {
648
- ifOnCurrentStep: false,
649
- ifFromAnyStep: false,
650
- stoppageStepId: -1,
651
- }
652
-
653
- if (wizard.isValidateForStep(1, currentStep.id, nextStep.id)) {
654
- const targetDeviceValidation = checkTargetDeviceSync(
655
- localization.value,
656
- targetDevice.value,
657
- wizard,
658
- value,
659
- isNewView.value
660
- )
661
-
662
- value = targetDeviceValidation.newValue
663
-
664
- stepHasError = stepHasError || targetDeviceValidation.stepHasError
665
- }
666
-
667
- if (wizard.isValidateForStep(2, currentStep.id, nextStep.id)) {
668
- wizard.waitingStepId = nextStep.id
669
-
670
- const adapterValidation = checkAdaptersSync(
671
- localization.value,
672
- adapterStatus.value,
673
- value,
674
- currentStep.id,
675
- nextStep.id,
676
- props.freeAdapters,
677
- showNoActiveAdaptersModal,
678
- showNoConnectedActiveAdaptersModal,
679
- 2
680
- )
681
-
682
- value = adapterValidation.newValue
683
-
684
- stepShouldStop = adapterValidation.stepShouldStop || stepShouldStop
685
-
686
- stepHasError = stepHasError || adapterValidation.stepHasError
687
- }
688
-
689
- if (wizard.isValidateForStep(3, currentStep.id, nextStep.id)) {
690
- const labelValidation = await checkNetworkAsync(
691
- value,
692
- portProperties.value.networkLabel,
693
- 3,
694
- UI_E_ValidationFields.PORT_PROPERTIES_NETWORK,
695
- emits,
696
- localization.value,
697
- wizard
698
- )
699
-
700
- value = labelValidation.newValue
701
-
702
- const portPropertiesValidation = checkPortPropertiesSync(
703
- localization.value,
704
- portProperties.value,
705
- wizard,
706
- value
707
- )
708
-
709
- value = portPropertiesValidation.newValue
710
-
711
- stepHasError =
712
- stepHasError ||
713
- labelValidation.stepHasError ||
714
- portPropertiesValidation.stepHasError
715
- }
716
-
717
- if (wizard.isValidateForStep(4, currentStep.id, nextStep.id)) {
718
- const ipValidation = checkIpFourSettingsSync(
719
- localization.value,
720
- ipFourSettings.value,
721
- wizard,
722
- value
723
- )
724
-
725
- value = ipValidation.newValue
726
-
727
- stepHasError = stepHasError || ipValidation.stepHasError
728
- }
729
-
730
- if (wizard.isValidateForStep(5, currentStep.id, nextStep.id)) {
731
- const labelValidation = await checkNetworkAsync(
732
- value,
733
- connectionSettings.value.networkLabel,
734
- 5,
735
- UI_E_ValidationFields.CONNECTION_SETTINGS_NETWORK,
736
- emits,
737
- localization.value,
738
- wizard
739
- )
740
-
741
- value = labelValidation.newValue
742
-
743
- const connectionSettingsValidation = checkConnectionSettingsSync(
744
- localization.value,
745
- connectionSettings.value,
746
- wizard,
747
- value
748
- )
749
-
750
- value = connectionSettingsValidation.newValue
751
-
752
- stepHasError =
753
- stepHasError ||
754
- labelValidation.stepHasError ||
755
- connectionSettingsValidation.stepHasError
756
- }
757
-
758
- if (wizard.isValidateForStep(6, currentStep.id, nextStep.id)) {
759
- wizard.waitingStepId = nextStep.id
760
-
761
- const adapterValidation = checkAdaptersSync(
762
- localization.value,
763
- adapterStatus.value,
764
- value,
765
- currentStep.id,
766
- nextStep.id,
767
- props.adapters.items,
768
- showNoActiveAdaptersModal,
769
- showNoConnectedActiveAdaptersModal,
770
- 6
771
- )
772
-
773
- value = adapterValidation.newValue
774
-
775
- stepShouldStop = adapterValidation.stepShouldStop || stepShouldStop
776
-
777
- stepHasError = stepHasError || adapterValidation.stepHasError
778
- }
779
-
780
- return {
781
- newValue: value,
782
- stepHasError,
783
- stepShouldStop,
784
- }
785
- }
786
-
787
- const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> =>
788
- wizard.changeSteps(value, validationFunc, finalValidationFunc)
789
-
790
- const onHideAddNetworkingModal = (): void => {
791
- emits('hide')
792
- reset()
793
- }
794
-
795
- const onSubmit = async (): Promise<void> => {
796
- let data:
797
- | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
798
- | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
799
- | UI_I_AddNetworkingFourthOrFifthSchemeDataSend
800
- | API_UI_I_SwitchItem
801
- | null = null
802
-
803
- let type: 'network' | 'vmkernel' | 'adapter' | 'new-switch' = 'network'
804
-
805
- if (wizard.isSelectedScheme(0) || wizard.isSelectedScheme(1)) {
806
- const vlan = getVlanId(portProperties.value.vlanId)
807
- type = 'vmkernel'
808
- data = addNetworkingZeroOrFirstSchemeDataFunc(
809
- targetDevice.value,
810
- Number(vlan),
811
- portProperties.value,
812
- ipFourSettings.value,
813
- wizard.isSelectedScheme(1),
814
- adapterStatus.value
815
- )
816
- }
817
-
818
- if (wizard.isSelectedScheme(2) || wizard.isSelectedScheme(3)) {
819
- const vlan = getVlanId(connectionSettings.value.vlanId)
820
- type = 'network'
821
- data = addNetworkingSecondOrThirdSchemeDataFunc(
822
- connectionSettings.value,
823
- targetDevice.value,
824
- Number(vlan),
825
- wizard.isSelectedScheme(2),
826
- adapterStatus.value
827
- )
828
- }
829
-
830
- if (wizard.isSelectedScheme(4) || wizard.isSelectedScheme(5)) {
831
- type = wizard.isSelectedScheme(4) ? 'adapter' : 'new-switch'
832
- data = addNetworkingFourthOrFifthSchemeDataFunc(
833
- targetDevice.value.switch,
834
- wizard.isSelectedScheme(4),
835
- adapterStatus.value,
836
- props.diagramsData,
837
- targetDevice.value.mtu
838
- )
839
- }
840
-
841
- data &&
842
- emits('send-add-networking-data', data, type, onHideAddNetworkingModal)
843
- }
844
-
845
- onMounted(() => {
846
- localHostName.value = location.hostname
847
- })
848
-
849
- watch(
850
- () => props.isNetworkingLoading,
851
- (newValue: boolean) => {
852
- wizard.setLoader(newValue)
853
- },
854
- {
855
- immediate: true,
856
- }
857
- )
858
-
859
- watch(
860
- props.tcpStacks,
861
- (newValue: UI_I_TCPStack[]) => {
862
- portProperties.value.tcp = newValue?.[0]?.id || ''
863
- ipFourSettings.value.static.defaultGateway.value =
864
- newValue?.[0]?.gateway || ''
865
- },
866
- { deep: true }
867
- )
868
- </script>
869
-
870
- <style scoped lang="scss"></style>
1
+ <template>
2
+ <common-wizards-network-add-new
3
+ v-if="isNewView"
4
+ v-model:connection-type="connectionTypeLocal"
5
+ :show="props.show"
6
+ :wizard="wizard"
7
+ :selected-scheme="selectedScheme"
8
+ :host-name="hostNameLocal"
9
+ :project="props.project"
10
+ :target-device="targetDevice"
11
+ :standard-switches-initial="props.standardSwitchesInitial"
12
+ :alert-messages="alertMessages"
13
+ :selected-standard-switch-id="props.selectedStandardSwitchId"
14
+ :selected-switch-id="props.selectedSwitchId"
15
+ :free-adapters="props.freeAdapters"
16
+ :added-adapters="addedAdapters"
17
+ :core-adapters="coreAdapters"
18
+ :adapter-status="adapterStatus"
19
+ :adapters="props.adapters"
20
+ :is-show-no-connected-active-adapters-modal="
21
+ isShowNoConnectedActiveAdaptersModal
22
+ "
23
+ :is-show-no-active-adapters-modal="isShowNoActiveAdaptersModal"
24
+ :is-dark-mode="props.isDarkMode"
25
+ :port-properties="portProperties"
26
+ :mtu-from-switch="mtuFromSwitch"
27
+ :tcp-stacks="props.tcpStacks"
28
+ :ip-four-settings="ipFourSettings"
29
+ :gateway-flag="gatewayFlag"
30
+ :connection-settings="connectionSettings"
31
+ :ready-complete-fields="readyCompleteFields"
32
+ @change-connection-settings="onChangeConnectionSettings"
33
+ @change-gateway-flag="onChangeGatewayFlag"
34
+ @change-ip-four-settings="onChangeIpFourSettings"
35
+ @change-port-properties="onChangePortProperties"
36
+ @get-free-adapters="onGetFreeAdapters"
37
+ @change-added-adapters="onChangeAddedAdapters"
38
+ @change-adapter-status="onChangeAdapterStatus"
39
+ @confirm-no-active-adapters-modal="onConfirmNoActiveAdaptersModal"
40
+ @hide-no-connected-active-adapters-modal="
41
+ onHideNoConnectedActiveAdaptersModal
42
+ "
43
+ @hide-no-active-adapters-modal="onHideNoActiveAdaptersModal"
44
+ @hide-alert="onHideAlert"
45
+ @change-target-device="onChangeTargetDevice"
46
+ @change-steps="onChangeSteps"
47
+ @hide="onHideAddNetworkingModal"
48
+ @submit="onSubmit"
49
+ />
50
+ <common-wizards-network-add-old
51
+ v-else
52
+ v-model:connection-type="connectionTypeLocal"
53
+ :show="props.show"
54
+ :wizard="wizard"
55
+ :selected-scheme="selectedScheme"
56
+ :title="title"
57
+ :project="props.project"
58
+ :target-device="targetDevice"
59
+ :standard-switches-initial="props.standardSwitchesInitial"
60
+ :alert-messages="alertMessages"
61
+ :selected-standard-switch-id="props.selectedStandardSwitchId"
62
+ :selected-switch-id="props.selectedSwitchId"
63
+ :free-adapters="props.freeAdapters"
64
+ :added-adapters="addedAdapters"
65
+ :core-adapters="coreAdapters"
66
+ :adapter-status="adapterStatus"
67
+ :adapters="props.adapters"
68
+ :is-show-no-connected-active-adapters-modal="
69
+ isShowNoConnectedActiveAdaptersModal
70
+ "
71
+ :is-show-no-active-adapters-modal="isShowNoActiveAdaptersModal"
72
+ :is-dark-mode="props.isDarkMode"
73
+ :port-properties="portProperties"
74
+ :mtu-from-switch="mtuFromSwitch"
75
+ :tcp-stacks="props.tcpStacks"
76
+ :ip-four-settings="ipFourSettings"
77
+ :gateway-flag="gatewayFlag"
78
+ :connection-settings="connectionSettings"
79
+ :ready-complete-fields="readyCompleteFields"
80
+ @change-connection-settings="onChangeConnectionSettings"
81
+ @change-gateway-flag="onChangeGatewayFlag"
82
+ @change-ip-four-settings="onChangeIpFourSettings"
83
+ @change-port-properties="onChangePortProperties"
84
+ @get-free-adapters="onGetFreeAdapters"
85
+ @change-added-adapters="onChangeAddedAdapters"
86
+ @change-adapter-status="onChangeAdapterStatus"
87
+ @confirm-no-active-adapters-modal="onConfirmNoActiveAdaptersModal"
88
+ @hide-no-connected-active-adapters-modal="
89
+ onHideNoConnectedActiveAdaptersModal
90
+ "
91
+ @hide-no-active-adapters-modal="onHideNoActiveAdaptersModal"
92
+ @hide-alert="onHideAlert"
93
+ @change-target-device="onChangeTargetDevice"
94
+ @change-steps="onChangeSteps"
95
+ @hide="onHideAddNetworkingModal"
96
+ @submit="onSubmit"
97
+ />
98
+ </template>
99
+
100
+ <script setup lang="ts">
101
+ import type {
102
+ UI_I_ValidationReturn,
103
+ UI_I_WizardStep,
104
+ UI_I_WizardStepNavigation,
105
+ } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
106
+ import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
107
+ import type {
108
+ UI_I_ArbitraryObject,
109
+ UI_I_Localization,
110
+ UI_I_ItemsWithTotalCounts,
111
+ } from '~/lib/models/interfaces'
112
+ import type { UI_T_Project } from '~/lib/models/types'
113
+ import type {
114
+ UI_I_PortProperties,
115
+ UI_I_IpFourSettings,
116
+ UI_I_ConnectionSettings,
117
+ UI_I_TargetDevice,
118
+ UI_I_Switch,
119
+ UI_I_ReadyCompleteFields,
120
+ UI_I_AddNetworkingSecondOrThirdSchemeDataSend,
121
+ UI_I_AddNetworkingZeroOrFirstSchemeDataSend,
122
+ UI_I_AddNetworkingFourthOrFifthSchemeDataSend,
123
+ // UI_I_AddNetworkingEmits,
124
+ UI_I_TCPStack,
125
+ } from '~/components/common/wizards/network/add/lib/models/interfaces'
126
+ import type {
127
+ UI_I_Adapter,
128
+ UI_I_AdapterStatus,
129
+ UI_I_SwitchAdapterItem,
130
+ UI_I_DiagramData,
131
+ API_UI_I_SwitchItem,
132
+ UI_I_AvailableAdapters,
133
+ } from '~/components/common/diagramMain/lib/models/interfaces'
134
+ import { getAvailableAdapters } from '~/components/common/diagramMain/lib/utils/utils'
135
+ import { UI_E_ValidationFields } from '~/components/common/wizards/network/add/lib/models/enums'
136
+ import { getVlanId } from '~/components/common/wizards/network/add/lib/utils/utils'
137
+ import {
138
+ createZeroSchemeReadyCompleteFunc,
139
+ createFirstSchemeReadyCompleteFunc,
140
+ createSecondSchemeReadyCompleteFunc,
141
+ createThirdSchemeReadyCompleteFunc,
142
+ createFourthSchemeReadyCompleteFunc,
143
+ createFifthSchemeReadyCompleteFunc,
144
+ stepsSchemeInitial,
145
+ stepsFunc,
146
+ connectionSettingsInitial,
147
+ portPropertiesInitial,
148
+ ipFourSettingsInitial,
149
+ targetDeviceInitial,
150
+ addNetworkingZeroOrFirstSchemeDataFunc,
151
+ addNetworkingSecondOrThirdSchemeDataFunc,
152
+ addNetworkingFourthOrFifthSchemeDataFunc,
153
+ } from '~/components/common/wizards/network/add/lib/config/config'
154
+ import {
155
+ checkTargetDeviceSync,
156
+ checkAdaptersSync,
157
+ checkPortPropertiesSync,
158
+ checkIpFourSettingsSync,
159
+ checkConnectionSettingsSync,
160
+ checkNetworkAsync,
161
+ } from '~/components/common/wizards/network/add/validations/validations'
162
+
163
+ const props = withDefaults(
164
+ defineProps<{
165
+ show: boolean
166
+ adapters: UI_I_ItemsWithTotalCounts<UI_I_SwitchAdapterItem>
167
+ standardSwitchesInitial?: UI_I_Switch[]
168
+ freeAdapters?: UI_I_Adapter[]
169
+ project?: UI_T_Project
170
+ isDarkMode?: boolean
171
+ selectedStandardSwitchId?: string
172
+ selectedSwitchId?: string
173
+ tcpStacks?: UI_I_TCPStack[]
174
+ diagramsData?: UI_I_DiagramData[]
175
+ isNetworkingLoading?: boolean
176
+ hostName?: string
177
+ }>(),
178
+ {
179
+ standardSwitchesInitial: () => [],
180
+ freeAdapters: () => [],
181
+ project: 'procurator',
182
+ isDarkMode: false,
183
+ selectedStandardSwitchId: '',
184
+ selectedSwitchId: '',
185
+ tcpStacks: () => [],
186
+ diagramsData: [],
187
+ isNetworkingLoading: false,
188
+ }
189
+ )
190
+
191
+ const emits = defineEmits<{
192
+ (event: 'hide'): void
193
+ (
194
+ event: 'add-networking-data-validate',
195
+ data:
196
+ | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
197
+ | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
198
+ | UI_I_AddNetworkingFourthOrFifthSchemeDataSend
199
+ | API_UI_I_SwitchItem,
200
+ type: string,
201
+ setValidation: (err_arg: UI_I_ArbitraryObject<string>) => void
202
+ ): void
203
+ (
204
+ event: 'send-add-networking-data',
205
+ data:
206
+ | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
207
+ | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
208
+ | UI_I_AddNetworkingFourthOrFifthSchemeDataSend
209
+ | API_UI_I_SwitchItem,
210
+ type: string,
211
+ hideModal: () => void
212
+ ): void
213
+ (event: 'get-existing-standard-switches'): void
214
+ (event: 'get-free-adapters', cb: () => void): void
215
+ (
216
+ event: 'check-network-label',
217
+ label: string,
218
+ sendMessage: (message: string) => void
219
+ ): void
220
+ (event: 'get-tcp-stacks'): void
221
+ }>()
222
+
223
+ const { $store }: any = useNuxtApp()
224
+
225
+ const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
226
+
227
+ const localization = computed<UI_I_Localization>(() => useLocal())
228
+
229
+ const localHostName = ref<string>('')
230
+ const hostNameLocal = computed<string>(
231
+ () => props.hostName || localHostName.value
232
+ )
233
+
234
+ const title = computed<string>(
235
+ () => `${hostNameLocal.value} - ${localization.value.common.addNetworking}`
236
+ )
237
+
238
+ const wizard: Wizard = new Wizard(
239
+ stepsFunc(localization.value),
240
+ stepsSchemeInitial
241
+ )
242
+
243
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
244
+ const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
245
+
246
+ const readyCompleteFields = ref<UI_I_ReadyCompleteFields[]>([])
247
+
248
+ // Step's content data (connectionType)
249
+ const connectionType = ref<string>('0')
250
+
251
+ const connectionTypeLocal = computed<string>({
252
+ get() {
253
+ return connectionType.value
254
+ },
255
+ set(newValue: string) {
256
+ wizard.resetAfterSelected()
257
+ connectionType.value = newValue
258
+ targetDevice.value.standardSwitch = props.selectedStandardSwitchId
259
+ targetDevice.value.switch = props.selectedSwitchId
260
+ },
261
+ })
262
+
263
+ // Step's content data (createStandardSwitch)
264
+ const addedAdapters = ref<string[]>([])
265
+ const coreAdapters = ref<string[]>([])
266
+
267
+ const onChangeAddedAdapters = (addedAdaptersNew: string[]): void => {
268
+ addedAdapters.value = addedAdaptersNew
269
+ }
270
+
271
+ const adapterStatus = ref<UI_I_AdapterStatus>({
272
+ active: [],
273
+ standby: [],
274
+ unused: [],
275
+ })
276
+ const onChangeAdapterStatus = (adapterStatusNew: UI_I_AdapterStatus): void => {
277
+ adapterStatus.value = adapterStatusNew
278
+ }
279
+
280
+ // Step's content data and changers (targetDevice)
281
+ const targetDevice = ref<UI_I_TargetDevice>(useDeepCopy(targetDeviceInitial))
282
+ const mtuFromSwitch = ref<number>(1500)
283
+
284
+ const onChangeTargetDevice = (newTargetDevice: UI_I_TargetDevice): void => {
285
+ const oldTargetDeviceSelected = useDeepCopy(targetDevice.value).selected
286
+ const newTargetDeviceSelected = newTargetDevice.selected
287
+
288
+ if (oldTargetDeviceSelected !== newTargetDeviceSelected) {
289
+ wizard.resetAfterSelected()
290
+ }
291
+
292
+ const selectedSwitch = props.standardSwitchesInitial.find(
293
+ (currentSwitch: UI_I_Switch) =>
294
+ newTargetDevice.standardSwitch === currentSwitch.name
295
+ )
296
+
297
+ if (newTargetDeviceSelected === '1' && selectedSwitch) {
298
+ mtuFromSwitch.value = selectedSwitch?.mtu || 1500
299
+ }
300
+ if (newTargetDeviceSelected === '3') {
301
+ mtuFromSwitch.value = newTargetDevice.mtu || 1500
302
+ }
303
+
304
+ targetDevice.value = useDeepCopy(newTargetDevice)
305
+ }
306
+
307
+ // Step's content data and changers (portProperties)
308
+ const portProperties = ref<UI_I_PortProperties>(
309
+ useDeepCopy(portPropertiesInitial)
310
+ )
311
+ const onChangePortProperties = (newFields: UI_I_PortProperties): void => {
312
+ if (portProperties.value.tcp !== newFields.tcp) {
313
+ ipFourSettings.value.static.defaultGateway.value =
314
+ props.tcpStacks?.find((tcp: UI_I_TCPStack) => tcp.id === newFields.tcp)
315
+ .gateway || ''
316
+ }
317
+ portProperties.value = newFields
318
+ }
319
+
320
+ // Step's content data and changers (ipFourSettings)
321
+ const ipFourSettings = ref<UI_I_IpFourSettings>(ipFourSettingsInitial)
322
+ const onChangeIpFourSettings = (newFields: UI_I_IpFourSettings): void => {
323
+ ipFourSettings.value = newFields
324
+ }
325
+
326
+ const gatewayFlag = ref<boolean>(false)
327
+ const onChangeGatewayFlag = (newValue: boolean) => {
328
+ gatewayFlag.value = newValue
329
+ }
330
+
331
+ // Step's content data and changers (connectionSettings)
332
+ const connectionSettings = ref<UI_I_ConnectionSettings>(
333
+ connectionSettingsInitial
334
+ )
335
+ const onChangeConnectionSettings = (
336
+ newFields: UI_I_ConnectionSettings
337
+ ): void => {
338
+ connectionSettings.value = newFields
339
+ }
340
+
341
+ const onHideAlert = (stepId: number, field?: string): void => {
342
+ wizard.hideAlertMessagesByStepId(stepId, field)
343
+ }
344
+
345
+ let flagSwitch = ''
346
+
347
+ // Choosing Scheme
348
+ watch(
349
+ [connectionTypeLocal, targetDevice],
350
+ (
351
+ newValues: [string, UI_I_TargetDevice],
352
+ oldValues: [string, UI_I_TargetDevice]
353
+ ) => {
354
+ const newCT = newValues[0] // -> newConnectionType
355
+ const oldCT = oldValues[0] // -> oldConnectionType
356
+ const newTD = newValues[1] // -> newTargetDevice
357
+ const oldTD = oldValues[1] // -> oldTargetDevice
358
+ if (!oldTD || oldTD.selected !== newTD.selected) {
359
+ flagSwitch = ''
360
+ addedAdapters.value = []
361
+ adapterStatus.value = {
362
+ active: [],
363
+ standby: [],
364
+ unused: [],
365
+ }
366
+ }
367
+ if (newCT !== oldCT) {
368
+ newCT === '0' && props.selectedStandardSwitchId
369
+ ? (targetDevice.value.selected = '1')
370
+ : (targetDevice.value.selected = '0')
371
+ newCT === '1' && (targetDevice.value.selected = '1')
372
+ newCT === '2' && (targetDevice.value.selected = '2')
373
+ }
374
+ if (newCT === '0') {
375
+ ;(newTD.selected === '0' || newTD.selected === '1') &&
376
+ wizard.changeScheme(0)
377
+ newTD.selected === '3' && wizard.changeScheme(1)
378
+ }
379
+ if (newCT === '1') {
380
+ newTD.selected === '1' && wizard.changeScheme(2)
381
+ newTD.selected === '3' && wizard.changeScheme(3)
382
+ }
383
+ if (newCT === '2') {
384
+ newTD.selected === '2' && wizard.changeScheme(4)
385
+ newTD.selected === '3' && wizard.changeScheme(5)
386
+ }
387
+ },
388
+ { deep: true, immediate: true }
389
+ )
390
+
391
+ const onGetExistingStandardSwitches = (): void => {
392
+ emits('get-existing-standard-switches')
393
+ }
394
+
395
+ const onGetTcpStacks = (): void => {
396
+ emits('get-tcp-stacks')
397
+ }
398
+
399
+ watch(
400
+ () => wizard.selectedStepId,
401
+ (newSelectedStep: number) => {
402
+ if (newSelectedStep === 1) {
403
+ onGetExistingStandardSwitches()
404
+ }
405
+ if (newSelectedStep === 3) {
406
+ onGetTcpStacks()
407
+ }
408
+ if (newSelectedStep === 6 && flagSwitch !== targetDevice.value.switch) {
409
+ const nics: UI_I_AdapterStatus = props.standardSwitchesInitial.find(
410
+ (currentSwitch: UI_I_Switch) =>
411
+ currentSwitch.id === targetDevice.value.switch
412
+ ).nics
413
+
414
+ const availableAdapters: UI_I_AvailableAdapters = getAvailableAdapters(
415
+ props.adapters,
416
+ nics
417
+ )
418
+
419
+ adapterStatus.value = {
420
+ active: availableAdapters.activeAdapters || [],
421
+ standby: availableAdapters.standbyAdapters || [],
422
+ unused: availableAdapters.unusedAdapters || [],
423
+ }
424
+ coreAdapters.value = [
425
+ ...adapterStatus.value.active,
426
+ ...adapterStatus.value.standby,
427
+ ...adapterStatus.value.unused,
428
+ ]
429
+ flagSwitch = targetDevice.value.switch
430
+ }
431
+
432
+ if (newSelectedStep !== 7) return // If last step
433
+ if (wizard.isSelectedScheme(0)) {
434
+ readyCompleteFields.value = createZeroSchemeReadyCompleteFunc(
435
+ isNewView.value,
436
+ targetDevice.value,
437
+ portProperties.value,
438
+ ipFourSettings.value,
439
+ localization.value
440
+ )
441
+ return
442
+ }
443
+
444
+ if (wizard.isSelectedScheme(1)) {
445
+ readyCompleteFields.value = createFirstSchemeReadyCompleteFunc(
446
+ isNewView.value,
447
+ targetDevice.value,
448
+ portProperties.value,
449
+ ipFourSettings.value,
450
+ addedAdapters.value,
451
+ localization.value
452
+ )
453
+ return
454
+ }
455
+ if (wizard.isSelectedScheme(2)) {
456
+ readyCompleteFields.value = createSecondSchemeReadyCompleteFunc(
457
+ isNewView.value,
458
+ connectionSettings.value,
459
+ targetDevice.value,
460
+ localization.value
461
+ )
462
+ return
463
+ }
464
+ if (wizard.isSelectedScheme(3)) {
465
+ readyCompleteFields.value = createThirdSchemeReadyCompleteFunc(
466
+ isNewView.value,
467
+ connectionSettings.value,
468
+ targetDevice.value,
469
+ addedAdapters.value,
470
+ localization.value
471
+ )
472
+ return
473
+ }
474
+ if (wizard.isSelectedScheme(4)) {
475
+ readyCompleteFields.value = createFourthSchemeReadyCompleteFunc(
476
+ isNewView.value,
477
+ targetDevice.value.switch,
478
+ props.diagramsData,
479
+ adapterStatus.value,
480
+ localization.value
481
+ )
482
+ return
483
+ }
484
+ if (wizard.isSelectedScheme(5)) {
485
+ readyCompleteFields.value = createFifthSchemeReadyCompleteFunc(
486
+ isNewView.value,
487
+ targetDevice.value,
488
+ adapterStatus.value,
489
+ localization.value
490
+ )
491
+ }
492
+ }
493
+ )
494
+
495
+ // Reset data
496
+ const reset = (): void => {
497
+ wizard.reset()
498
+ connectionTypeLocal.value = '0'
499
+ targetDevice.value = useDeepCopy(targetDeviceInitial)
500
+ connectionSettings.value = useDeepCopy(connectionSettingsInitial)
501
+ portProperties.value = useDeepCopy(portPropertiesInitial)
502
+ ipFourSettings.value = useDeepCopy(ipFourSettingsInitial)
503
+ coreAdapters.value = []
504
+ addedAdapters.value = []
505
+ adapterStatus.value = {
506
+ active: [],
507
+ standby: [],
508
+ unused: [],
509
+ }
510
+ }
511
+
512
+ const isShowNoConnectedActiveAdaptersModal = ref(false)
513
+ const isShowNoActiveAdaptersModal = ref(false)
514
+
515
+ const showNoConnectedActiveAdaptersModal = (): void => {
516
+ isShowNoConnectedActiveAdaptersModal.value = true
517
+ }
518
+ const onHideNoConnectedActiveAdaptersModal = (): void => {
519
+ isShowNoConnectedActiveAdaptersModal.value = false
520
+ }
521
+ const showNoActiveAdaptersModal = (): void => {
522
+ isShowNoActiveAdaptersModal.value = true
523
+ }
524
+ const onHideNoActiveAdaptersModal = (): void => {
525
+ isShowNoActiveAdaptersModal.value = false
526
+ }
527
+
528
+ const onConfirmNoActiveAdaptersModal = (): void => {
529
+ onHideNoConnectedActiveAdaptersModal()
530
+ onHideNoActiveAdaptersModal()
531
+ if (wizard.waitingStepId === 7) {
532
+ wizard.changeSteps(
533
+ wizard.selectedStepData(
534
+ wizard.stepsInSelectedSchemeWithStatus.value.find(
535
+ (step: UI_I_WizardStepNavigation) => step.id === 7
536
+ )
537
+ ),
538
+ validationFunc,
539
+ props.project === 'sphere' ? null : finalValidationFunc,
540
+ true
541
+ )
542
+ wizard.waitingStepId = -1
543
+ return
544
+ }
545
+ wizard.selectStepHard(wizard.waitingStepId)
546
+ }
547
+
548
+ const onGetFreeAdapters = (showModal: () => void): void => {
549
+ emits('get-free-adapters', showModal)
550
+ }
551
+
552
+ const checkFinal = async (): Promise<UI_I_ArbitraryObject<string>> => {
553
+ let data:
554
+ | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
555
+ | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
556
+ | UI_I_AddNetworkingFourthOrFifthSchemeDataSend
557
+ | API_UI_I_SwitchItem
558
+ | null = null
559
+
560
+ let type: 'network' | 'vmkernel' | 'adapter' | 'new-switch'
561
+
562
+ if (wizard.isSelectedScheme(0) || wizard.isSelectedScheme(1)) {
563
+ const vlan = getVlanId(portProperties.value.vlanId)
564
+
565
+ data = addNetworkingZeroOrFirstSchemeDataFunc(
566
+ targetDevice.value,
567
+ Number(vlan),
568
+ portProperties.value,
569
+ ipFourSettings.value,
570
+ wizard.isSelectedScheme(1),
571
+ adapterStatus.value
572
+ )
573
+
574
+ type = 'vmkernel'
575
+ }
576
+
577
+ if (wizard.isSelectedScheme(2) || wizard.isSelectedScheme(3)) {
578
+ const vlan = getVlanId(connectionSettings.value.vlanId)
579
+
580
+ data = addNetworkingSecondOrThirdSchemeDataFunc(
581
+ connectionSettings.value,
582
+ targetDevice.value,
583
+ Number(vlan),
584
+ wizard.isSelectedScheme(2),
585
+ adapterStatus.value
586
+ )
587
+
588
+ type = 'network'
589
+ }
590
+
591
+ if (wizard.isSelectedScheme(4) || wizard.isSelectedScheme(5)) {
592
+ data = addNetworkingFourthOrFifthSchemeDataFunc(
593
+ targetDevice.value.switch,
594
+ wizard.isSelectedScheme(4),
595
+ adapterStatus.value,
596
+ props.diagramsData,
597
+ targetDevice.value.mtu
598
+ )
599
+
600
+ type = wizard.isSelectedScheme(4) ? 'adapter' : 'new-switch'
601
+ }
602
+
603
+ return new Promise((resolve, _reject) =>
604
+ emits(
605
+ 'add-networking-data-validate',
606
+ data,
607
+ type,
608
+ (err_arg: UI_I_ArbitraryObject<string>): void => {
609
+ resolve(err_arg)
610
+ }
611
+ )
612
+ )
613
+ }
614
+
615
+ const finalValidationFunc = async (
616
+ value: UI_I_WizardStep[]
617
+ ): Promise<UI_I_ValidationReturn> => {
618
+ let stepHasError = false
619
+
620
+ const validationFields: {
621
+ [key: string]: string
622
+ } = await checkFinal()
623
+
624
+ for (const fieldName in validationFields) {
625
+ const stepId = wizard.getStepIdByFieldName(fieldName)
626
+
627
+ if (stepId !== -1) {
628
+ stepHasError = wizard.setValidation(stepId, fieldName, {
629
+ fieldMessage: validationFields[fieldName],
630
+ alertMessage: validationFields[fieldName],
631
+ })
632
+ }
633
+ }
634
+
635
+ return {
636
+ stepHasError,
637
+ newValue: value,
638
+ }
639
+ }
640
+
641
+ const validationFunc = async (
642
+ value: UI_I_WizardStep[],
643
+ currentStep: UI_I_WizardStep,
644
+ nextStep: UI_I_WizardStep
645
+ ): Promise<UI_I_ValidationReturn> => {
646
+ let stepHasError = false
647
+ let stepShouldStop = {
648
+ ifOnCurrentStep: false,
649
+ ifFromAnyStep: false,
650
+ stoppageStepId: -1,
651
+ }
652
+
653
+ if (wizard.isValidateForStep(1, currentStep.id, nextStep.id)) {
654
+ const targetDeviceValidation = checkTargetDeviceSync(
655
+ localization.value,
656
+ targetDevice.value,
657
+ wizard,
658
+ value,
659
+ isNewView.value
660
+ )
661
+
662
+ value = targetDeviceValidation.newValue
663
+
664
+ stepHasError = stepHasError || targetDeviceValidation.stepHasError
665
+ }
666
+
667
+ if (wizard.isValidateForStep(2, currentStep.id, nextStep.id)) {
668
+ wizard.waitingStepId = nextStep.id
669
+
670
+ const adapterValidation = checkAdaptersSync(
671
+ localization.value,
672
+ adapterStatus.value,
673
+ value,
674
+ currentStep.id,
675
+ nextStep.id,
676
+ props.freeAdapters,
677
+ showNoActiveAdaptersModal,
678
+ showNoConnectedActiveAdaptersModal,
679
+ 2
680
+ )
681
+
682
+ value = adapterValidation.newValue
683
+
684
+ stepShouldStop = adapterValidation.stepShouldStop || stepShouldStop
685
+
686
+ stepHasError = stepHasError || adapterValidation.stepHasError
687
+ }
688
+
689
+ if (wizard.isValidateForStep(3, currentStep.id, nextStep.id)) {
690
+ const labelValidation = await checkNetworkAsync(
691
+ value,
692
+ portProperties.value.networkLabel,
693
+ 3,
694
+ UI_E_ValidationFields.PORT_PROPERTIES_NETWORK,
695
+ emits,
696
+ localization.value,
697
+ wizard
698
+ )
699
+
700
+ value = labelValidation.newValue
701
+
702
+ const portPropertiesValidation = checkPortPropertiesSync(
703
+ localization.value,
704
+ portProperties.value,
705
+ wizard,
706
+ value
707
+ )
708
+
709
+ value = portPropertiesValidation.newValue
710
+
711
+ stepHasError =
712
+ stepHasError ||
713
+ labelValidation.stepHasError ||
714
+ portPropertiesValidation.stepHasError
715
+ }
716
+
717
+ if (wizard.isValidateForStep(4, currentStep.id, nextStep.id)) {
718
+ const ipValidation = checkIpFourSettingsSync(
719
+ localization.value,
720
+ ipFourSettings.value,
721
+ wizard,
722
+ value
723
+ )
724
+
725
+ value = ipValidation.newValue
726
+
727
+ stepHasError = stepHasError || ipValidation.stepHasError
728
+ }
729
+
730
+ if (wizard.isValidateForStep(5, currentStep.id, nextStep.id)) {
731
+ const labelValidation = await checkNetworkAsync(
732
+ value,
733
+ connectionSettings.value.networkLabel,
734
+ 5,
735
+ UI_E_ValidationFields.CONNECTION_SETTINGS_NETWORK,
736
+ emits,
737
+ localization.value,
738
+ wizard
739
+ )
740
+
741
+ value = labelValidation.newValue
742
+
743
+ const connectionSettingsValidation = checkConnectionSettingsSync(
744
+ localization.value,
745
+ connectionSettings.value,
746
+ wizard,
747
+ value
748
+ )
749
+
750
+ value = connectionSettingsValidation.newValue
751
+
752
+ stepHasError =
753
+ stepHasError ||
754
+ labelValidation.stepHasError ||
755
+ connectionSettingsValidation.stepHasError
756
+ }
757
+
758
+ if (wizard.isValidateForStep(6, currentStep.id, nextStep.id)) {
759
+ wizard.waitingStepId = nextStep.id
760
+
761
+ const adapterValidation = checkAdaptersSync(
762
+ localization.value,
763
+ adapterStatus.value,
764
+ value,
765
+ currentStep.id,
766
+ nextStep.id,
767
+ props.adapters.items,
768
+ showNoActiveAdaptersModal,
769
+ showNoConnectedActiveAdaptersModal,
770
+ 6
771
+ )
772
+
773
+ value = adapterValidation.newValue
774
+
775
+ stepShouldStop = adapterValidation.stepShouldStop || stepShouldStop
776
+
777
+ stepHasError = stepHasError || adapterValidation.stepHasError
778
+ }
779
+
780
+ return {
781
+ newValue: value,
782
+ stepHasError,
783
+ stepShouldStop,
784
+ }
785
+ }
786
+
787
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> =>
788
+ wizard.changeSteps(value, validationFunc, finalValidationFunc)
789
+
790
+ const onHideAddNetworkingModal = (): void => {
791
+ emits('hide')
792
+ reset()
793
+ }
794
+
795
+ const onSubmit = async (): Promise<void> => {
796
+ let data:
797
+ | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
798
+ | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
799
+ | UI_I_AddNetworkingFourthOrFifthSchemeDataSend
800
+ | API_UI_I_SwitchItem
801
+ | null = null
802
+
803
+ let type: 'network' | 'vmkernel' | 'adapter' | 'new-switch' = 'network'
804
+
805
+ if (wizard.isSelectedScheme(0) || wizard.isSelectedScheme(1)) {
806
+ const vlan = getVlanId(portProperties.value.vlanId)
807
+ type = 'vmkernel'
808
+ data = addNetworkingZeroOrFirstSchemeDataFunc(
809
+ targetDevice.value,
810
+ Number(vlan),
811
+ portProperties.value,
812
+ ipFourSettings.value,
813
+ wizard.isSelectedScheme(1),
814
+ adapterStatus.value
815
+ )
816
+ }
817
+
818
+ if (wizard.isSelectedScheme(2) || wizard.isSelectedScheme(3)) {
819
+ const vlan = getVlanId(connectionSettings.value.vlanId)
820
+ type = 'network'
821
+ data = addNetworkingSecondOrThirdSchemeDataFunc(
822
+ connectionSettings.value,
823
+ targetDevice.value,
824
+ Number(vlan),
825
+ wizard.isSelectedScheme(2),
826
+ adapterStatus.value
827
+ )
828
+ }
829
+
830
+ if (wizard.isSelectedScheme(4) || wizard.isSelectedScheme(5)) {
831
+ type = wizard.isSelectedScheme(4) ? 'adapter' : 'new-switch'
832
+ data = addNetworkingFourthOrFifthSchemeDataFunc(
833
+ targetDevice.value.switch,
834
+ wizard.isSelectedScheme(4),
835
+ adapterStatus.value,
836
+ props.diagramsData,
837
+ targetDevice.value.mtu
838
+ )
839
+ }
840
+
841
+ data &&
842
+ emits('send-add-networking-data', data, type, onHideAddNetworkingModal)
843
+ }
844
+
845
+ onMounted(() => {
846
+ localHostName.value = location.hostname
847
+ })
848
+
849
+ watch(
850
+ () => props.isNetworkingLoading,
851
+ (newValue: boolean) => {
852
+ wizard.setLoader(newValue)
853
+ },
854
+ {
855
+ immediate: true,
856
+ }
857
+ )
858
+
859
+ watch(
860
+ props.tcpStacks,
861
+ (newValue: UI_I_TCPStack[]) => {
862
+ portProperties.value.tcp = newValue?.[0]?.id || ''
863
+ ipFourSettings.value.static.defaultGateway.value =
864
+ newValue?.[0]?.gateway || ''
865
+ },
866
+ { deep: true }
867
+ )
868
+ </script>
869
+
870
+ <style scoped lang="scss"></style>