bfg-common 1.4.661 → 1.4.662

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 (141) hide show
  1. package/assets/img/icons/icons-sprite-dark-3.svg +227 -227
  2. package/assets/img/icons/icons-sprite-dark-5.svg +488 -488
  3. package/assets/img/icons/icons-sprite-light-3.svg +227 -227
  4. package/assets/img/icons/icons-sprite-light-5.svg +488 -488
  5. package/components/atoms/TheIcon3.vue +50 -50
  6. package/components/atoms/modal/bySteps/BySteps.vue +253 -253
  7. package/components/atoms/stack/StackBlock.vue +185 -185
  8. package/components/atoms/table/dataGrid/DataGrid.vue +1696 -1696
  9. package/components/atoms/table/dataGrid/DataGridColumnSwitch.vue +222 -222
  10. package/components/atoms/table/dataGrid/lib/config/settingsTable.ts +91 -91
  11. package/components/common/browse/BrowseNew.vue +237 -237
  12. package/components/common/browse/BrowseOld.vue +217 -217
  13. package/components/common/browse/blocks/contents/Files.vue +37 -37
  14. package/components/common/browse/blocks/contents/FilesOld.vue +72 -72
  15. package/components/common/browse/blocks/contents/filesNew/FilesNew.vue +96 -96
  16. package/components/common/browse/blocks/contents/filesNew/Skeleton.vue +18 -18
  17. package/components/common/browse/blocks/lib/models/types.ts +1 -1
  18. package/components/common/browse/lib/models/interfaces.ts +5 -5
  19. package/components/common/context/lib/models/interfaces.ts +30 -30
  20. package/components/common/context/recursion/Recursion.vue +86 -86
  21. package/components/common/context/recursion/RecursionNew.vue +199 -199
  22. package/components/common/context/recursion/RecursionOld.vue +213 -213
  23. package/components/common/diagramMain/Header.vue +211 -211
  24. package/components/common/diagramMain/adapter/AdapterItems.vue +61 -61
  25. package/components/common/diagramMain/lib/config/initial.ts +50 -50
  26. package/components/common/diagramMain/lib/models/types.ts +21 -21
  27. package/components/common/diagramMain/lib/utils/utils.ts +331 -331
  28. package/components/common/diagramMain/modals/ManagePhysicalAdaptersModal.vue +330 -330
  29. package/components/common/diagramMain/modals/editSettings/ConfirmTeamingSettingsModal.vue +40 -40
  30. package/components/common/diagramMain/modals/editSettings/EditSettings.vue +497 -497
  31. package/components/common/diagramMain/modals/editSettings/EditSettingsModal.vue +812 -812
  32. package/components/common/diagramMain/modals/editSettings/tabs/NetworkProperties.vue +214 -214
  33. package/components/common/diagramMain/modals/editSettings/tabs/Security.vue +189 -189
  34. package/components/common/diagramMain/modals/editSettings/tabs/SwitchProperties.vue +163 -163
  35. package/components/common/diagramMain/modals/editSettings/tabs/TeamingFailover.vue +175 -175
  36. package/components/common/diagramMain/modals/editSettings/tabs/TrafficShaping.vue +398 -398
  37. package/components/common/diagramMain/modals/editSettings/tabs/port/IpvFourSettings.vue +346 -346
  38. package/components/common/diagramMain/modals/editSettings/tabs/port/PortProperties.vue +205 -205
  39. package/components/common/diagramMain/modals/lib/config/diagramConfig.ts +23 -23
  40. package/components/common/diagramMain/modals/lib/config/initial.ts +180 -180
  41. package/components/common/diagramMain/modals/lib/config/vmKernelAdapter.ts +90 -90
  42. package/components/common/diagramMain/modals/lib/mappers/mappers.ts +87 -87
  43. package/components/common/diagramMain/modals/lib/utils/index.ts +24 -24
  44. package/components/common/diagramMain/modals/migrateVmkernelAdapter/MigrateVmkernelAdapter.vue +537 -537
  45. package/components/common/diagramMain/modals/migrateVmkernelAdapter/lib/config/steps.ts +114 -114
  46. package/components/common/diagramMain/modals/migrateVmkernelAdapter/steps/ConnectionSettings.vue +169 -169
  47. package/components/common/diagramMain/modals/migrateVmkernelAdapter/steps/SelectVmkernelAdapter.vue +159 -159
  48. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/common.ts +14 -14
  49. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/connectionSettings.ts +137 -137
  50. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/selectVmkernelAdapter.ts +52 -52
  51. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/validations.ts +19 -19
  52. package/components/common/diagramMain/port/Ports.vue +47 -47
  53. package/components/common/layout/theHeader/helpMenu/About.vue +85 -85
  54. package/components/common/layout/theHeader/helpMenu/aboutNew/AboutNew.vue +105 -105
  55. package/components/common/mainNavigationPanel/MainNavigationPanel.vue +152 -152
  56. package/components/common/modals/confirmByInput/ConfirmByInput.vue +206 -206
  57. package/components/common/modals/unsavedChanges/UnsavedChanges.vue +56 -56
  58. package/components/common/select/button/ButtonDropdown.vue +108 -108
  59. package/components/common/spiceConsole/Drawer.vue +370 -370
  60. package/components/common/spiceConsole/lib/models/interfaces.ts +5 -5
  61. package/components/common/split/vertical/Vertical.vue +160 -160
  62. package/components/common/vm/actions/add/Add.vue +617 -617
  63. package/components/common/vm/actions/clone/lib/config/steps.ts +129 -129
  64. package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +267 -267
  65. package/components/common/vm/actions/common/customizeHardware/CustomizeHardwareNew.vue +269 -269
  66. package/components/common/vm/actions/common/customizeHardware/virtualHardware/browseView/BrowseView.vue +219 -219
  67. package/components/common/vm/actions/common/customizeHardware/virtualHardware/bus/BusNew.vue +118 -118
  68. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDriveNew.vue +161 -161
  69. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDriveOld.vue +165 -165
  70. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/Media.vue +25 -25
  71. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/MediaNew.vue +55 -55
  72. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Cpu.vue +338 -338
  73. package/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/config/dropdownItems.ts +147 -147
  74. package/components/common/vm/actions/common/customizeHardware/virtualHardware/limit/Limit.vue +220 -220
  75. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/mode/ModeOld.vue +55 -55
  76. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/sharing/SharingNew.vue +44 -44
  77. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +281 -281
  78. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetworkNew.vue +124 -124
  79. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/LocationOld.vue +134 -134
  80. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/new/New.vue +63 -63
  81. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/new/table/lib/config/config.ts +95 -95
  82. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddress.vue +119 -119
  83. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddressNew.vue +69 -69
  84. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddressOld.vue +83 -83
  85. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDeviceNew.vue +85 -85
  86. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDeviceOld.vue +91 -91
  87. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/DirectPathIoNew.vue +35 -35
  88. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/DynamicDirectPathIoNew.vue +48 -48
  89. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/Note.vue +15 -15
  90. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/NoteNew.vue +42 -42
  91. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/NoteOld.vue +30 -30
  92. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/nvidiaGrid/NvidiaGridNew.vue +30 -30
  93. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/typeSelection/TypeSelectionNew.vue +46 -46
  94. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbControllerNew.vue +56 -56
  95. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/Other.vue +16 -16
  96. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/OtherNew.vue +30 -30
  97. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCardNew.vue +107 -107
  98. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCardOld.vue +115 -115
  99. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/totalVideoMemory/TotalVideoMemoryNew.vue +54 -54
  100. package/components/common/vm/actions/common/customizeHardware/vmoptions/Vmoptions.vue +145 -145
  101. package/components/common/vm/actions/common/customizeHardware/vmoptions/VmoptionsNew.vue +102 -102
  102. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptionsNew.vue +75 -75
  103. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/delay/Delay.vue +26 -26
  104. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/Firmware.vue +57 -57
  105. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/FirmwareNew.vue +42 -42
  106. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/menu/MenuNew.vue +25 -25
  107. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +171 -171
  108. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/OrderNew.vue +50 -50
  109. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptionsNew.vue +141 -141
  110. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/New.vue +140 -140
  111. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/copyPaste/CopyPasteNew.vue +30 -30
  112. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/fileTransfer/FileTransferNew.vue +30 -30
  113. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/folderSharing/FolderSharingNew.vue +30 -30
  114. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +32 -32
  115. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/KeymapNew.vue +39 -39
  116. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/Password.vue +103 -103
  117. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/PasswordNew.vue +102 -102
  118. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/PasswordOld.vue +94 -94
  119. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirection.vue +28 -28
  120. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirectionNew.vue +38 -38
  121. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirectionOld.vue +44 -44
  122. package/components/common/vm/actions/common/select/storage/Storage.vue +130 -130
  123. package/components/common/vm/actions/common/select/storage/StorageOld.vue +129 -129
  124. package/components/common/vm/actions/editSettings/EditSettings.vue +232 -232
  125. package/components/common/vm/actions/editSettings/EditSettingsOld.vue +183 -183
  126. package/components/common/vm/actions/editSettings/new/New.vue +177 -177
  127. package/components/common/vm/actions/editSettings/new/Skeleton.vue +88 -88
  128. package/components/common/wizards/network/add/Add.vue +1056 -1047
  129. package/components/common/wizards/network/add/lib/config/config.ts +1 -0
  130. package/components/common/wizards/network/add/lib/config/steps.ts +497 -464
  131. package/components/common/wizards/network/add/steps/ReadyComplete.vue +20 -20
  132. package/components/common/wizards/network/add/steps/SelectedTargetDevice.vue +467 -474
  133. package/composables/productNameLocal.ts +30 -30
  134. package/package.json +1 -1
  135. package/plugins/date.ts +233 -233
  136. package/plugins/recursion.ts +311 -311
  137. package/public/spice-console/lib/images/bitmap.js +203 -203
  138. package/public/spice-console/network/spicechannel.js +383 -383
  139. package/store/main/mutations.ts +7 -7
  140. package/store/main/state.ts +7 -7
  141. package/store/tasks/mappers/recentTasks.ts +64 -64
