bfg-common 1.4.197 → 1.4.199

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 (23) hide show
  1. package/assets/localization/local_be.json +4 -1
  2. package/assets/localization/local_en.json +4 -1
  3. package/assets/localization/local_hy.json +4 -1
  4. package/assets/localization/local_kk.json +4 -1
  5. package/assets/localization/local_ru.json +4 -1
  6. package/assets/localization/local_zh.json +4 -1
  7. package/components/atoms/DiagramIcon.vue +29 -0
  8. package/components/common/diagramMain/adapter/AdapterItem.vue +17 -4
  9. package/components/common/diagramMain/lib/models/interfaces.ts +24 -1
  10. package/components/common/diagramMain/lib/models/types.ts +7 -2
  11. package/components/common/diagramMain/lib/utils/utils.ts +331 -278
  12. package/components/common/diagramMain/modals/editSettings/tabs/NetworkProperties.vue +1 -1
  13. package/components/common/diagramMain/modals/migrateVmkernelAdapter/steps/ConnectionSettings.vue +1 -1
  14. package/components/common/wizards/network/add/Add.vue +18 -7
  15. package/components/common/wizards/network/add/lib/config/steps.ts +464 -464
  16. package/components/common/wizards/network/add/modals/SelectNetwork.vue +1 -1
  17. package/components/common/wizards/network/add/modals/SelectStandardSwitch.vue +1 -1
  18. package/components/common/wizards/network/add/modals/SelectSwitch.vue +1 -1
  19. package/components/common/wizards/network/add/steps/ConnectionSettings.vue +1 -1
  20. package/components/common/wizards/network/add/steps/PortProperties.vue +1 -1
  21. package/package.json +1 -1
  22. /package/components/common/wizards/network/add/lib/config/{index.ts → config.ts} +0 -0
  23. /package/components/common/wizards/network/add/lib/utils/{index.ts → utils.ts} +0 -0
@@ -1,278 +1,331 @@
1
- import type {
2
- UI_I_Network,
3
- UI_I_SelectedPort,
4
- UI_I_NetworksWithPositions,
5
- UI_I_AdaptersWithPositions,
6
- UI_I_SelectedSwitchPositions,
7
- UI_I_DiagramData,
8
- UI_I_AdaptersHeight,
9
- UI_I_Adapter,
10
- UI_I_AdaptersPositions,
11
- UI_I_AdapterStatus,
12
- API_UI_I_SwitchItem,
13
- } from '~/components/common/diagramMain/lib/models/interfaces'
14
- import type { UI_T_Adapters } from '~/components/common/diagramMain/lib/models/types'
15
- import {
16
- UI_E_NetworkType,
17
- UI_E_PositionsY,
18
- } from '~/components/common/diagramMain/lib/models/enums'
19
- import { NETWORK_POSITIONS } from '~/components/common/diagramMain/lib/config'
20
-
21
- export const hasPortAndNetwork = (
22
- selectedPort: UI_I_SelectedPort,
23
- id: string
24
- ): boolean =>
25
- selectedPort.portId !== '-1' &&
26
- selectedPort.networkId !== '-1' &&
27
- selectedPort.networkId === id
28
-
29
- export const networksPositions = (
30
- arr: number[],
31
- net: UI_I_NetworksWithPositions
32
- ): number[] => {
33
- if (net.ports.length === 0) return [...arr, net.connectLineY]
34
- if (!net.toggle)
35
- return [
36
- ...arr,
37
- net.portsPosition + NETWORK_POSITIONS.EMPTY_PORTS_PADDING_BOTTOM,
38
- ]
39
-
40
- return [
41
- ...arr,
42
- net.portsPosition +
43
- NETWORK_POSITIONS.FROM_VLAN_ID_TO_GROUP_NAME +
44
- NETWORK_POSITIONS.BETWEEN_VMS_AND_PORTS,
45
- net.networkType === UI_E_NetworkType.VCenter
46
- ? net.portsPosition +
47
- NETWORK_POSITIONS.FROM_VLAN_ID_TO_GROUP_NAME +
48
- NETWORK_POSITIONS.BETWEEN_V_CENTERS +
49
- NETWORK_POSITIONS.V_CENTER_HEIGHT * (net.portsCount - 1)
50
- : net.portsPosition +
51
- NETWORK_POSITIONS.FROM_VLAN_ID_TO_GROUP_NAME +
52
- NETWORK_POSITIONS.BETWEEN_VMS_AND_PORTS +
53
- NETWORK_POSITIONS.VMS_AND_PORTS_HEIGHT * (net.portsCount - 1),
54
- ]
55
- }
56
-
57
- export const getSelectedPortLinePositions = (
58
- selectedPortPosition: number | undefined,
59
- selectedNetworkData: UI_I_Network
60
- ) =>
61
- selectedPortPosition
62
- ? selectedNetworkData.networkType === UI_E_NetworkType.VCenter
63
- ? selectedPortPosition + 12.5
64
- : selectedPortPosition + 7.5
65
- : 0
66
-
67
- const selectedNetworkDataFunc = (
68
- networkId: string,
69
- networksWithPositions: UI_I_NetworksWithPositions[]
70
- ): UI_I_NetworksWithPositions | undefined =>
71
- networksWithPositions?.find(
72
- (network: UI_I_Network): boolean => network.id === networkId
73
- )
74
-
75
- export const getSelectNetworkDataFunc = (
76
- networkId: string,
77
- networksWithPositions: UI_I_NetworksWithPositions[],
78
- adaptersWithPositions: UI_I_AdaptersWithPositions
79
- ): UI_I_SelectedSwitchPositions | undefined => {
80
- const selectedNetworkData: UI_I_NetworksWithPositions | undefined =
81
- selectedNetworkDataFunc(networkId, networksWithPositions)
82
-
83
- if (!selectedNetworkData) return
84
-
85
- if (selectedNetworkData.state.state === 3)
86
- return {
87
- selectedSwitchLineY: {
88
- y1: 0,
89
- y2: 0,
90
- },
91
- selectedPort: {
92
- networkId,
93
- portId: '-1',
94
- activeAdapters: [],
95
- },
96
- }
97
-
98
- const activeAdapters: string[] = selectedNetworkData.activeAdapters
99
-
100
- const adaptersPositions: number[] =
101
- adaptersWithPositions.adapters
102
- ?.filter((adapter: UI_T_Adapters) => activeAdapters?.includes(adapter.id))
103
- ?.map((adapter: UI_T_Adapters) => adapter.adapterPosition + 7.5) || []
104
- let selectedPositions: number[] = []
105
-
106
- if (!adaptersWithPositions.toggle) {
107
- selectedPositions = [
108
- adaptersWithPositions.adaptersConnectLineY,
109
- selectedNetworkData.connectLineY,
110
- ]
111
- } else if (
112
- adaptersWithPositions.adapters === null ||
113
- adaptersWithPositions.adapters?.length === 0
114
- ) {
115
- selectedPositions = [47.5, selectedNetworkData.connectLineY].sort(
116
- (y1: number, y2: number) => y1 - y2
117
- )
118
- } else {
119
- selectedPositions = [
120
- ...adaptersPositions,
121
- selectedNetworkData.connectLineY,
122
- ].sort((y1: number, y2: number) => y1 - y2)
123
- }
124
-
125
- return {
126
- selectedSwitchLineY: {
127
- y1: selectedPositions[0],
128
- y2: selectedPositions[selectedPositions.length - 1],
129
- },
130
- selectedPort: {
131
- networkId,
132
- portId: '-1',
133
- activeAdapters: activeAdapters || [],
134
- },
135
- }
136
- }
137
-
138
- export const getSelectPortDataFunc = (
139
- networkId: string,
140
- portId: string,
141
- networksWithPositions: UI_I_NetworksWithPositions[],
142
- adaptersWithPositions: UI_I_AdaptersWithPositions
143
- ): UI_I_SelectedSwitchPositions | undefined => {
144
- const selectedNetworkData: UI_I_NetworksWithPositions | undefined =
145
- selectedNetworkDataFunc(networkId, networksWithPositions)
146
-
147
- if (!selectedNetworkData) return
148
-
149
- const activeAdapters: string[] = selectedNetworkData.activeAdapters
150
- const adaptersPositions: number[] =
151
- adaptersWithPositions.adapters
152
- ?.filter((adapter: UI_T_Adapters) => activeAdapters?.includes(adapter.id))
153
- ?.map((adapter: UI_T_Adapters) => adapter.adapterPosition + 7.5) || []
154
- const selectedPortPosition: number | undefined =
155
- selectedNetworkData.ports.find(
156
- (el): boolean => el.id === portId
157
- )?.portPosition
158
- const selectedPortLinePosition: number = getSelectedPortLinePositions(
159
- selectedPortPosition,
160
- selectedNetworkData
161
- )
162
- let selectedPositions: number[] = []
163
-
164
- if (!adaptersWithPositions.toggle) {
165
- selectedPositions = [
166
- adaptersWithPositions.adaptersConnectLineY,
167
- selectedNetworkData.connectLineY,
168
- selectedPortLinePosition,
169
- ]
170
- } else {
171
- selectedPositions = [...adaptersPositions, selectedPortLinePosition].sort(
172
- (y1: number, y2: number) => y1 - y2
173
- )
174
- }
175
-
176
- return {
177
- selectedSwitchLineY: {
178
- y1: selectedPositions[0],
179
- y2: selectedPositions[selectedPositions.length - 1],
180
- },
181
- selectedPort: {
182
- networkId,
183
- portId,
184
- activeAdapters: activeAdapters || [],
185
- },
186
- }
187
- }
188
-
189
- export const countAdaptersHeight = (
190
- diagramData: UI_I_DiagramData | null
191
- ): UI_I_AdaptersHeight => {
192
- const toggle: boolean = !!diagramData?.physicalAdapters?.toggle
193
- const adaptersCount: number =
194
- diagramData?.physicalAdapters?.adapters.length || 0
195
-
196
- return {
197
- height:
198
- UI_E_PositionsY.ADAPTER_FROM_RECT_TOP +
199
- (adaptersCount === 0
200
- ? UI_E_PositionsY.SINGLE_ADAPTER_HEIGHT
201
- : toggle
202
- ? adaptersCount * UI_E_PositionsY.SINGLE_ADAPTER_HEIGHT
203
- : 0) +
204
- UI_E_PositionsY.SPACE_FROM_RECT_BOTTOM,
205
- toggle,
206
- adaptersCount,
207
- }
208
- }
209
-
210
- export const getAdaptersPositions = (
211
- diagramData: UI_I_DiagramData | null,
212
- height: number
213
- ): UI_I_AdaptersPositions => {
214
- const titlePosition: number =
215
- UI_E_PositionsY.DIAGRAM_TOP +
216
- UI_E_PositionsY.BETWEEN_RECTS +
217
- UI_E_PositionsY.TITLE_FROM_RECT_TOP
218
-
219
- const rectPosition: number =
220
- UI_E_PositionsY.DIAGRAM_TOP + UI_E_PositionsY.BETWEEN_RECTS
221
-
222
- const adaptersConnectLineY: number = rectPosition + height / 2
223
-
224
- const adapters: UI_T_Adapters[] | null =
225
- diagramData?.physicalAdapters?.adapters.map(
226
- (adapter: UI_I_Adapter, index: number) => {
227
- const adapterPosition: number =
228
- UI_E_PositionsY.DIAGRAM_TOP +
229
- UI_E_PositionsY.BETWEEN_RECTS +
230
- UI_E_PositionsY.ADAPTER_FROM_RECT_TOP +
231
- UI_E_PositionsY.SINGLE_ADAPTER_HEIGHT * index
232
-
233
- return {
234
- ...adapter,
235
- adapterPosition,
236
- }
237
- }
238
- ) || null
239
-
240
- return {
241
- titlePosition,
242
- rectPosition,
243
- adaptersConnectLineY,
244
- adapters,
245
- }
246
- }
247
-
248
- export const makeSwitchSendData = (
249
- data: UI_I_DiagramData,
250
- adapterStatus: UI_I_AdapterStatus
251
- ): API_UI_I_SwitchItem | null => {
252
- if (!data.networking) return null
253
-
254
- return {
255
- id: data.id,
256
- mtu: data.networking.mtu,
257
- networks: data.networks.map((network: UI_I_Network) => network.title),
258
- nics: adapterStatus,
259
- security: {
260
- promiscuous: data.networking.securityPolicy[0].value,
261
- forged_transmits: data.networking.securityPolicy[1].value,
262
- mac_change: data.networking.securityPolicy[2].value,
263
- },
264
- teaming: {
265
- notify_switches: data.networking.nicTeamingPolicy[0].value,
266
- mode: data.networking.nicTeamingPolicy[1].value,
267
- link_detection_mode: data.networking.nicTeamingPolicy[2].value,
268
- failback: data.networking.nicTeamingPolicy[3].value,
269
- },
270
- shaping: {
271
- inherit: false,
272
- enabled: !!data.networking.shapingPolicy[0].value,
273
- average_bw: data.networking.average_bw,
274
- peak_bw: data.networking.peak_bw,
275
- burst_size: data.networking.burst_size,
276
- },
277
- }
278
- }
1
+ import type { UI_I_ItemsWithTotalCounts } from '~/lib/models/interfaces'
2
+ import type {
3
+ UI_I_Network,
4
+ UI_I_SelectedPort,
5
+ UI_I_NetworksWithPositions,
6
+ UI_I_AdaptersWithPositions,
7
+ UI_I_SelectedSwitchPositions,
8
+ UI_I_DiagramData,
9
+ UI_I_AdaptersHeight,
10
+ UI_I_Adapter,
11
+ UI_I_AdaptersPositions,
12
+ UI_I_AdapterStatus,
13
+ API_UI_I_SwitchItem,
14
+ UI_I_AvailableAdapters,
15
+ UI_I_SwitchAdapterItem,
16
+ UI_I_AdapterWithError,
17
+ } from '~/components/common/diagramMain/lib/models/interfaces'
18
+ import type { UI_T_Adapters } from '~/components/common/diagramMain/lib/models/types'
19
+ import {
20
+ UI_E_NetworkType,
21
+ UI_E_PositionsY,
22
+ } from '~/components/common/diagramMain/lib/models/enums'
23
+ import { NETWORK_POSITIONS } from '~/components/common/diagramMain/lib/config'
24
+
25
+ export const hasPortAndNetwork = (
26
+ selectedPort: UI_I_SelectedPort,
27
+ id: string
28
+ ): boolean =>
29
+ selectedPort.portId !== '-1' &&
30
+ selectedPort.networkId !== '-1' &&
31
+ selectedPort.networkId === id
32
+
33
+ export const networksPositions = (
34
+ arr: number[],
35
+ net: UI_I_NetworksWithPositions
36
+ ): number[] => {
37
+ if (net.ports.length === 0) return [...arr, net.connectLineY]
38
+ if (!net.toggle)
39
+ return [
40
+ ...arr,
41
+ net.portsPosition + NETWORK_POSITIONS.EMPTY_PORTS_PADDING_BOTTOM,
42
+ ]
43
+
44
+ return [
45
+ ...arr,
46
+ net.portsPosition +
47
+ NETWORK_POSITIONS.FROM_VLAN_ID_TO_GROUP_NAME +
48
+ NETWORK_POSITIONS.BETWEEN_VMS_AND_PORTS,
49
+ net.networkType === UI_E_NetworkType.VCenter
50
+ ? net.portsPosition +
51
+ NETWORK_POSITIONS.FROM_VLAN_ID_TO_GROUP_NAME +
52
+ NETWORK_POSITIONS.BETWEEN_V_CENTERS +
53
+ NETWORK_POSITIONS.V_CENTER_HEIGHT * (net.portsCount - 1)
54
+ : net.portsPosition +
55
+ NETWORK_POSITIONS.FROM_VLAN_ID_TO_GROUP_NAME +
56
+ NETWORK_POSITIONS.BETWEEN_VMS_AND_PORTS +
57
+ NETWORK_POSITIONS.VMS_AND_PORTS_HEIGHT * (net.portsCount - 1),
58
+ ]
59
+ }
60
+
61
+ export const getSelectedPortLinePositions = (
62
+ selectedPortPosition: number | undefined,
63
+ selectedNetworkData: UI_I_Network
64
+ ) =>
65
+ selectedPortPosition
66
+ ? selectedNetworkData.networkType === UI_E_NetworkType.VCenter
67
+ ? selectedPortPosition + 12.5
68
+ : selectedPortPosition + 7.5
69
+ : 0
70
+
71
+ const selectedNetworkDataFunc = (
72
+ networkId: string,
73
+ networksWithPositions: UI_I_NetworksWithPositions[]
74
+ ): UI_I_NetworksWithPositions | undefined =>
75
+ networksWithPositions?.find(
76
+ (network: UI_I_Network): boolean => network.id === networkId
77
+ )
78
+
79
+ export const getSelectNetworkDataFunc = (
80
+ networkId: string,
81
+ networksWithPositions: UI_I_NetworksWithPositions[],
82
+ adaptersWithPositions: UI_I_AdaptersWithPositions
83
+ ): UI_I_SelectedSwitchPositions | undefined => {
84
+ const selectedNetworkData: UI_I_NetworksWithPositions | undefined =
85
+ selectedNetworkDataFunc(networkId, networksWithPositions)
86
+
87
+ if (!selectedNetworkData) return
88
+
89
+ if (selectedNetworkData.state.state === 3)
90
+ return {
91
+ selectedSwitchLineY: {
92
+ y1: 0,
93
+ y2: 0,
94
+ },
95
+ selectedPort: {
96
+ networkId,
97
+ portId: '-1',
98
+ activeAdapters: [],
99
+ },
100
+ }
101
+
102
+ const activeAdapters: string[] = selectedNetworkData.activeAdapters
103
+
104
+ const adaptersPositions: number[] =
105
+ adaptersWithPositions.adapters
106
+ ?.filter((adapter: UI_T_Adapters) => activeAdapters?.includes(adapter.id))
107
+ ?.map((adapter: UI_T_Adapters) => adapter.adapterPosition + 7.5) || []
108
+ let selectedPositions: number[] = []
109
+
110
+ if (!adaptersWithPositions.toggle) {
111
+ selectedPositions = [
112
+ adaptersWithPositions.adaptersConnectLineY,
113
+ selectedNetworkData.connectLineY,
114
+ ]
115
+ } else if (
116
+ adaptersWithPositions.adapters === null ||
117
+ adaptersWithPositions.adapters?.length === 0
118
+ ) {
119
+ selectedPositions = [47.5, selectedNetworkData.connectLineY].sort(
120
+ (y1: number, y2: number) => y1 - y2
121
+ )
122
+ } else {
123
+ selectedPositions = [
124
+ ...adaptersPositions,
125
+ selectedNetworkData.connectLineY,
126
+ ].sort((y1: number, y2: number) => y1 - y2)
127
+ }
128
+
129
+ return {
130
+ selectedSwitchLineY: {
131
+ y1: selectedPositions[0],
132
+ y2: selectedPositions[selectedPositions.length - 1],
133
+ },
134
+ selectedPort: {
135
+ networkId,
136
+ portId: '-1',
137
+ activeAdapters: activeAdapters || [],
138
+ },
139
+ }
140
+ }
141
+
142
+ export const getSelectPortDataFunc = (
143
+ networkId: string,
144
+ portId: string,
145
+ networksWithPositions: UI_I_NetworksWithPositions[],
146
+ adaptersWithPositions: UI_I_AdaptersWithPositions
147
+ ): UI_I_SelectedSwitchPositions | undefined => {
148
+ const selectedNetworkData: UI_I_NetworksWithPositions | undefined =
149
+ selectedNetworkDataFunc(networkId, networksWithPositions)
150
+
151
+ if (!selectedNetworkData) return
152
+
153
+ const activeAdapters: string[] = selectedNetworkData.activeAdapters
154
+ const adaptersPositions: number[] =
155
+ adaptersWithPositions.adapters
156
+ ?.filter((adapter: UI_T_Adapters) => activeAdapters?.includes(adapter.id))
157
+ ?.map((adapter: UI_T_Adapters) => adapter.adapterPosition + 7.5) || []
158
+ const selectedPortPosition: number | undefined =
159
+ selectedNetworkData.ports.find(
160
+ (el): boolean => el.id === portId
161
+ )?.portPosition
162
+ const selectedPortLinePosition: number = getSelectedPortLinePositions(
163
+ selectedPortPosition,
164
+ selectedNetworkData
165
+ )
166
+ let selectedPositions: number[] = []
167
+
168
+ if (!adaptersWithPositions.toggle) {
169
+ selectedPositions = [
170
+ adaptersWithPositions.adaptersConnectLineY,
171
+ selectedNetworkData.connectLineY,
172
+ selectedPortLinePosition,
173
+ ]
174
+ } else {
175
+ selectedPositions = [...adaptersPositions, selectedPortLinePosition].sort(
176
+ (y1: number, y2: number) => y1 - y2
177
+ )
178
+ }
179
+
180
+ return {
181
+ selectedSwitchLineY: {
182
+ y1: selectedPositions[0],
183
+ y2: selectedPositions[selectedPositions.length - 1],
184
+ },
185
+ selectedPort: {
186
+ networkId,
187
+ portId,
188
+ activeAdapters: activeAdapters || [],
189
+ },
190
+ }
191
+ }
192
+
193
+ export const countAdaptersHeight = (
194
+ diagramData: UI_I_DiagramData | null
195
+ ): UI_I_AdaptersHeight => {
196
+ const toggle: boolean = !!diagramData?.physicalAdapters?.toggle
197
+ const adaptersCount: number =
198
+ diagramData?.physicalAdapters?.adapters.length || 0
199
+
200
+ return {
201
+ height:
202
+ UI_E_PositionsY.ADAPTER_FROM_RECT_TOP +
203
+ (adaptersCount === 0
204
+ ? UI_E_PositionsY.SINGLE_ADAPTER_HEIGHT
205
+ : toggle
206
+ ? adaptersCount * UI_E_PositionsY.SINGLE_ADAPTER_HEIGHT
207
+ : 0) +
208
+ UI_E_PositionsY.SPACE_FROM_RECT_BOTTOM,
209
+ toggle,
210
+ adaptersCount,
211
+ }
212
+ }
213
+
214
+ export const getAdaptersPositions = (
215
+ diagramData: UI_I_DiagramData | null,
216
+ height: number
217
+ ): UI_I_AdaptersPositions => {
218
+ const titlePosition: number =
219
+ UI_E_PositionsY.DIAGRAM_TOP +
220
+ UI_E_PositionsY.BETWEEN_RECTS +
221
+ UI_E_PositionsY.TITLE_FROM_RECT_TOP
222
+
223
+ const rectPosition: number =
224
+ UI_E_PositionsY.DIAGRAM_TOP + UI_E_PositionsY.BETWEEN_RECTS
225
+
226
+ const adaptersConnectLineY: number = rectPosition + height / 2
227
+
228
+ const adapters: UI_T_Adapters[] | null =
229
+ diagramData?.physicalAdapters?.adapters.map(
230
+ (adapter: UI_I_Adapter, index: number) => {
231
+ const adapterPosition: number =
232
+ UI_E_PositionsY.DIAGRAM_TOP +
233
+ UI_E_PositionsY.BETWEEN_RECTS +
234
+ UI_E_PositionsY.ADAPTER_FROM_RECT_TOP +
235
+ UI_E_PositionsY.SINGLE_ADAPTER_HEIGHT * index
236
+
237
+ return {
238
+ ...adapter,
239
+ adapterPosition,
240
+ }
241
+ }
242
+ ) || null
243
+
244
+ return {
245
+ titlePosition,
246
+ rectPosition,
247
+ adaptersConnectLineY,
248
+ adapters,
249
+ }
250
+ }
251
+
252
+ export const makeSwitchSendData = (
253
+ data: UI_I_DiagramData,
254
+ adapterStatus: UI_I_AdapterStatus
255
+ ): API_UI_I_SwitchItem | null => {
256
+ if (!data.networking) return null
257
+
258
+ return {
259
+ id: data.id,
260
+ mtu: data.networking.mtu,
261
+ networks: data.networks.map((network: UI_I_Network) => network.title),
262
+ nics: adapterStatus,
263
+ security: {
264
+ promiscuous: data.networking.securityPolicy[0].value,
265
+ forged_transmits: data.networking.securityPolicy[1].value,
266
+ mac_change: data.networking.securityPolicy[2].value,
267
+ },
268
+ teaming: {
269
+ notify_switches: data.networking.nicTeamingPolicy[0].value,
270
+ mode: data.networking.nicTeamingPolicy[1].value,
271
+ link_detection_mode: data.networking.nicTeamingPolicy[2].value,
272
+ failback: data.networking.nicTeamingPolicy[3].value,
273
+ },
274
+ shaping: {
275
+ inherit: false,
276
+ enabled: !!data.networking.shapingPolicy[0].value,
277
+ average_bw: data.networking.average_bw,
278
+ peak_bw: data.networking.peak_bw,
279
+ burst_size: data.networking.burst_size,
280
+ },
281
+ }
282
+ }
283
+
284
+ export const getAvailableAdapters = (
285
+ nics: UI_I_ItemsWithTotalCounts<UI_I_SwitchAdapterItem>,
286
+ networkOrSwitchNics: UI_I_AdapterStatus
287
+ ): UI_I_AvailableAdapters => {
288
+ const availableAdapters: UI_I_AvailableAdapters = {
289
+ activeAdapters: [],
290
+ standbyAdapters: [],
291
+ unusedAdapters: [],
292
+ }
293
+
294
+ if (nics?.items) {
295
+ networkOrSwitchNics?.active?.forEach(
296
+ (nic) =>
297
+ nics?.items.find(
298
+ (a: UI_I_SwitchAdapterItem): boolean => a.id === nic
299
+ ) && availableAdapters.activeAdapters.push(nic)
300
+ )
301
+ networkOrSwitchNics?.standby?.forEach(
302
+ (nic) =>
303
+ nics?.items.find(
304
+ (a: UI_I_SwitchAdapterItem): boolean => a.id === nic
305
+ ) && availableAdapters.standbyAdapters.push(nic)
306
+ )
307
+ networkOrSwitchNics?.unused?.forEach(
308
+ (nic) =>
309
+ nics?.items.find(
310
+ (a: UI_I_SwitchAdapterItem): boolean => a.id === nic
311
+ ) && availableAdapters.unusedAdapters.push(nic)
312
+ )
313
+ }
314
+
315
+ return availableAdapters
316
+ }
317
+
318
+ export const createAdapterWithError = (
319
+ nic: string,
320
+ switchId: string
321
+ ): UI_I_AdapterWithError => ({
322
+ fullName: nic,
323
+ id: nic,
324
+ name: nic,
325
+ networks: [],
326
+ state: { state: 1, errors: [] },
327
+ switch: switchId,
328
+ testId: `adapter-${nic}`,
329
+ carrier: false,
330
+ status: 'error',
331
+ })
@@ -93,7 +93,7 @@ import type {
93
93
  } from '~/components/common/diagramMain/lib/models/interfaces'
94
94
  import type { UI_T_PropertiesFieldName } from '~/components/common/diagramMain/lib/models/types'
95
95
  import { validationMessagesArrayFunc } from '~/components/common/diagramMain/modals/lib/utils'
96
- import { vlanIdSelectData } from '~/components/common/wizards/network/add/lib/config'
96
+ import { vlanIdSelectData } from '~/components/common/wizards/network/add/lib/config/config'
97
97
 
98
98
  // Props from up
99
99
  const props = withDefaults(
@@ -94,7 +94,7 @@ import type {
94
94
  } from '~/lib/models/interfaces'
95
95
  import type { UI_I_ConnectionSettings } from '~/components/common/wizards/network/add/lib/models/interfaces'
96
96
  import type { UI_I_ErrorFields } from '~/components/atoms/wizard/lib/models/interfaces'
97
- import { vlanIdSelectData } from '~/components/common/wizards/network/add/lib/config'
97
+ import { vlanIdSelectData } from '~/components/common/wizards/network/add/lib/config/config'
98
98
  import type Wizard from '~/components/atoms/wizard/lib/utils/utils'
99
99
  import {
100
100
  validateNetworkConnectionSettingsLocal,