@@ -1,1047 +1,1056 @@
1
- <template>
2
- <atoms-wizard
3
- v-model:show="props.show"
4
- :wizard="wizard"
5
- :selected-scheme="selectedScheme"
6
- :title="title"
7
- max-height="551px"
8
- :localization="localization"
9
- :class="[
10
- 'add-networking-wizard',
11
- {
12
- 'is-dark': props.isDarkMode,
13
- },
14
- ]"
15
- test-id="add-networking-wizard"
16
- @change-steps="onChangeSteps"
17
- @hide="onHideAddNetworkingModal"
18
- @submit="onSubmit"
19
- >
20
- <template #modalBody="{ selectedStep }">
21
- <common-wizards-network-add-steps-select-connection-type
22
- v-if="selectedStep.id === 0"
23
- v-model="connectionTypeLocal"
24
- />
25
- <common-wizards-network-add-steps-selected-target-device
26
- v-if="selectedStep.id === 1"
27
- :wizard="wizard"
28
- :target-device="targetDevice"
29
- :connection-type="connectionTypeLocal"
30
- :standard-switches-initial="props.standardSwitchesInitial"
31
- :messages-fields="selectedStep.fields"
32
- :alert-messages="alertMessages[1]"
33
- :selected-standard-switch-id="props.selectedStandardSwitchId"
34
- :selected-switch-id="props.selectedSwitchId"
35
- @hide-alert="onHideAlert"
36
- @change-target-device="onChangeTargetDevice"
37
- />
38
- <common-wizards-network-add-steps-create-standard-switch
39
- v-if="selectedStep.id === 2 || selectedStep.id === 6"
40
- :free-adapters="props.freeAdapters"
41
- :added-adapters="addedAdapters"
42
- :core-adapters="coreAdapters"
43
- :adapter-status="adapterStatus"
44
- :adapters="props.adapters"
45
- :is-show-no-connected-active-adapters-modal="
46
- isShowNoConnectedActiveAdaptersModal
47
- "
48
- :is-show-no-active-adapters-modal="isShowNoActiveAdaptersModal"
49
- :is-dark-mode="props.isDarkMode"
50
- @get-free-adapters="onGetFreeAdapters"
51
- @change-added-adapters="onChangeAddedAdapters"
52
- @change-adapter-status="onChangeAdapterStatus"
53
- @confirm-no-active-adapters-modal="onConfirmNoActiveAdaptersModal"
54
- @hide-no-connected-active-adapters-modal="
55
- onHideNoConnectedActiveAdaptersModal
56
- "
57
- @hide-no-active-adapters-modal="onHideNoActiveAdaptersModal"
58
- />
59
- <common-wizards-network-add-steps-port-properties
60
- v-if="selectedStep.id === 3"
61
- :wizard="wizard"
62
- :port-properties="portProperties"
63
- :mtu-from-switch="mtuFromSwitch"
64
- :project="props.project"
65
- :messages-fields="selectedStep.fields"
66
- :alert-messages="alertMessages[3]"
67
- :tcp-stacks="props.tcpStacks"
68
- @change-gateway-flag="onChangeGatewayFlag"
69
- @change-port-properties="onChangePortProperties"
70
- @hide-alert="onHideAlert"
71
- />
72
- <common-wizards-network-add-steps-ip-four-settings
73
- v-if="selectedStep.id === 4"
74
- :wizard="wizard"
75
- :ip-four-settings="ipFourSettings"
76
- :messages-fields="selectedStep.fields"
77
- :alert-messages="alertMessages[4]"
78
- :tcp-stacks="props.tcpStacks"
79
- :tcp="portProperties.tcp"
80
- :gateway-flag="gatewayFlag"
81
- @change-gateway-flag="onChangeGatewayFlag"
82
- @change-ip-four-settings="onChangeIpFourSettings"
83
- @hide-alert="onHideAlert"
84
- />
85
- <common-wizards-network-add-steps-connection-settings
86
- v-if="selectedStep.id === 5"
87
- :wizard="wizard"
88
- :connection-settings="connectionSettings"
89
- :messages-fields="selectedStep.fields"
90
- :alert-messages="alertMessages[5]"
91
- @change-connection-settings="onChangeConnectionSettings"
92
- @hide-alert="onHideAlert"
93
- />
94
- <!-- <common-wizards-network-add-steps-physical-adapter-->
95
- <!-- v-if="selectedStep.id === 6"-->
96
- <!-- />-->
97
- <common-wizards-network-add-steps-ready-complete
98
- v-if="selectedStep.id === 7"
99
- :ready-complete-fields="readyCompleteFields"
100
- />
101
- </template>
102
- </atoms-wizard>
103
- </template>
104
-
105
- <script setup lang="ts">
106
- import {
107
- UI_I_ArbitraryObject,
108
- UI_I_Localization,
109
- UI_I_ItemsWithTotalCounts,
110
- } from '~/lib/models/interfaces'
111
- import type { UI_T_Project } from '~/lib/models/types'
112
- import {
113
- UI_I_PortProperties,
114
- UI_I_IpFourSettings,
115
- UI_I_ConnectionSettings,
116
- UI_I_TargetDevice,
117
- UI_I_Switch,
118
- UI_I_ReadyCompleteFields,
119
- UI_I_AddNetworkingSecondOrThirdSchemeDataSend,
120
- UI_I_AddNetworkingZeroOrFirstSchemeDataSend,
121
- UI_I_AddNetworkingFourthOrFifthSchemeDataSend,
122
- UI_I_AddNetworkingEmits,
123
- UI_I_TCPStack,
124
- } from '~/components/common/wizards/network/add/lib/models/interfaces'
125
- import {
126
- UI_I_Adapter,
127
- UI_I_AdapterStatus,
128
- UI_I_SwitchAdapterItem,
129
- UI_I_DiagramData,
130
- API_UI_I_SwitchItem,
131
- UI_I_AvailableAdapters,
132
- } from '~/components/common/diagramMain/lib/models/interfaces'
133
- import { getAvailableAdapters } from '~/components/common/diagramMain/lib/utils/utils'
134
- import {
135
- UI_I_ValidationReturn,
136
- UI_I_WizardStep,
137
- UI_I_WizardStepNavigation,
138
- } from '~/components/atoms/wizard/lib/models/interfaces'
139
- import { UI_E_ValidationFields } from '~/components/common/wizards/network/add/lib/models/enums'
140
- import { getVlanId } from '~/components/common/wizards/network/add/lib/utils/utils'
141
- import Wizard from '~/components/atoms/wizard/lib/utils/utils'
142
- import {
143
- createZeroSchemeReadyCompleteFunc,
144
- createFirstSchemeReadyCompleteFunc,
145
- createSecondSchemeReadyCompleteFunc,
146
- createThirdSchemeReadyCompleteFunc,
147
- createFourthSchemeReadyCompleteFunc,
148
- stepsSchemeInitial,
149
- stepsFunc,
150
- connectionSettingsInitial,
151
- portPropertiesInitial,
152
- ipFourSettingsInitial,
153
- targetDeviceInitial,
154
- addNetworkingZeroOrFirstSchemeDataFunc,
155
- addNetworkingSecondOrThirdSchemeDataFunc,
156
- addNetworkingFourthOrFifthSchemeDataFunc,
157
- } from '~/components/common/wizards/network/add/lib/config/config'
158
- import {
159
- checkTargetDeviceSync,
160
- checkAdaptersSync,
161
- checkPortPropertiesSync,
162
- checkIpFourSettingsSync,
163
- checkConnectionSettingsSync,
164
- checkNetworkAsync,
165
- } from '~/components/common/wizards/network/add/validations/validations'
166
-
167
- const props = withDefaults(
168
- defineProps<{
169
- show: boolean
170
- adapters: UI_I_ItemsWithTotalCounts<UI_I_SwitchAdapterItem>
171
- standardSwitchesInitial?: UI_I_Switch[]
172
- freeAdapters?: UI_I_Adapter[]
173
- project?: UI_T_Project
174
- isDarkMode?: boolean
175
- selectedStandardSwitchId?: string
176
- selectedSwitchId?: string
177
- tcpStacks?: UI_I_TCPStack[]
178
- diagramsData?: UI_I_DiagramData[]
179
- isNetworkingLoading?: boolean
180
- }>(),
181
- {
182
- standardSwitchesInitial: () => [],
183
- freeAdapters: () => [],
184
- project: 'procurator',
185
- isDarkMode: false,
186
- selectedStandardSwitchId: '',
187
- selectedSwitchId: '',
188
- tcpStacks: () => [],
189
- diagramsData: [],
190
- isNetworkingLoading: false,
191
- }
192
- )
193
-
194
- const emits = defineEmits<UI_I_AddNetworkingEmits>()
195
-
196
- const localization = computed<UI_I_Localization>(() => useLocal())
197
-
198
- const hostname = ref<string>('')
199
- const title = computed<string>(
200
- () => `${hostname.value} - ${localization.value.common.addNetworking}`
201
- )
202
-
203
- const wizard: Wizard = new Wizard(
204
- stepsFunc(localization.value),
205
- stepsSchemeInitial
206
- )
207
-
208
- const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
209
- const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
210
-
211
- const readyCompleteFields = ref<UI_I_ReadyCompleteFields[]>([])
212
-
213
- // Step's content data (connectionType)
214
- const connectionType = ref<string>('0')
215
-
216
- const connectionTypeLocal = computed<string>({
217
- get() {
218
- return connectionType.value
219
- },
220
- set(newValue: string) {
221
- wizard.resetAfterSelected()
222
- connectionType.value = newValue
223
- targetDevice.value.standardSwitch = props.selectedStandardSwitchId
224
- targetDevice.value.switch = props.selectedSwitchId
225
- },
226
- })
227
-
228
- // Step's content data (createStandardSwitch)
229
- const addedAdapters = ref<string[]>([])
230
- const coreAdapters = ref<string[]>([])
231
-
232
- const onChangeAddedAdapters = (addedAdaptersNew: string[]): void => {
233
- addedAdapters.value = addedAdaptersNew
234
- }
235
-
236
- const adapterStatus = ref<UI_I_AdapterStatus>({
237
- active: [],
238
- standby: [],
239
- unused: [],
240
- })
241
- const onChangeAdapterStatus = (adapterStatusNew: UI_I_AdapterStatus): void => {
242
- adapterStatus.value = adapterStatusNew
243
- }
244
-
245
- // Step's content data and changers (targetDevice)
246
- const targetDevice = ref<UI_I_TargetDevice>(useDeepCopy(targetDeviceInitial))
247
- const mtuFromSwitch = ref<number>(1500)
248
-
249
- const onChangeTargetDevice = (newTargetDevice: UI_I_TargetDevice): void => {
250
- const oldTargetDeviceSelected = useDeepCopy(targetDevice.value).selected
251
- const newTargetDeviceSelected = newTargetDevice.selected
252
-
253
- if (oldTargetDeviceSelected !== newTargetDeviceSelected) {
254
- wizard.resetAfterSelected()
255
- }
256
-
257
- const selectedSwitch = props.standardSwitchesInitial.find(
258
- (currentSwitch: UI_I_Switch) =>
259
- newTargetDevice.standardSwitch === currentSwitch.name
260
- )
261
-
262
- if (newTargetDeviceSelected === '1' && selectedSwitch) {
263
- mtuFromSwitch.value = selectedSwitch?.mtu || 1500
264
- }
265
- if (newTargetDeviceSelected === '3') {
266
- mtuFromSwitch.value = newTargetDevice.mtu || 1500
267
- }
268
-
269
- targetDevice.value = useDeepCopy(newTargetDevice)
270
- }
271
-
272
- // Step's content data and changers (portProperties)
273
- const portProperties = ref<UI_I_PortProperties>(
274
- useDeepCopy(portPropertiesInitial)
275
- )
276
- const onChangePortProperties = (newFields: UI_I_PortProperties): void => {
277
- if (portProperties.value.tcp !== newFields.tcp) {
278
- ipFourSettings.value.static.defaultGateway.value =
279
- props.tcpStacks?.find((tcp: UI_I_TCPStack) => tcp.id === newFields.tcp)
280
- .gateway || ''
281
- }
282
- portProperties.value = newFields
283
- }
284
-
285
- // Step's content data and changers (ipFourSettings)
286
- const ipFourSettings = ref<UI_I_IpFourSettings>(ipFourSettingsInitial)
287
- const onChangeIpFourSettings = (newFields: UI_I_IpFourSettings): void => {
288
- ipFourSettings.value = newFields
289
- }
290
-
291
- const gatewayFlag = ref<boolean>(false)
292
- const onChangeGatewayFlag = (newValue: boolean) => {
293
- gatewayFlag.value = newValue
294
- }
295
-
296
- // Step's content data and changers (connectionSettings)
297
- const connectionSettings = ref<UI_I_ConnectionSettings>(
298
- connectionSettingsInitial
299
- )
300
- const onChangeConnectionSettings = (
301
- newFields: UI_I_ConnectionSettings
302
- ): void => {
303
- connectionSettings.value = newFields
304
- }
305
-
306
- const onHideAlert = (stepId: number): void => {
307
- wizard.hideAlertMessagesByStepId(stepId)
308
- }
309
-
310
- let flagSwitch = ''
311
-
312
- // Choosing Scheme
313
- watch(
314
- [connectionTypeLocal, targetDevice],
315
- (
316
- newValues: [string, UI_I_TargetDevice],
317
- oldValues: [string, UI_I_TargetDevice]
318
- ) => {
319
- const newCT = newValues[0] // -> newConnectionType
320
- const oldCT = oldValues[0] // -> oldConnectionType
321
- const newTD = newValues[1] // -> newTargetDevice
322
- const oldTD = oldValues[1] // -> oldTargetDevice
323
- if (!oldTD || oldTD.selected !== newTD.selected) {
324
- flagSwitch = ''
325
- addedAdapters.value = []
326
- adapterStatus.value = {
327
- active: [],
328
- standby: [],
329
- unused: [],
330
- }
331
- }
332
- if (newCT !== oldCT) {
333
- newCT === '0' && props.selectedStandardSwitchId
334
- ? (targetDevice.value.selected = '1')
335
- : (targetDevice.value.selected = '0')
336
- newCT === '1' && (targetDevice.value.selected = '1')
337
- newCT === '2' && (targetDevice.value.selected = '2')
338
- }
339
- if (newCT === '0') {
340
- ;(newTD.selected === '0' || newTD.selected === '1') &&
341
- wizard.changeScheme(0)
342
- newTD.selected === '3' && wizard.changeScheme(1)
343
- }
344
- if (newCT === '1') {
345
- newTD.selected === '1' && wizard.changeScheme(2)
346
- newTD.selected === '3' && wizard.changeScheme(3)
347
- }
348
- if (newCT === '2') {
349
- newTD.selected === '2' && wizard.changeScheme(4)
350
- newTD.selected === '3' && wizard.changeScheme(5)
351
- }
352
- },
353
- { deep: true, immediate: true }
354
- )
355
-
356
- const onGetExistingStandardSwitches = (): void => {
357
- emits('get-existing-standard-switches')
358
- }
359
-
360
- const onGetTcpStacks = (): void => {
361
- emits('get-tcp-stacks')
362
- }
363
-
364
- watch(
365
- () => wizard.selectedStepId,
366
- (newSelectedStep: number) => {
367
- if (newSelectedStep === 1) {
368
- onGetExistingStandardSwitches()
369
- }
370
- if (newSelectedStep === 3) {
371
- onGetTcpStacks()
372
- }
373
- if (newSelectedStep === 6 && flagSwitch !== targetDevice.value.switch) {
374
- const nics: UI_I_AdapterStatus = props.standardSwitchesInitial.find(
375
- (currentSwitch: UI_I_Switch) =>
376
- currentSwitch.id === targetDevice.value.switch
377
- ).nics
378
-
379
- const availableAdapters: UI_I_AvailableAdapters = getAvailableAdapters(
380
- props.adapters,
381
- nics
382
- )
383
-
384
- adapterStatus.value = {
385
- active: availableAdapters.activeAdapters || [],
386
- standby: availableAdapters.standbyAdapters || [],
387
- unused: availableAdapters.unusedAdapters || [],
388
- }
389
- coreAdapters.value = [
390
- ...adapterStatus.value.active,
391
- ...adapterStatus.value.standby,
392
- ...adapterStatus.value.unused,
393
- ]
394
- flagSwitch = targetDevice.value.switch
395
- }
396
-
397
- if (newSelectedStep !== 7) return // If last step
398
- if (wizard.isSelectedScheme(0)) {
399
- readyCompleteFields.value = createZeroSchemeReadyCompleteFunc(
400
- targetDevice.value,
401
- portProperties.value,
402
- ipFourSettings.value,
403
- localization.value
404
- )
405
- return
406
- }
407
-
408
- if (wizard.isSelectedScheme(1)) {
409
- readyCompleteFields.value = createFirstSchemeReadyCompleteFunc(
410
- targetDevice.value,
411
- portProperties.value,
412
- ipFourSettings.value,
413
- addedAdapters.value,
414
- localization.value
415
- )
416
- return
417
- }
418
- if (wizard.isSelectedScheme(2)) {
419
- readyCompleteFields.value = createSecondSchemeReadyCompleteFunc(
420
- connectionSettings.value,
421
- targetDevice.value,
422
- localization.value
423
- )
424
- return
425
- }
426
- if (wizard.isSelectedScheme(3)) {
427
- readyCompleteFields.value = createThirdSchemeReadyCompleteFunc(
428
- connectionSettings.value,
429
- targetDevice.value,
430
- addedAdapters.value,
431
- localization.value
432
- )
433
- return
434
- }
435
- if (wizard.isSelectedScheme(4)) {
436
- readyCompleteFields.value = createFourthSchemeReadyCompleteFunc(
437
- targetDevice.value.switch,
438
- props.diagramsData,
439
- adapterStatus.value,
440
- localization.value
441
- )
442
- }
443
- }
444
- )
445
-
446
- // Reset data
447
- const reset = (): void => {
448
- wizard.reset()
449
- connectionTypeLocal.value = '0'
450
- targetDevice.value = useDeepCopy(targetDeviceInitial)
451
- connectionSettings.value = useDeepCopy(connectionSettingsInitial)
452
- portProperties.value = useDeepCopy(portPropertiesInitial)
453
- ipFourSettings.value = useDeepCopy(ipFourSettingsInitial)
454
- coreAdapters.value = []
455
- addedAdapters.value = []
456
- adapterStatus.value = {
457
- active: [],
458
- standby: [],
459
- unused: [],
460
- }
461
- }
462
-
463
- const isShowNoConnectedActiveAdaptersModal = ref(false)
464
- const isShowNoActiveAdaptersModal = ref(false)
465
-
466
- const showNoConnectedActiveAdaptersModal = (): void => {
467
- isShowNoConnectedActiveAdaptersModal.value = true
468
- }
469
- const onHideNoConnectedActiveAdaptersModal = (): void => {
470
- isShowNoConnectedActiveAdaptersModal.value = false
471
- }
472
- const showNoActiveAdaptersModal = (): void => {
473
- isShowNoActiveAdaptersModal.value = true
474
- }
475
- const onHideNoActiveAdaptersModal = (): void => {
476
- isShowNoActiveAdaptersModal.value = false
477
- }
478
-
479
- const onConfirmNoActiveAdaptersModal = (): void => {
480
- onHideNoConnectedActiveAdaptersModal()
481
- onHideNoActiveAdaptersModal()
482
- if (wizard.waitingStepId === 7) {
483
- wizard.changeSteps(
484
- wizard.selectedStepData(
485
- wizard.stepsInSelectedSchemeWithStatus.value.find(
486
- (step: UI_I_WizardStepNavigation) => step.id === 7
487
- )
488
- ),
489
- validationFunc,
490
- finalValidationFunc,
491
- true
492
- )
493
- wizard.waitingStepId = -1
494
- return
495
- }
496
- wizard.selectStepHard(wizard.waitingStepId)
497
- }
498
-
499
- const onGetFreeAdapters = (showModal: () => void): void => {
500
- emits('get-free-adapters', showModal)
501
- }
502
-
503
- const checkFinal = async (): Promise<UI_I_ArbitraryObject<string>> => {
504
- let data:
505
- | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
506
- | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
507
- | UI_I_AddNetworkingFourthOrFifthSchemeDataSend
508
- | API_UI_I_SwitchItem
509
- | null = null
510
-
511
- let type: 'network' | 'vmkernel' | 'adapter'
512
-
513
- if (wizard.isSelectedScheme(0) || wizard.isSelectedScheme(1)) {
514
- const vlan = getVlanId(portProperties.value.vlanId)
515
-
516
- data = addNetworkingZeroOrFirstSchemeDataFunc(
517
- targetDevice.value,
518
- Number(vlan),
519
- portProperties.value,
520
- ipFourSettings.value,
521
- wizard.isSelectedScheme(1),
522
- adapterStatus.value
523
- )
524
-
525
- type = 'vmkernel'
526
- }
527
-
528
- if (wizard.isSelectedScheme(2) || wizard.isSelectedScheme(3)) {
529
- const vlan = getVlanId(connectionSettings.value.vlanId)
530
-
531
- data = addNetworkingSecondOrThirdSchemeDataFunc(
532
- connectionSettings.value,
533
- targetDevice.value,
534
- Number(vlan),
535
- wizard.isSelectedScheme(2),
536
- adapterStatus.value
537
- )
538
-
539
- type = 'network'
540
- }
541
-
542
- if (wizard.isSelectedScheme(4) || wizard.isSelectedScheme(5)) {
543
- data = addNetworkingFourthOrFifthSchemeDataFunc(
544
- targetDevice.value.switch,
545
- wizard.isSelectedScheme(4),
546
- adapterStatus.value,
547
- props.diagramsData,
548
- targetDevice.value.mtu
549
- )
550
-
551
- type = 'adapter'
552
- }
553
-
554
- return new Promise((resolve, _reject) =>
555
- emits(
556
- 'add-networking-data-validate',
557
- data,
558
- type,
559
- (err_arg: UI_I_ArbitraryObject<string>): void => {
560
- resolve(err_arg)
561
- }
562
- )
563
- )
564
- }
565
-
566
- const finalValidationFunc = async (
567
- value: UI_I_WizardStep[]
568
- ): Promise<UI_I_ValidationReturn> => {
569
- let stepHasError = false
570
-
571
- const validationFields: {
572
- [key: string]: string
573
- } = await checkFinal()
574
-
575
- for (const fieldName in validationFields) {
576
- const stepId = wizard.getStepIdByFieldName(fieldName)
577
-
578
- if (stepId !== -1) {
579
- stepHasError = wizard.setValidation(stepId, fieldName, {
580
- fieldMessage: validationFields[fieldName],
581
- alertMessage: validationFields[fieldName],
582
- })
583
- }
584
- }
585
-
586
- return {
587
- stepHasError,
588
- newValue: value,
589
- }
590
- }
591
-
592
- const validationFunc = async (
593
- value: UI_I_WizardStep[],
594
- currentStep: UI_I_WizardStep,
595
- nextStep: UI_I_WizardStep
596
- ): Promise<UI_I_ValidationReturn> => {
597
- let stepHasError = false
598
- let stepShouldStop = {
599
- ifOnCurrentStep: false,
600
- ifFromAnyStep: false,
601
- stoppageStepId: -1,
602
- }
603
-
604
- if (wizard.isValidateForStep(1, currentStep.id, nextStep.id)) {
605
- const targetDeviceValidation = checkTargetDeviceSync(
606
- localization.value,
607
- targetDevice.value,
608
- wizard,
609
- value
610
- )
611
-
612
- value = targetDeviceValidation.newValue
613
-
614
- stepHasError = stepHasError || targetDeviceValidation.stepHasError
615
- }
616
-
617
- if (wizard.isValidateForStep(2, currentStep.id, nextStep.id)) {
618
- wizard.waitingStepId = nextStep.id
619
-
620
- const adapterValidation = checkAdaptersSync(
621
- localization.value,
622
- adapterStatus.value,
623
- value,
624
- currentStep.id,
625
- nextStep.id,
626
- props.freeAdapters,
627
- showNoActiveAdaptersModal,
628
- showNoConnectedActiveAdaptersModal,
629
- 2
630
- )
631
-
632
- value = adapterValidation.newValue
633
-
634
- stepShouldStop = adapterValidation.stepShouldStop || stepShouldStop
635
-
636
- stepHasError = stepHasError || adapterValidation.stepHasError
637
- }
638
-
639
- if (wizard.isValidateForStep(3, currentStep.id, nextStep.id)) {
640
- const labelValidation = await checkNetworkAsync(
641
- value,
642
- portProperties.value.networkLabel,
643
- 3,
644
- UI_E_ValidationFields.PORT_PROPERTIES_NETWORK,
645
- emits,
646
- localization.value,
647
- wizard
648
- )
649
-
650
- value = labelValidation.newValue
651
-
652
- const portPropertiesValidation = checkPortPropertiesSync(
653
- localization.value,
654
- portProperties.value,
655
- wizard,
656
- value
657
- )
658
-
659
- value = portPropertiesValidation.newValue
660
-
661
- stepHasError =
662
- stepHasError ||
663
- labelValidation.stepHasError ||
664
- portPropertiesValidation.stepHasError
665
- }
666
-
667
- if (wizard.isValidateForStep(4, currentStep.id, nextStep.id)) {
668
- const ipValidation = checkIpFourSettingsSync(
669
- localization.value,
670
- ipFourSettings.value,
671
- wizard,
672
- value
673
- )
674
-
675
- value = ipValidation.newValue
676
-
677
- stepHasError = stepHasError || ipValidation.stepHasError
678
- }
679
-
680
- if (wizard.isValidateForStep(5, currentStep.id, nextStep.id)) {
681
- const labelValidation = await checkNetworkAsync(
682
- value,
683
- connectionSettings.value.networkLabel,
684
- 5,
685
- UI_E_ValidationFields.CONNECTION_SETTINGS_NETWORK,
686
- emits,
687
- localization.value,
688
- wizard
689
- )
690
-
691
- value = labelValidation.newValue
692
-
693
- const connectionSettingsValidation = checkConnectionSettingsSync(
694
- localization.value,
695
- connectionSettings.value,
696
- wizard,
697
- value
698
- )
699
-
700
- value = connectionSettingsValidation.newValue
701
-
702
- stepHasError =
703
- stepHasError ||
704
- labelValidation.stepHasError ||
705
- connectionSettingsValidation.stepHasError
706
- }
707
-
708
- if (wizard.isValidateForStep(6, currentStep.id, nextStep.id)) {
709
- wizard.waitingStepId = nextStep.id
710
-
711
- const adapterValidation = checkAdaptersSync(
712
- localization.value,
713
- adapterStatus.value,
714
- value,
715
- currentStep.id,
716
- nextStep.id,
717
- props.adapters.items,
718
- showNoActiveAdaptersModal,
719
- showNoConnectedActiveAdaptersModal,
720
- 6
721
- )
722
-
723
- value = adapterValidation.newValue
724
-
725
- stepShouldStop = adapterValidation.stepShouldStop || stepShouldStop
726
-
727
- stepHasError = stepHasError || adapterValidation.stepHasError
728
- }
729
-
730
- return {
731
- newValue: value,
732
- stepHasError,
733
- stepShouldStop,
734
- }
735
- }
736
-
737
- const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> =>
738
- wizard.changeSteps(value, validationFunc, finalValidationFunc)
739
-
740
- const onHideAddNetworkingModal = (): void => {
741
- emits('hide')
742
- reset()
743
- }
744
-
745
- const onSubmit = async (): Promise<void> => {
746
- let data:
747
- | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
748
- | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
749
- | UI_I_AddNetworkingFourthOrFifthSchemeDataSend
750
- | API_UI_I_SwitchItem
751
- | null = null
752
-
753
- let type: 'network' | 'vmkernel' | 'adapter' = 'network'
754
-
755
- if (wizard.isSelectedScheme(0) || wizard.isSelectedScheme(1)) {
756
- const vlan = getVlanId(portProperties.value.vlanId)
757
- type = 'vmkernel'
758
- data = addNetworkingZeroOrFirstSchemeDataFunc(
759
- targetDevice.value,
760
- Number(vlan),
761
- portProperties.value,
762
- ipFourSettings.value,
763
- wizard.isSelectedScheme(1),
764
- adapterStatus.value
765
- )
766
- }
767
-
768
- if (wizard.isSelectedScheme(2) || wizard.isSelectedScheme(3)) {
769
- const vlan = getVlanId(connectionSettings.value.vlanId)
770
- type = 'network'
771
- data = addNetworkingSecondOrThirdSchemeDataFunc(
772
- connectionSettings.value,
773
- targetDevice.value,
774
- Number(vlan),
775
- wizard.isSelectedScheme(2),
776
- adapterStatus.value
777
- )
778
- }
779
-
780
- if (wizard.isSelectedScheme(4) || wizard.isSelectedScheme(5)) {
781
- type = 'adapter'
782
- data = addNetworkingFourthOrFifthSchemeDataFunc(
783
- targetDevice.value.switch,
784
- wizard.isSelectedScheme(4),
785
- adapterStatus.value,
786
- props.diagramsData,
787
- targetDevice.value.mtu
788
- )
789
- }
790
-
791
- data &&
792
- emits('send-add-networking-data', data, type, onHideAddNetworkingModal)
793
- }
794
-
795
- onMounted(() => {
796
- hostname.value = location.hostname
797
- })
798
-
799
- watch(
800
- () => props.isNetworkingLoading,
801
- (newValue: boolean) => {
802
- wizard.setLoader(newValue)
803
- },
804
- {
805
- immediate: true,
806
- }
807
- )
808
-
809
- watch(
810
- props.tcpStacks,
811
- (newValue: UI_I_TCPStack[]) => {
812
- portProperties.value.tcp = newValue?.[0]?.id || ''
813
- ipFourSettings.value.static.defaultGateway.value =
814
- newValue?.[0]?.gateway || ''
815
- },
816
- { deep: true }
817
- )
818
- </script>
819
-
820
- <style scoped lang="scss">
821
- :deep(.modal) {
822
- & > .modal-dialog > .modal-content > .modal-body {
823
- height: calc(100% - 110px);
824
- .disabled-on-time {
825
- opacity: 0.4;
826
- pointer-events: none;
827
- }
828
- }
829
- }
830
- :deep(.disabled-on-time) {
831
- opacity: 0.4;
832
- pointer-events: none;
833
- }
834
- :deep(.wizard-content-container.add-networking-step) {
835
- padding: 0px 15px 10px 10px;
836
-
837
- .danger-not-valid {
838
- border: 2px solid red;
839
- border-bottom: 1px solid #db2100;
840
- }
841
- .tooltip-field {
842
- margin-right: 12px;
843
- }
844
-
845
- .horizontal-flex-container {
846
- margin-bottom: 5px;
847
- min-height: 36px;
848
- display: flex;
849
- flex-direction: row;
850
- }
851
- .property-label-group {
852
- width: 140px;
853
- }
854
- .disabled {
855
- opacity: 0.4;
856
- pointer-events: none;
857
- }
858
- .wizard-content-port {
859
- .margin-left-property-value-group {
860
- margin-left: 10px;
861
- }
862
-
863
- .property-value-group {
864
- padding-left: 23px;
865
- }
866
- .horizontal-flex-container {
867
- min-height: 24px;
868
- margin-bottom: 0;
869
- }
870
- .radio {
871
- min-height: 39px;
872
- margin: 10px 0;
873
- }
874
- .form-block {
875
- margin: 12px 0 24px 0;
876
- padding-left: 23px;
877
-
878
- &.form-block-ipv {
879
- input[type='text'] {
880
- width: 143px;
881
- }
882
- .horizontal-flex-container > label {
883
- margin-right: 50px;
884
- }
885
- }
886
- }
887
- .edit-vmkernel-adapter-section {
888
- padding-top: 12px;
889
-
890
- label {
891
- input[type='checkbox'] {
892
- margin-right: 4px;
893
- transform: translateY(1px);
894
- }
895
- }
896
- .horizontal-flex-container {
897
- margin-bottom: 5px;
898
- }
899
- }
900
- .port-properties-network-label {
901
- width: 280px;
902
- }
903
- .port-properties-padding {
904
- padding-top: 8px;
905
- }
906
- .port-properties-mtu-selector {
907
- margin-right: 12px;
908
- }
909
- .port-properties-mtu-container {
910
- display: flex;
911
- }
912
- select {
913
- height: 24px;
914
- }
915
- }
916
- .nw-property-value-group {
917
- display: inline;
918
- }
919
- }
920
-
921
- :deep(.modal-body-content.modal-body-content__confirmation) {
922
- display: flex;
923
- .confirm-icon-container {
924
- margin-right: 20px;
925
- }
926
- .preserve-newlines {
927
- white-space: pre-line;
928
- font-size: 15px;
929
- }
930
- }
931
-
932
- .add-networking-wizard.is-dark {
933
- :deep(.wizard-content-container.add-networking-step) {
934
- .ready-complete-container {
935
- background-color: var(--pannel-bg-color);
936
- margin-top: 12px;
937
-
938
- span {
939
- color: var(--description-color);
940
- }
941
- }
942
-
943
- .add-networking-radio-button-description {
944
- color: var(--description-color);
945
- }
946
-
947
- .property-label-group {
948
- color: var(--main-color-mode2);
949
- }
950
- .flex-property-label-group {
951
- color: var(--main-color-mode2);
952
- }
953
- .flex-property-value-group {
954
- select {
955
- color: #fff;
956
- }
957
- }
958
- .failover-order-master {
959
- .secondary-title label {
960
- color: #fff;
961
- }
962
- }
963
- .k-grid-content {
964
- background-color: var(--modal-bg-color);
965
- }
966
- .vui-action-bar {
967
- background-color: var(--pannel-bg-color);
968
- color: var(--title-color);
969
- padding: 8px 0 3px;
970
-
971
- .action-link-container:not(.disabled) {
972
- &:hover {
973
- background-color: #29414e;
974
- border: 1px solid #c7e9ff;
975
- }
976
- }
977
-
978
- svg {
979
- fill: #fff;
980
- }
981
- }
982
-
983
- .k-grid.k-widget .k-grid-content {
984
- border-left: 1px solid #485764;
985
- border-right: 1px solid #485764;
986
- border-top: 1px solid #ddd;
987
- border-bottom: 1px solid #ddd;
988
-
989
- tbody tr {
990
- background-color: var(--modal-bg-color);
991
-
992
- td {
993
- border-bottom: 1px solid #666666;
994
- border-color: #666666;
995
- }
996
-
997
- &:hover {
998
- background-color: #324f61;
999
- color: var(--title-color);
1000
-
1001
- td {
1002
- border-bottom: 1px solid #ffffff;
1003
- }
1004
- }
1005
-
1006
- &.k-state-selected {
1007
- background-color: #d8e3e9;
1008
- box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
1009
-
1010
- td span {
1011
- color: #000;
1012
- }
1013
- }
1014
- }
1015
- }
1016
-
1017
- .failover-order-details {
1018
- &.relative-container .absolute-container {
1019
- background-color: var(--pannel-bg-color);
1020
- color: var(--main-color-mode2);
1021
-
1022
- &:has(.no-items-selected-container) {
1023
- background-color: transparent;
1024
- }
1025
- }
1026
-
1027
- td span {
1028
- color: var(--main-color-mode2);
1029
- }
1030
- button span {
1031
- color: var(--main-color-mode2);
1032
-
1033
- &:hover:not(.disabled) {
1034
- background-color: transparent;
1035
- }
1036
- }
1037
- button.active span {
1038
- color: #fff;
1039
- }
1040
- }
1041
- }
1042
-
1043
- .select-adapter-info span {
1044
- color: var(--main-color-mode2);
1045
- }
1046
- }
1047
- </style>
1
+ <template>
2
+ <atoms-wizard
3
+ v-model:show="props.show"
4
+ :wizard="wizard"
5
+ :selected-scheme="selectedScheme"
6
+ :title="title"
7
+ max-height="551px"
8
+ :localization="localization"
9
+ :class="[
10
+ 'add-networking-wizard',
11
+ {
12
+ 'is-dark': props.isDarkMode,
13
+ },
14
+ ]"
15
+ test-id="add-networking-wizard"
16
+ @change-steps="onChangeSteps"
17
+ @hide="onHideAddNetworkingModal"
18
+ @submit="onSubmit"
19
+ >
20
+ <template #modalBody="{ selectedStep }">
21
+ <common-wizards-network-add-steps-select-connection-type
22
+ v-if="selectedStep.id === 0"
23
+ v-model="connectionTypeLocal"
24
+ />
25
+ <common-wizards-network-add-steps-selected-target-device
26
+ v-if="selectedStep.id === 1"
27
+ :wizard="wizard"
28
+ :target-device="targetDevice"
29
+ :connection-type="connectionTypeLocal"
30
+ :standard-switches-initial="props.standardSwitchesInitial"
31
+ :messages-fields="selectedStep.fields"
32
+ :alert-messages="alertMessages[1]"
33
+ :selected-standard-switch-id="props.selectedStandardSwitchId"
34
+ :selected-switch-id="props.selectedSwitchId"
35
+ @hide-alert="onHideAlert"
36
+ @change-target-device="onChangeTargetDevice"
37
+ />
38
+ <common-wizards-network-add-steps-create-standard-switch
39
+ v-if="selectedStep.id === 2 || selectedStep.id === 6"
40
+ :free-adapters="props.freeAdapters"
41
+ :added-adapters="addedAdapters"
42
+ :core-adapters="coreAdapters"
43
+ :adapter-status="adapterStatus"
44
+ :adapters="props.adapters"
45
+ :is-show-no-connected-active-adapters-modal="
46
+ isShowNoConnectedActiveAdaptersModal
47
+ "
48
+ :is-show-no-active-adapters-modal="isShowNoActiveAdaptersModal"
49
+ :is-dark-mode="props.isDarkMode"
50
+ @get-free-adapters="onGetFreeAdapters"
51
+ @change-added-adapters="onChangeAddedAdapters"
52
+ @change-adapter-status="onChangeAdapterStatus"
53
+ @confirm-no-active-adapters-modal="onConfirmNoActiveAdaptersModal"
54
+ @hide-no-connected-active-adapters-modal="
55
+ onHideNoConnectedActiveAdaptersModal
56
+ "
57
+ @hide-no-active-adapters-modal="onHideNoActiveAdaptersModal"
58
+ />
59
+ <common-wizards-network-add-steps-port-properties
60
+ v-if="selectedStep.id === 3"
61
+ :wizard="wizard"
62
+ :port-properties="portProperties"
63
+ :mtu-from-switch="mtuFromSwitch"
64
+ :project="props.project"
65
+ :messages-fields="selectedStep.fields"
66
+ :alert-messages="alertMessages[3]"
67
+ :tcp-stacks="props.tcpStacks"
68
+ @change-gateway-flag="onChangeGatewayFlag"
69
+ @change-port-properties="onChangePortProperties"
70
+ @hide-alert="onHideAlert"
71
+ />
72
+ <common-wizards-network-add-steps-ip-four-settings
73
+ v-if="selectedStep.id === 4"
74
+ :wizard="wizard"
75
+ :ip-four-settings="ipFourSettings"
76
+ :messages-fields="selectedStep.fields"
77
+ :alert-messages="alertMessages[4]"
78
+ :tcp-stacks="props.tcpStacks"
79
+ :tcp="portProperties.tcp"
80
+ :gateway-flag="gatewayFlag"
81
+ @change-gateway-flag="onChangeGatewayFlag"
82
+ @change-ip-four-settings="onChangeIpFourSettings"
83
+ @hide-alert="onHideAlert"
84
+ />
85
+ <common-wizards-network-add-steps-connection-settings
86
+ v-if="selectedStep.id === 5"
87
+ :wizard="wizard"
88
+ :connection-settings="connectionSettings"
89
+ :messages-fields="selectedStep.fields"
90
+ :alert-messages="alertMessages[5]"
91
+ @change-connection-settings="onChangeConnectionSettings"
92
+ @hide-alert="onHideAlert"
93
+ />
94
+ <!-- <common-wizards-network-add-steps-physical-adapter-->
95
+ <!-- v-if="selectedStep.id === 6"-->
96
+ <!-- />-->
97
+ <common-wizards-network-add-steps-ready-complete
98
+ v-if="selectedStep.id === 7"
99
+ :ready-complete-fields="readyCompleteFields"
100
+ />
101
+ </template>
102
+ </atoms-wizard>
103
+ </template>
104
+
105
+ <script setup lang="ts">
106
+ import {
107
+ UI_I_ArbitraryObject,
108
+ UI_I_Localization,
109
+ UI_I_ItemsWithTotalCounts,
110
+ } from '~/lib/models/interfaces'
111
+ import type { UI_T_Project } from '~/lib/models/types'
112
+ import {
113
+ UI_I_PortProperties,
114
+ UI_I_IpFourSettings,
115
+ UI_I_ConnectionSettings,
116
+ UI_I_TargetDevice,
117
+ UI_I_Switch,
118
+ UI_I_ReadyCompleteFields,
119
+ UI_I_AddNetworkingSecondOrThirdSchemeDataSend,
120
+ UI_I_AddNetworkingZeroOrFirstSchemeDataSend,
121
+ UI_I_AddNetworkingFourthOrFifthSchemeDataSend,
122
+ UI_I_AddNetworkingEmits,
123
+ UI_I_TCPStack,
124
+ } from '~/components/common/wizards/network/add/lib/models/interfaces'
125
+ import {
126
+ UI_I_Adapter,
127
+ UI_I_AdapterStatus,
128
+ UI_I_SwitchAdapterItem,
129
+ UI_I_DiagramData,
130
+ API_UI_I_SwitchItem,
131
+ UI_I_AvailableAdapters,
132
+ } from '~/components/common/diagramMain/lib/models/interfaces'
133
+ import { getAvailableAdapters } from '~/components/common/diagramMain/lib/utils/utils'
134
+ import {
135
+ UI_I_ValidationReturn,
136
+ UI_I_WizardStep,
137
+ UI_I_WizardStepNavigation,
138
+ } from '~/components/atoms/wizard/lib/models/interfaces'
139
+ import { UI_E_ValidationFields } from '~/components/common/wizards/network/add/lib/models/enums'
140
+ import { getVlanId } from '~/components/common/wizards/network/add/lib/utils/utils'
141
+ import Wizard from '~/components/atoms/wizard/lib/utils/utils'
142
+ import {
143
+ createZeroSchemeReadyCompleteFunc,
144
+ createFirstSchemeReadyCompleteFunc,
145
+ createSecondSchemeReadyCompleteFunc,
146
+ createThirdSchemeReadyCompleteFunc,
147
+ createFourthSchemeReadyCompleteFunc,
148
+ createFifthSchemeReadyCompleteFunc,
149
+ stepsSchemeInitial,
150
+ stepsFunc,
151
+ connectionSettingsInitial,
152
+ portPropertiesInitial,
153
+ ipFourSettingsInitial,
154
+ targetDeviceInitial,
155
+ addNetworkingZeroOrFirstSchemeDataFunc,
156
+ addNetworkingSecondOrThirdSchemeDataFunc,
157
+ addNetworkingFourthOrFifthSchemeDataFunc,
158
+ } from '~/components/common/wizards/network/add/lib/config/config'
159
+ import {
160
+ checkTargetDeviceSync,
161
+ checkAdaptersSync,
162
+ checkPortPropertiesSync,
163
+ checkIpFourSettingsSync,
164
+ checkConnectionSettingsSync,
165
+ checkNetworkAsync,
166
+ } from '~/components/common/wizards/network/add/validations/validations'
167
+
168
+ const props = withDefaults(
169
+ defineProps<{
170
+ show: boolean
171
+ adapters: UI_I_ItemsWithTotalCounts<UI_I_SwitchAdapterItem>
172
+ standardSwitchesInitial?: UI_I_Switch[]
173
+ freeAdapters?: UI_I_Adapter[]
174
+ project?: UI_T_Project
175
+ isDarkMode?: boolean
176
+ selectedStandardSwitchId?: string
177
+ selectedSwitchId?: string
178
+ tcpStacks?: UI_I_TCPStack[]
179
+ diagramsData?: UI_I_DiagramData[]
180
+ isNetworkingLoading?: boolean
181
+ }>(),
182
+ {
183
+ standardSwitchesInitial: () => [],
184
+ freeAdapters: () => [],
185
+ project: 'procurator',
186
+ isDarkMode: false,
187
+ selectedStandardSwitchId: '',
188
+ selectedSwitchId: '',
189
+ tcpStacks: () => [],
190
+ diagramsData: [],
191
+ isNetworkingLoading: false,
192
+ }
193
+ )
194
+
195
+ const emits = defineEmits<UI_I_AddNetworkingEmits>()
196
+
197
+ const localization = computed<UI_I_Localization>(() => useLocal())
198
+
199
+ const hostname = ref<string>('')
200
+ const title = computed<string>(
201
+ () => `${hostname.value} - ${localization.value.common.addNetworking}`
202
+ )
203
+
204
+ const wizard: Wizard = new Wizard(
205
+ stepsFunc(localization.value),
206
+ stepsSchemeInitial
207
+ )
208
+
209
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
210
+ const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
211
+
212
+ const readyCompleteFields = ref<UI_I_ReadyCompleteFields[]>([])
213
+
214
+ // Step's content data (connectionType)
215
+ const connectionType = ref<string>('0')
216
+
217
+ const connectionTypeLocal = computed<string>({
218
+ get() {
219
+ return connectionType.value
220
+ },
221
+ set(newValue: string) {
222
+ wizard.resetAfterSelected()
223
+ connectionType.value = newValue
224
+ targetDevice.value.standardSwitch = props.selectedStandardSwitchId
225
+ targetDevice.value.switch = props.selectedSwitchId
226
+ },
227
+ })
228
+
229
+ // Step's content data (createStandardSwitch)
230
+ const addedAdapters = ref<string[]>([])
231
+ const coreAdapters = ref<string[]>([])
232
+
233
+ const onChangeAddedAdapters = (addedAdaptersNew: string[]): void => {
234
+ addedAdapters.value = addedAdaptersNew
235
+ }
236
+
237
+ const adapterStatus = ref<UI_I_AdapterStatus>({
238
+ active: [],
239
+ standby: [],
240
+ unused: [],
241
+ })
242
+ const onChangeAdapterStatus = (adapterStatusNew: UI_I_AdapterStatus): void => {
243
+ adapterStatus.value = adapterStatusNew
244
+ }
245
+
246
+ // Step's content data and changers (targetDevice)
247
+ const targetDevice = ref<UI_I_TargetDevice>(useDeepCopy(targetDeviceInitial))
248
+ const mtuFromSwitch = ref<number>(1500)
249
+
250
+ const onChangeTargetDevice = (newTargetDevice: UI_I_TargetDevice): void => {
251
+ const oldTargetDeviceSelected = useDeepCopy(targetDevice.value).selected
252
+ const newTargetDeviceSelected = newTargetDevice.selected
253
+
254
+ if (oldTargetDeviceSelected !== newTargetDeviceSelected) {
255
+ wizard.resetAfterSelected()
256
+ }
257
+
258
+ const selectedSwitch = props.standardSwitchesInitial.find(
259
+ (currentSwitch: UI_I_Switch) =>
260
+ newTargetDevice.standardSwitch === currentSwitch.name
261
+ )
262
+
263
+ if (newTargetDeviceSelected === '1' && selectedSwitch) {
264
+ mtuFromSwitch.value = selectedSwitch?.mtu || 1500
265
+ }
266
+ if (newTargetDeviceSelected === '3') {
267
+ mtuFromSwitch.value = newTargetDevice.mtu || 1500
268
+ }
269
+
270
+ targetDevice.value = useDeepCopy(newTargetDevice)
271
+ }
272
+
273
+ // Step's content data and changers (portProperties)
274
+ const portProperties = ref<UI_I_PortProperties>(
275
+ useDeepCopy(portPropertiesInitial)
276
+ )
277
+ const onChangePortProperties = (newFields: UI_I_PortProperties): void => {
278
+ if (portProperties.value.tcp !== newFields.tcp) {
279
+ ipFourSettings.value.static.defaultGateway.value =
280
+ props.tcpStacks?.find((tcp: UI_I_TCPStack) => tcp.id === newFields.tcp)
281
+ .gateway || ''
282
+ }
283
+ portProperties.value = newFields
284
+ }
285
+
286
+ // Step's content data and changers (ipFourSettings)
287
+ const ipFourSettings = ref<UI_I_IpFourSettings>(ipFourSettingsInitial)
288
+ const onChangeIpFourSettings = (newFields: UI_I_IpFourSettings): void => {
289
+ ipFourSettings.value = newFields
290
+ }
291
+
292
+ const gatewayFlag = ref<boolean>(false)
293
+ const onChangeGatewayFlag = (newValue: boolean) => {
294
+ gatewayFlag.value = newValue
295
+ }
296
+
297
+ // Step's content data and changers (connectionSettings)
298
+ const connectionSettings = ref<UI_I_ConnectionSettings>(
299
+ connectionSettingsInitial
300
+ )
301
+ const onChangeConnectionSettings = (
302
+ newFields: UI_I_ConnectionSettings
303
+ ): void => {
304
+ connectionSettings.value = newFields
305
+ }
306
+
307
+ const onHideAlert = (stepId: number): void => {
308
+ wizard.hideAlertMessagesByStepId(stepId)
309
+ }
310
+
311
+ let flagSwitch = ''
312
+
313
+ // Choosing Scheme
314
+ watch(
315
+ [connectionTypeLocal, targetDevice],
316
+ (
317
+ newValues: [string, UI_I_TargetDevice],
318
+ oldValues: [string, UI_I_TargetDevice]
319
+ ) => {
320
+ const newCT = newValues[0] // -> newConnectionType
321
+ const oldCT = oldValues[0] // -> oldConnectionType
322
+ const newTD = newValues[1] // -> newTargetDevice
323
+ const oldTD = oldValues[1] // -> oldTargetDevice
324
+ if (!oldTD || oldTD.selected !== newTD.selected) {
325
+ flagSwitch = ''
326
+ addedAdapters.value = []
327
+ adapterStatus.value = {
328
+ active: [],
329
+ standby: [],
330
+ unused: [],
331
+ }
332
+ }
333
+ if (newCT !== oldCT) {
334
+ newCT === '0' && props.selectedStandardSwitchId
335
+ ? (targetDevice.value.selected = '1')
336
+ : (targetDevice.value.selected = '0')
337
+ newCT === '1' && (targetDevice.value.selected = '1')
338
+ newCT === '2' && (targetDevice.value.selected = '2')
339
+ }
340
+ if (newCT === '0') {
341
+ ;(newTD.selected === '0' || newTD.selected === '1') &&
342
+ wizard.changeScheme(0)
343
+ newTD.selected === '3' && wizard.changeScheme(1)
344
+ }
345
+ if (newCT === '1') {
346
+ newTD.selected === '1' && wizard.changeScheme(2)
347
+ newTD.selected === '3' && wizard.changeScheme(3)
348
+ }
349
+ if (newCT === '2') {
350
+ newTD.selected === '2' && wizard.changeScheme(4)
351
+ newTD.selected === '3' && wizard.changeScheme(5)
352
+ }
353
+ },
354
+ { deep: true, immediate: true }
355
+ )
356
+
357
+ const onGetExistingStandardSwitches = (): void => {
358
+ emits('get-existing-standard-switches')
359
+ }
360
+
361
+ const onGetTcpStacks = (): void => {
362
+ emits('get-tcp-stacks')
363
+ }
364
+
365
+ watch(
366
+ () => wizard.selectedStepId,
367
+ (newSelectedStep: number) => {
368
+ if (newSelectedStep === 1) {
369
+ onGetExistingStandardSwitches()
370
+ }
371
+ if (newSelectedStep === 3) {
372
+ onGetTcpStacks()
373
+ }
374
+ if (newSelectedStep === 6 && flagSwitch !== targetDevice.value.switch) {
375
+ const nics: UI_I_AdapterStatus = props.standardSwitchesInitial.find(
376
+ (currentSwitch: UI_I_Switch) =>
377
+ currentSwitch.id === targetDevice.value.switch
378
+ ).nics
379
+
380
+ const availableAdapters: UI_I_AvailableAdapters = getAvailableAdapters(
381
+ props.adapters,
382
+ nics
383
+ )
384
+
385
+ adapterStatus.value = {
386
+ active: availableAdapters.activeAdapters || [],
387
+ standby: availableAdapters.standbyAdapters || [],
388
+ unused: availableAdapters.unusedAdapters || [],
389
+ }
390
+ coreAdapters.value = [
391
+ ...adapterStatus.value.active,
392
+ ...adapterStatus.value.standby,
393
+ ...adapterStatus.value.unused,
394
+ ]
395
+ flagSwitch = targetDevice.value.switch
396
+ }
397
+
398
+ if (newSelectedStep !== 7) return // If last step
399
+ if (wizard.isSelectedScheme(0)) {
400
+ readyCompleteFields.value = createZeroSchemeReadyCompleteFunc(
401
+ targetDevice.value,
402
+ portProperties.value,
403
+ ipFourSettings.value,
404
+ localization.value
405
+ )
406
+ return
407
+ }
408
+
409
+ if (wizard.isSelectedScheme(1)) {
410
+ readyCompleteFields.value = createFirstSchemeReadyCompleteFunc(
411
+ targetDevice.value,
412
+ portProperties.value,
413
+ ipFourSettings.value,
414
+ addedAdapters.value,
415
+ localization.value
416
+ )
417
+ return
418
+ }
419
+ if (wizard.isSelectedScheme(2)) {
420
+ readyCompleteFields.value = createSecondSchemeReadyCompleteFunc(
421
+ connectionSettings.value,
422
+ targetDevice.value,
423
+ localization.value
424
+ )
425
+ return
426
+ }
427
+ if (wizard.isSelectedScheme(3)) {
428
+ readyCompleteFields.value = createThirdSchemeReadyCompleteFunc(
429
+ connectionSettings.value,
430
+ targetDevice.value,
431
+ addedAdapters.value,
432
+ localization.value
433
+ )
434
+ return
435
+ }
436
+ if (wizard.isSelectedScheme(4)) {
437
+ readyCompleteFields.value = createFourthSchemeReadyCompleteFunc(
438
+ targetDevice.value.switch,
439
+ props.diagramsData,
440
+ adapterStatus.value,
441
+ localization.value
442
+ )
443
+ return
444
+ }
445
+ if (wizard.isSelectedScheme(5)) {
446
+ readyCompleteFields.value = createFifthSchemeReadyCompleteFunc(
447
+ targetDevice.value,
448
+ adapterStatus.value,
449
+ localization.value
450
+ )
451
+ }
452
+ }
453
+ )
454
+
455
+ // Reset data
456
+ const reset = (): void => {
457
+ wizard.reset()
458
+ connectionTypeLocal.value = '0'
459
+ targetDevice.value = useDeepCopy(targetDeviceInitial)
460
+ connectionSettings.value = useDeepCopy(connectionSettingsInitial)
461
+ portProperties.value = useDeepCopy(portPropertiesInitial)
462
+ ipFourSettings.value = useDeepCopy(ipFourSettingsInitial)
463
+ coreAdapters.value = []
464
+ addedAdapters.value = []
465
+ adapterStatus.value = {
466
+ active: [],
467
+ standby: [],
468
+ unused: [],
469
+ }
470
+ }
471
+
472
+ const isShowNoConnectedActiveAdaptersModal = ref(false)
473
+ const isShowNoActiveAdaptersModal = ref(false)
474
+
475
+ const showNoConnectedActiveAdaptersModal = (): void => {
476
+ isShowNoConnectedActiveAdaptersModal.value = true
477
+ }
478
+ const onHideNoConnectedActiveAdaptersModal = (): void => {
479
+ isShowNoConnectedActiveAdaptersModal.value = false
480
+ }
481
+ const showNoActiveAdaptersModal = (): void => {
482
+ isShowNoActiveAdaptersModal.value = true
483
+ }
484
+ const onHideNoActiveAdaptersModal = (): void => {
485
+ isShowNoActiveAdaptersModal.value = false
486
+ }
487
+
488
+ const onConfirmNoActiveAdaptersModal = (): void => {
489
+ onHideNoConnectedActiveAdaptersModal()
490
+ onHideNoActiveAdaptersModal()
491
+ if (wizard.waitingStepId === 7) {
492
+ wizard.changeSteps(
493
+ wizard.selectedStepData(
494
+ wizard.stepsInSelectedSchemeWithStatus.value.find(
495
+ (step: UI_I_WizardStepNavigation) => step.id === 7
496
+ )
497
+ ),
498
+ validationFunc,
499
+ finalValidationFunc,
500
+ true
501
+ )
502
+ wizard.waitingStepId = -1
503
+ return
504
+ }
505
+ wizard.selectStepHard(wizard.waitingStepId)
506
+ }
507
+
508
+ const onGetFreeAdapters = (showModal: () => void): void => {
509
+ emits('get-free-adapters', showModal)
510
+ }
511
+
512
+ const checkFinal = async (): Promise<UI_I_ArbitraryObject<string>> => {
513
+ let data:
514
+ | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
515
+ | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
516
+ | UI_I_AddNetworkingFourthOrFifthSchemeDataSend
517
+ | API_UI_I_SwitchItem
518
+ | null = null
519
+
520
+ let type: 'network' | 'vmkernel' | 'adapter' | 'new-switch'
521
+
522
+ if (wizard.isSelectedScheme(0) || wizard.isSelectedScheme(1)) {
523
+ const vlan = getVlanId(portProperties.value.vlanId)
524
+
525
+ data = addNetworkingZeroOrFirstSchemeDataFunc(
526
+ targetDevice.value,
527
+ Number(vlan),
528
+ portProperties.value,
529
+ ipFourSettings.value,
530
+ wizard.isSelectedScheme(1),
531
+ adapterStatus.value
532
+ )
533
+
534
+ type = 'vmkernel'
535
+ }
536
+
537
+ if (wizard.isSelectedScheme(2) || wizard.isSelectedScheme(3)) {
538
+ const vlan = getVlanId(connectionSettings.value.vlanId)
539
+
540
+ data = addNetworkingSecondOrThirdSchemeDataFunc(
541
+ connectionSettings.value,
542
+ targetDevice.value,
543
+ Number(vlan),
544
+ wizard.isSelectedScheme(2),
545
+ adapterStatus.value
546
+ )
547
+
548
+ type = 'network'
549
+ }
550
+
551
+ if (wizard.isSelectedScheme(4) || wizard.isSelectedScheme(5)) {
552
+ data = addNetworkingFourthOrFifthSchemeDataFunc(
553
+ targetDevice.value.switch,
554
+ wizard.isSelectedScheme(4),
555
+ adapterStatus.value,
556
+ props.diagramsData,
557
+ targetDevice.value.mtu
558
+ )
559
+
560
+ type = wizard.isSelectedScheme(4) ? 'adapter' : 'new-switch'
561
+ }
562
+
563
+ return new Promise((resolve, _reject) =>
564
+ emits(
565
+ 'add-networking-data-validate',
566
+ data,
567
+ type,
568
+ (err_arg: UI_I_ArbitraryObject<string>): void => {
569
+ resolve(err_arg)
570
+ }
571
+ )
572
+ )
573
+ }
574
+
575
+ const finalValidationFunc = async (
576
+ value: UI_I_WizardStep[]
577
+ ): Promise<UI_I_ValidationReturn> => {
578
+ let stepHasError = false
579
+
580
+ const validationFields: {
581
+ [key: string]: string
582
+ } = await checkFinal()
583
+
584
+ for (const fieldName in validationFields) {
585
+ const stepId = wizard.getStepIdByFieldName(fieldName)
586
+
587
+ if (stepId !== -1) {
588
+ stepHasError = wizard.setValidation(stepId, fieldName, {
589
+ fieldMessage: validationFields[fieldName],
590
+ alertMessage: validationFields[fieldName],
591
+ })
592
+ }
593
+ }
594
+
595
+ return {
596
+ stepHasError,
597
+ newValue: value,
598
+ }
599
+ }
600
+
601
+ const validationFunc = async (
602
+ value: UI_I_WizardStep[],
603
+ currentStep: UI_I_WizardStep,
604
+ nextStep: UI_I_WizardStep
605
+ ): Promise<UI_I_ValidationReturn> => {
606
+ let stepHasError = false
607
+ let stepShouldStop = {
608
+ ifOnCurrentStep: false,
609
+ ifFromAnyStep: false,
610
+ stoppageStepId: -1,
611
+ }
612
+
613
+ if (wizard.isValidateForStep(1, currentStep.id, nextStep.id)) {
614
+ const targetDeviceValidation = checkTargetDeviceSync(
615
+ localization.value,
616
+ targetDevice.value,
617
+ wizard,
618
+ value
619
+ )
620
+
621
+ value = targetDeviceValidation.newValue
622
+
623
+ stepHasError = stepHasError || targetDeviceValidation.stepHasError
624
+ }
625
+
626
+ if (wizard.isValidateForStep(2, currentStep.id, nextStep.id)) {
627
+ wizard.waitingStepId = nextStep.id
628
+
629
+ const adapterValidation = checkAdaptersSync(
630
+ localization.value,
631
+ adapterStatus.value,
632
+ value,
633
+ currentStep.id,
634
+ nextStep.id,
635
+ props.freeAdapters,
636
+ showNoActiveAdaptersModal,
637
+ showNoConnectedActiveAdaptersModal,
638
+ 2
639
+ )
640
+
641
+ value = adapterValidation.newValue
642
+
643
+ stepShouldStop = adapterValidation.stepShouldStop || stepShouldStop
644
+
645
+ stepHasError = stepHasError || adapterValidation.stepHasError
646
+ }
647
+
648
+ if (wizard.isValidateForStep(3, currentStep.id, nextStep.id)) {
649
+ const labelValidation = await checkNetworkAsync(
650
+ value,
651
+ portProperties.value.networkLabel,
652
+ 3,
653
+ UI_E_ValidationFields.PORT_PROPERTIES_NETWORK,
654
+ emits,
655
+ localization.value,
656
+ wizard
657
+ )
658
+
659
+ value = labelValidation.newValue
660
+
661
+ const portPropertiesValidation = checkPortPropertiesSync(
662
+ localization.value,
663
+ portProperties.value,
664
+ wizard,
665
+ value
666
+ )
667
+
668
+ value = portPropertiesValidation.newValue
669
+
670
+ stepHasError =
671
+ stepHasError ||
672
+ labelValidation.stepHasError ||
673
+ portPropertiesValidation.stepHasError
674
+ }
675
+
676
+ if (wizard.isValidateForStep(4, currentStep.id, nextStep.id)) {
677
+ const ipValidation = checkIpFourSettingsSync(
678
+ localization.value,
679
+ ipFourSettings.value,
680
+ wizard,
681
+ value
682
+ )
683
+
684
+ value = ipValidation.newValue
685
+
686
+ stepHasError = stepHasError || ipValidation.stepHasError
687
+ }
688
+
689
+ if (wizard.isValidateForStep(5, currentStep.id, nextStep.id)) {
690
+ const labelValidation = await checkNetworkAsync(
691
+ value,
692
+ connectionSettings.value.networkLabel,
693
+ 5,
694
+ UI_E_ValidationFields.CONNECTION_SETTINGS_NETWORK,
695
+ emits,
696
+ localization.value,
697
+ wizard
698
+ )
699
+
700
+ value = labelValidation.newValue
701
+
702
+ const connectionSettingsValidation = checkConnectionSettingsSync(
703
+ localization.value,
704
+ connectionSettings.value,
705
+ wizard,
706
+ value
707
+ )
708
+
709
+ value = connectionSettingsValidation.newValue
710
+
711
+ stepHasError =
712
+ stepHasError ||
713
+ labelValidation.stepHasError ||
714
+ connectionSettingsValidation.stepHasError
715
+ }
716
+
717
+ if (wizard.isValidateForStep(6, currentStep.id, nextStep.id)) {
718
+ wizard.waitingStepId = nextStep.id
719
+
720
+ const adapterValidation = checkAdaptersSync(
721
+ localization.value,
722
+ adapterStatus.value,
723
+ value,
724
+ currentStep.id,
725
+ nextStep.id,
726
+ props.adapters.items,
727
+ showNoActiveAdaptersModal,
728
+ showNoConnectedActiveAdaptersModal,
729
+ 6
730
+ )
731
+
732
+ value = adapterValidation.newValue
733
+
734
+ stepShouldStop = adapterValidation.stepShouldStop || stepShouldStop
735
+
736
+ stepHasError = stepHasError || adapterValidation.stepHasError
737
+ }
738
+
739
+ return {
740
+ newValue: value,
741
+ stepHasError,
742
+ stepShouldStop,
743
+ }
744
+ }
745
+
746
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> =>
747
+ wizard.changeSteps(value, validationFunc, finalValidationFunc)
748
+
749
+ const onHideAddNetworkingModal = (): void => {
750
+ emits('hide')
751
+ reset()
752
+ }
753
+
754
+ const onSubmit = async (): Promise<void> => {
755
+ let data:
756
+ | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
757
+ | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
758
+ | UI_I_AddNetworkingFourthOrFifthSchemeDataSend
759
+ | API_UI_I_SwitchItem
760
+ | null = null
761
+
762
+ let type: 'network' | 'vmkernel' | 'adapter' | 'new-switch' = 'network'
763
+
764
+ if (wizard.isSelectedScheme(0) || wizard.isSelectedScheme(1)) {
765
+ const vlan = getVlanId(portProperties.value.vlanId)
766
+ type = 'vmkernel'
767
+ data = addNetworkingZeroOrFirstSchemeDataFunc(
768
+ targetDevice.value,
769
+ Number(vlan),
770
+ portProperties.value,
771
+ ipFourSettings.value,
772
+ wizard.isSelectedScheme(1),
773
+ adapterStatus.value
774
+ )
775
+ }
776
+
777
+ if (wizard.isSelectedScheme(2) || wizard.isSelectedScheme(3)) {
778
+ const vlan = getVlanId(connectionSettings.value.vlanId)
779
+ type = 'network'
780
+ data = addNetworkingSecondOrThirdSchemeDataFunc(
781
+ connectionSettings.value,
782
+ targetDevice.value,
783
+ Number(vlan),
784
+ wizard.isSelectedScheme(2),
785
+ adapterStatus.value
786
+ )
787
+ }
788
+
789
+ if (wizard.isSelectedScheme(4) || wizard.isSelectedScheme(5)) {
790
+ type = wizard.isSelectedScheme(4) ? 'adapter' : 'new-switch'
791
+ data = addNetworkingFourthOrFifthSchemeDataFunc(
792
+ targetDevice.value.switch,
793
+ wizard.isSelectedScheme(4),
794
+ adapterStatus.value,
795
+ props.diagramsData,
796
+ targetDevice.value.mtu
797
+ )
798
+ }
799
+
800
+ data &&
801
+ emits('send-add-networking-data', data, type, onHideAddNetworkingModal)
802
+ }
803
+
804
+ onMounted(() => {
805
+ hostname.value = location.hostname
806
+ })
807
+
808
+ watch(
809
+ () => props.isNetworkingLoading,
810
+ (newValue: boolean) => {
811
+ wizard.setLoader(newValue)
812
+ },
813
+ {
814
+ immediate: true,
815
+ }
816
+ )
817
+
818
+ watch(
819
+ props.tcpStacks,
820
+ (newValue: UI_I_TCPStack[]) => {
821
+ portProperties.value.tcp = newValue?.[0]?.id || ''
822
+ ipFourSettings.value.static.defaultGateway.value =
823
+ newValue?.[0]?.gateway || ''
824
+ },
825
+ { deep: true }
826
+ )
827
+ </script>
828
+
829
+ <style scoped lang="scss">
830
+ :deep(.modal) {
831
+ & > .modal-dialog > .modal-content > .modal-body {
832
+ height: calc(100% - 110px);
833
+ .disabled-on-time {
834
+ opacity: 0.4;
835
+ pointer-events: none;
836
+ }
837
+ }
838
+ }
839
+ :deep(.disabled-on-time) {
840
+ opacity: 0.4;
841
+ pointer-events: none;
842
+ }
843
+ :deep(.wizard-content-container.add-networking-step) {
844
+ padding: 0px 15px 10px 10px;
845
+
846
+ .danger-not-valid {
847
+ border: 2px solid red;
848
+ border-bottom: 1px solid #db2100;
849
+ }
850
+ .tooltip-field {
851
+ margin-right: 12px;
852
+ }
853
+
854
+ .horizontal-flex-container {
855
+ margin-bottom: 5px;
856
+ min-height: 36px;
857
+ display: flex;
858
+ flex-direction: row;
859
+ }
860
+ .property-label-group {
861
+ width: 140px;
862
+ }
863
+ .disabled {
864
+ opacity: 0.4;
865
+ pointer-events: none;
866
+ }
867
+ .wizard-content-port {
868
+ .margin-left-property-value-group {
869
+ margin-left: 10px;
870
+ }
871
+
872
+ .property-value-group {
873
+ padding-left: 23px;
874
+ }
875
+ .horizontal-flex-container {
876
+ min-height: 24px;
877
+ margin-bottom: 0;
878
+ }
879
+ .radio {
880
+ min-height: 39px;
881
+ margin: 10px 0;
882
+ }
883
+ .form-block {
884
+ margin: 12px 0 24px 0;
885
+ padding-left: 23px;
886
+
887
+ &.form-block-ipv {
888
+ input[type='text'] {
889
+ width: 143px;
890
+ }
891
+ .horizontal-flex-container > label {
892
+ margin-right: 50px;
893
+ }
894
+ }
895
+ }
896
+ .edit-vmkernel-adapter-section {
897
+ padding-top: 12px;
898
+
899
+ label {
900
+ input[type='checkbox'] {
901
+ margin-right: 4px;
902
+ transform: translateY(1px);
903
+ }
904
+ }
905
+ .horizontal-flex-container {
906
+ margin-bottom: 5px;
907
+ }
908
+ }
909
+ .port-properties-network-label {
910
+ width: 280px;
911
+ }
912
+ .port-properties-padding {
913
+ padding-top: 8px;
914
+ }
915
+ .port-properties-mtu-selector {
916
+ margin-right: 12px;
917
+ }
918
+ .port-properties-mtu-container {
919
+ display: flex;
920
+ }
921
+ select {
922
+ height: 24px;
923
+ }
924
+ }
925
+ .nw-property-value-group {
926
+ display: inline;
927
+ }
928
+ }
929
+
930
+ :deep(.modal-body-content.modal-body-content__confirmation) {
931
+ display: flex;
932
+ .confirm-icon-container {
933
+ margin-right: 20px;
934
+ }
935
+ .preserve-newlines {
936
+ white-space: pre-line;
937
+ font-size: 15px;
938
+ }
939
+ }
940
+
941
+ .add-networking-wizard.is-dark {
942
+ :deep(.wizard-content-container.add-networking-step) {
943
+ .ready-complete-container {
944
+ background-color: var(--pannel-bg-color);
945
+ margin-top: 12px;
946
+
947
+ span {
948
+ color: var(--description-color);
949
+ }
950
+ }
951
+
952
+ .add-networking-radio-button-description {
953
+ color: var(--description-color);
954
+ }
955
+
956
+ .property-label-group {
957
+ color: var(--main-color-mode2);
958
+ }
959
+ .flex-property-label-group {
960
+ color: var(--main-color-mode2);
961
+ }
962
+ .flex-property-value-group {
963
+ select {
964
+ color: #fff;
965
+ }
966
+ }
967
+ .failover-order-master {
968
+ .secondary-title label {
969
+ color: #fff;
970
+ }
971
+ }
972
+ .k-grid-content {
973
+ background-color: var(--modal-bg-color);
974
+ }
975
+ .vui-action-bar {
976
+ background-color: var(--pannel-bg-color);
977
+ color: var(--title-color);
978
+ padding: 8px 0 3px;
979
+
980
+ .action-link-container:not(.disabled) {
981
+ &:hover {
982
+ background-color: #29414e;
983
+ border: 1px solid #c7e9ff;
984
+ }
985
+ }
986
+
987
+ svg {
988
+ fill: #fff;
989
+ }
990
+ }
991
+
992
+ .k-grid.k-widget .k-grid-content {
993
+ border-left: 1px solid #485764;
994
+ border-right: 1px solid #485764;
995
+ border-top: 1px solid #ddd;
996
+ border-bottom: 1px solid #ddd;
997
+
998
+ tbody tr {
999
+ background-color: var(--modal-bg-color);
1000
+
1001
+ td {
1002
+ border-bottom: 1px solid #666666;
1003
+ border-color: #666666;
1004
+ }
1005
+
1006
+ &:hover {
1007
+ background-color: #324f61;
1008
+ color: var(--title-color);
1009
+
1010
+ td {
1011
+ border-bottom: 1px solid #ffffff;
1012
+ }
1013
+ }
1014
+
1015
+ &.k-state-selected {
1016
+ background-color: #d8e3e9;
1017
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
1018
+
1019
+ td span {
1020
+ color: #000;
1021
+ }
1022
+ }
1023
+ }
1024
+ }
1025
+
1026
+ .failover-order-details {
1027
+ &.relative-container .absolute-container {
1028
+ background-color: var(--pannel-bg-color);
1029
+ color: var(--main-color-mode2);
1030
+
1031
+ &:has(.no-items-selected-container) {
1032
+ background-color: transparent;
1033
+ }
1034
+ }
1035
+
1036
+ td span {
1037
+ color: var(--main-color-mode2);
1038
+ }
1039
+ button span {
1040
+ color: var(--main-color-mode2);
1041
+
1042
+ &:hover:not(.disabled) {
1043
+ background-color: transparent;
1044
+ }
1045
+ }
1046
+ button.active span {
1047
+ color: #fff;
1048
+ }
1049
+ }
1050
+ }
1051
+
1052
+ .select-adapter-info span {
1053
+ color: var(--main-color-mode2);
1054
+ }
1055
+ }
1056
+ </style>