bfg-common 1.3.204 → 1.3.206

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.
@@ -144,14 +144,16 @@ import {
144
144
  adapterViewSettingsFunc,
145
145
  } from '~/components/common/diagramMain/modals/lib/config'
146
146
  import { allAdaptersFunc } from '~/components/common/adapterManager/lib/config'
147
- import { UI_I_Localization } from '~/lib/models/interfaces'
147
+ import {
148
+ UI_I_Localization,
149
+ UI_I_ItemsWithTotalCounts,
150
+ } from '~/lib/models/interfaces'
148
151
  import { UI_T_AdapterStatusNames } from '~/components/common/diagramMain/lib/models/types'
149
152
  import {
150
153
  UI_I_Adapter,
151
154
  UI_I_AdapterStatus,
152
155
  UI_I_ModalsInitialData,
153
156
  UI_I_SwitchAdapterItem,
154
- UI_I_SwitchAdapters,
155
157
  } from '~/components/common/diagramMain/lib/models/interfaces'
156
158
 
157
159
  const props = withDefaults(
@@ -160,7 +162,7 @@ const props = withDefaults(
160
162
  fullMode?: boolean
161
163
  isAddModal?: boolean
162
164
  isDarkMode: boolean
163
- adapters: UI_I_SwitchAdapters
165
+ adapters: UI_I_ItemsWithTotalCounts<UI_I_SwitchAdapterItem>
164
166
  initialData?: UI_I_ModalsInitialData
165
167
  addedAdapters?: string[]
166
168
  coreAdapters?: string[]
@@ -188,8 +190,8 @@ const props = withDefaults(
188
190
  addedAdapters: () => [],
189
191
  coreAdapters: () => [],
190
192
  adapters: () => ({
191
- totalItems: 0,
192
- totalPages: 0,
193
+ total_items: 0,
194
+ total_pages: 0,
193
195
  items: [],
194
196
  }),
195
197
  isShowNoConnectedActiveAdaptersModal: false,
@@ -34,11 +34,10 @@
34
34
  </template>
35
35
 
36
36
  <script setup lang="ts">
37
- import { UI_I_Localization } from '~/lib/models/interfaces'
37
+ import { UI_I_Localization, UI_I_ItemsWithTotalCounts } from '~/lib/models/interfaces'
38
38
  import {
39
39
  UI_I_Adapter,
40
- UI_I_SwitchAdapterItem,
41
- UI_I_SwitchAdapters,
40
+ UI_I_SwitchAdapterItem
42
41
  } from '~/components/common/diagramMain/lib/models/interfaces'
43
42
 
44
43
  // Props from up
@@ -51,15 +50,15 @@ const props = withDefaults(
51
50
  height: string
52
51
  modalName: string
53
52
  viewName: string
54
- adapters: UI_I_SwitchAdapters
53
+ adapters: UI_I_ItemsWithTotalCounts<UI_I_SwitchAdapterItem>
55
54
  existingAdaptersForAdding: (UI_I_Adapter | UI_I_SwitchAdapterItem)[]
56
55
  selectedAddAdapterId: string
57
56
  }>(),
58
57
  {
59
58
  existingAdaptersForAdding: () => [],
60
59
  adapters: () => ({
61
- totalItems: 0,
62
- totalPages: 0,
60
+ total_items: 0,
61
+ total_pages: 0,
63
62
  items: [],
64
63
  }),
65
64
  }
@@ -205,6 +205,7 @@
205
205
  :selected-switch-id="selectedSwitchId"
206
206
  :tcp-stacks="props.tcpStacks"
207
207
  :tcp-stack-loading="props.tcpStackLoading"
208
+ :diagrams-data="props.diagramsData"
208
209
  @check-network-label="onCheckNetworkLabel"
209
210
  @get-existing-standard-switches="onGetExistingStandardSwitches"
210
211
  @get-tcp-stacks="onGetTcpStacks"
@@ -245,11 +246,12 @@ import {
245
246
  UI_I_ToggleDiagramPortsPayload,
246
247
  UI_I_PortToggleFlag,
247
248
  UI_I_DiagramData,
248
- UI_I_SwitchAdapters,
249
+ UI_I_SwitchAdapterItem,
249
250
  } from '~/components/common/diagramMain/lib/models/interfaces'
250
251
  import {
251
252
  UI_I_ArbitraryObject,
252
253
  UI_I_Localization,
254
+ UI_I_ItemsWithTotalCounts,
253
255
  } from '~/lib/models/interfaces'
254
256
  import {
255
257
  UI_I_AddNetworkingSecondOrThirdSchemeDataSend,
@@ -294,12 +296,13 @@ const props = withDefaults(
294
296
  inPortlet?: boolean
295
297
  standardSwitchesInitial?: UI_I_Switch[]
296
298
  hostName?: string
297
- adapters?: UI_I_SwitchAdapters
299
+ adapters?: UI_I_ItemsWithTotalCounts<UI_I_SwitchAdapterItem>
298
300
  freeAdapters?: UI_I_Adapter[]
299
301
  networksList?: UI_I_Network[]
300
302
  isDarkMode: boolean
301
303
  tcpStacks?: UI_I_TCPStack[]
302
304
  tcpStackLoading?: boolean
305
+ diagramsData?: UI_I_DiagramData[]
303
306
  }>(),
304
307
  {
305
308
  diagramData: null,
@@ -307,14 +310,15 @@ const props = withDefaults(
307
310
  standardSwitchesInitial: () => [],
308
311
  hostName: '',
309
312
  adapters: () => ({
310
- totalItems: 0,
311
- totalPages: 0,
313
+ total_items: 0,
314
+ total_pages: 0,
312
315
  items: [],
313
316
  }),
314
317
  freeAdapters: () => [],
315
318
  networksList: () => [],
316
319
  tcpStacks: () => [],
317
320
  tcpStackLoading: false,
321
+ diagramsData: [],
318
322
  }
319
323
  )
320
324
 
@@ -1,3 +1,5 @@
1
+ import type { UI_I_State, UI_I_ListIndex } from '~/lib/models/interfaces'
2
+ import { UI_E_Kind } from '~/lib/models/enums'
1
3
  import { UI_E_NetworkType } from './enums'
2
4
  import { UI_T_Adapters } from '~/components/common/diagramMain/lib/models/types'
3
5
  import {
@@ -15,19 +17,23 @@ export interface UI_I_Port {
15
17
  }
16
18
 
17
19
  export interface UI_I_Adapter {
18
- id: string
19
20
  name: string
21
+ id: string
20
22
  fullName: string
23
+ state: UI_I_State
21
24
  adapter: string
22
25
  pciAddress: string
23
26
  driver: string
24
- carrier: boolean
25
- speed: number
27
+ carrier?: boolean
28
+ speed?: number
26
29
  duplex: string
27
- networks: null
28
- srIov: boolean
29
- cdp: boolean
30
- lldp: boolean
30
+ networks: string[]
31
+ srIov?: boolean
32
+ cdp?: boolean
33
+ lldp?: boolean
34
+ managed?: boolean
35
+ switch?: string
36
+ mac: string
31
37
  status: string
32
38
  }
33
39
 
@@ -97,7 +103,6 @@ export interface UI_I_NetworkSummaryPortletListItem<
97
103
  initialValue: UI_I_OverrideValue<T>
98
104
  }
99
105
 
100
-
101
106
  export interface UI_I_NetworkInfo {
102
107
  average_bw: number
103
108
  burst_size: number
@@ -291,6 +296,7 @@ export interface UI_I_AdapterStatus {
291
296
  standby?: string[]
292
297
  unused?: string[]
293
298
  connected?: string[]
299
+ inherit?: boolean
294
300
  }
295
301
 
296
302
  export interface UI_I_SwitchPropertiesFields {
@@ -379,41 +385,42 @@ export interface UI_I_ModalsInitialData<T = string | number | boolean> {
379
385
 
380
386
  export interface UI_I_SwitchAdapterItem {
381
387
  name: string
388
+ id: string
389
+ fullName: string
390
+ state: UI_I_State
382
391
  adapter: string
383
392
  pciAddress: string
384
393
  driver: string
385
- carrier: boolean
386
- speed: number
394
+ carrier?: boolean
395
+ speed?: number
387
396
  duplex: string
388
- networks: null
389
- srIov: boolean
390
- cdp: boolean
391
- lldp: boolean
397
+ networks: string[]
398
+ srIov?: boolean
399
+ cdp?: boolean
400
+ lldp?: boolean
401
+ managed?: boolean
402
+ switch?: string
403
+ mac: string
392
404
  }
405
+
393
406
  export interface API_UI_I_SwitchAdapterItem {
394
- name: string
407
+ id: string
408
+ state: UI_I_State
409
+ index?: UI_I_ListIndex
395
410
  adapter: string
396
411
  pci_addr: string
397
412
  driver: string
398
- carrier: boolean
399
- speed: number
413
+ carrier?: boolean
414
+ speed?: number
400
415
  duplex: string
401
- networks: null
402
- sr_iov: boolean
403
- cdp: boolean
404
- lldp: boolean
405
- }
406
-
407
- export interface UI_I_SwitchAdapters {
408
- totalItems: number
409
- totalPages: number
410
- items: UI_I_SwitchAdapterItem[]
411
- }
412
-
413
- export interface API_UI_I_SwitchAdapters {
414
- total_items: number
415
- total_pages: number
416
- items: API_UI_I_SwitchAdapterItem[]
416
+ networks?: string[]
417
+ sr_iov?: boolean
418
+ cdp?: boolean
419
+ lldp?: boolean
420
+ managed?: boolean
421
+ name: string
422
+ switch?: string
423
+ mac: string
417
424
  }
418
425
 
419
426
  export interface UI_I_TeamingAndFailoverTemplate {
@@ -466,6 +473,10 @@ export interface API_UI_I_Security {
466
473
  forged_transmits: UI_E_IYNOption
467
474
  mac_change: UI_E_IYNOption
468
475
  promiscuous: UI_E_IYNOption
476
+ // TODO Question about those
477
+ promiscuous_computed?: UI_E_IYNOption
478
+ mac_change_computed?: UI_E_IYNOption
479
+ forged_transmits_computed?: UI_E_IYNOption
469
480
  }
470
481
  export interface API_UI_I_Shaping {
471
482
  enabled?: boolean
@@ -490,6 +501,11 @@ export interface API_UI_I_Teaming {
490
501
  link_detection_mode: UI_E_ICBLinkDetectionMode
491
502
  notify_switches: UI_E_IYNOption
492
503
  failback: UI_E_IYNOption
504
+ // TODO Question about those
505
+ mode_computed?: UI_E_IBSTLoadBalancingMode
506
+ link_detection_mode_computed?: UI_E_ICBLinkDetectionMode
507
+ notify_switches_computed?: UI_E_IYNOption
508
+ failback_computed?: UI_E_IYNOption
493
509
  }
494
510
 
495
511
  interface API_UI_I_ListIndex {
@@ -576,3 +592,38 @@ export interface UI_I_PortToggleFlag {
576
592
  value: boolean
577
593
  id: string
578
594
  }
595
+
596
+ // TODO today start
597
+ export interface API_UI_I_NetworkPortInfo {
598
+ id: string
599
+ name: string
600
+ mac: string
601
+ adapter: string
602
+ }
603
+
604
+ export interface API_UI_I_NetworkVMList {
605
+ id: string
606
+ name: string
607
+ ports: API_UI_I_NetworkPortInfo[]
608
+ is_active: boolean
609
+ }
610
+
611
+ export interface API_UI_I_Network {
612
+ id: string
613
+ name: string
614
+ state: UI_I_State
615
+ index: UI_I_ListIndex
616
+ vlan: number
617
+ net_bridge: string
618
+ kind: UI_E_Kind
619
+ switch: string // vswitch_name
620
+ vms_count: number // vms_amount
621
+ active_ports: number
622
+ nics_overrided: boolean
623
+ vm_list?: API_UI_I_NetworkVMList[]
624
+ sysx?: UI_I_Sysx
625
+ security: API_UI_I_Security
626
+ shaping: API_UI_I_Shaping
627
+ teaming: API_UI_I_Teaming
628
+ nics: UI_I_AdapterStatus
629
+ }
@@ -18,16 +18,16 @@ import {
18
18
  import { UI_T_Adapters } from '~/components/common/diagramMain/lib/models/types'
19
19
 
20
20
  export const hasPortAndNetwork = (
21
- selectedPort: UI_I_SelectedPort,
22
- id: string
21
+ selectedPort: UI_I_SelectedPort,
22
+ id: string
23
23
  ): boolean =>
24
- selectedPort.portId !== '-1' &&
25
- selectedPort.networkId !== '-1' &&
26
- selectedPort.networkId === id
24
+ selectedPort.portId !== '-1' &&
25
+ selectedPort.networkId !== '-1' &&
26
+ selectedPort.networkId === id
27
27
 
28
28
  export const networksPositions = (
29
- arr: number[],
30
- net: UI_I_NetworksWithPositions
29
+ arr: number[],
30
+ net: UI_I_NetworksWithPositions
31
31
  ): number[] => {
32
32
  if (net.ports.length === 0) return [...arr, net.connectLineY]
33
33
  if (!net.toggle) return [...arr, net.portsPosition + 7.5]
@@ -36,44 +36,44 @@ export const networksPositions = (
36
36
  ...arr,
37
37
  net.portsPosition + 22 + 7.5,
38
38
  net.networkType === UI_E_NetworkType.VCenter
39
- ? net.portsPosition + 22 + 12.5 + 32 * (net.portsCount - 1)
40
- : net.portsPosition + 22 + 7.5 + 22 * (net.portsCount - 1),
39
+ ? net.portsPosition + 22 + 12.5 + 32 * (net.portsCount - 1)
40
+ : net.portsPosition + 22 + 7.5 + 22 * (net.portsCount - 1),
41
41
  ]
42
42
  }
43
43
 
44
44
  export const getSelectedPortLinePositions = (
45
- selectedPortPosition: number | undefined,
46
- selectedNetworkData: UI_I_Network
45
+ selectedPortPosition: number | undefined,
46
+ selectedNetworkData: UI_I_Network
47
47
  ) =>
48
- selectedPortPosition
49
- ? selectedNetworkData.networkType === UI_E_NetworkType.VCenter
50
- ? selectedPortPosition + 12.5
51
- : selectedPortPosition + 7.5
52
- : 0
48
+ selectedPortPosition
49
+ ? selectedNetworkData.networkType === UI_E_NetworkType.VCenter
50
+ ? selectedPortPosition + 12.5
51
+ : selectedPortPosition + 7.5
52
+ : 0
53
53
 
54
54
  const selectedNetworkDataFunc = (
55
- networkId: string,
56
- networksWithPositions: UI_I_NetworksWithPositions[]
55
+ networkId: string,
56
+ networksWithPositions: UI_I_NetworksWithPositions[]
57
57
  ): UI_I_NetworksWithPositions | undefined =>
58
- networksWithPositions?.find(
59
- (network: UI_I_Network): boolean => network.id === networkId
60
- )
58
+ networksWithPositions?.find(
59
+ (network: UI_I_Network): boolean => network.id === networkId
60
+ )
61
61
 
62
62
  export const getSelectNetworkDataFunc = (
63
- networkId: string,
64
- networksWithPositions: UI_I_NetworksWithPositions[],
65
- adaptersWithPositions: UI_I_AdaptersWithPositions
63
+ networkId: string,
64
+ networksWithPositions: UI_I_NetworksWithPositions[],
65
+ adaptersWithPositions: UI_I_AdaptersWithPositions
66
66
  ): UI_I_SelectedSwitchPositions | undefined => {
67
67
  const selectedNetworkData: UI_I_NetworksWithPositions | undefined =
68
- selectedNetworkDataFunc(networkId, networksWithPositions)
68
+ selectedNetworkDataFunc(networkId, networksWithPositions)
69
69
 
70
70
  if (!selectedNetworkData) return
71
71
 
72
72
  const activeAdapters: string[] = selectedNetworkData.activeAdapters
73
73
  const adaptersPositions: number[] =
74
- adaptersWithPositions.adapters
75
- ?.filter((adapter: UI_T_Adapters) => activeAdapters?.includes(adapter.id))
76
- ?.map((adapter: UI_T_Adapters) => adapter.adapterPosition + 7.5) || []
74
+ adaptersWithPositions.adapters
75
+ ?.filter((adapter: UI_T_Adapters) => activeAdapters?.includes(adapter.id))
76
+ ?.map((adapter: UI_T_Adapters) => adapter.adapterPosition + 7.5) || []
77
77
  let selectedPositions: number[] = []
78
78
 
79
79
  if (!adaptersWithPositions.toggle) {
@@ -82,11 +82,11 @@ export const getSelectNetworkDataFunc = (
82
82
  selectedNetworkData.connectLineY,
83
83
  ]
84
84
  } else if (
85
- adaptersWithPositions.adapters === null ||
86
- adaptersWithPositions.adapters?.length === 0
85
+ adaptersWithPositions.adapters === null ||
86
+ adaptersWithPositions.adapters?.length === 0
87
87
  ) {
88
88
  selectedPositions = [47.5, selectedNetworkData.connectLineY].sort(
89
- (y1: number, y2: number) => y1 - y2
89
+ (y1: number, y2: number) => y1 - y2
90
90
  )
91
91
  } else {
92
92
  selectedPositions = [
@@ -109,28 +109,28 @@ export const getSelectNetworkDataFunc = (
109
109
  }
110
110
 
111
111
  export const getSelectPortDataFunc = (
112
- networkId: string,
113
- portId: string,
114
- networksWithPositions: UI_I_NetworksWithPositions[],
115
- adaptersWithPositions: UI_I_AdaptersWithPositions
112
+ networkId: string,
113
+ portId: string,
114
+ networksWithPositions: UI_I_NetworksWithPositions[],
115
+ adaptersWithPositions: UI_I_AdaptersWithPositions
116
116
  ): UI_I_SelectedSwitchPositions | undefined => {
117
117
  const selectedNetworkData: UI_I_NetworksWithPositions | undefined =
118
- selectedNetworkDataFunc(networkId, networksWithPositions)
118
+ selectedNetworkDataFunc(networkId, networksWithPositions)
119
119
 
120
120
  if (!selectedNetworkData) return
121
121
 
122
122
  const activeAdapters: string[] = selectedNetworkData.activeAdapters
123
123
  const adaptersPositions: number[] =
124
- adaptersWithPositions.adapters
125
- ?.filter((adapter: UI_T_Adapters) => activeAdapters?.includes(adapter.id))
126
- ?.map((adapter: UI_T_Adapters) => adapter.adapterPosition + 7.5) || []
124
+ adaptersWithPositions.adapters
125
+ ?.filter((adapter: UI_T_Adapters) => activeAdapters?.includes(adapter.id))
126
+ ?.map((adapter: UI_T_Adapters) => adapter.adapterPosition + 7.5) || []
127
127
  const selectedPortPosition: number | undefined =
128
- selectedNetworkData.ports.find(
129
- (el): boolean => el.id === portId
130
- )?.portPosition
128
+ selectedNetworkData.ports.find(
129
+ (el): boolean => el.id === portId
130
+ )?.portPosition
131
131
  const selectedPortLinePosition: number = getSelectedPortLinePositions(
132
- selectedPortPosition,
133
- selectedNetworkData
132
+ selectedPortPosition,
133
+ selectedNetworkData
134
134
  )
135
135
  let selectedPositions: number[] = []
136
136
 
@@ -142,7 +142,7 @@ export const getSelectPortDataFunc = (
142
142
  ]
143
143
  } else {
144
144
  selectedPositions = [...adaptersPositions, selectedPortLinePosition].sort(
145
- (y1: number, y2: number) => y1 - y2
145
+ (y1: number, y2: number) => y1 - y2
146
146
  )
147
147
  }
148
148
 
@@ -160,55 +160,55 @@ export const getSelectPortDataFunc = (
160
160
  }
161
161
 
162
162
  export const countAdaptersHeight = (
163
- diagramData: UI_I_DiagramData | null
163
+ diagramData: UI_I_DiagramData | null
164
164
  ): UI_I_AdaptersHeight => {
165
165
  const toggle: boolean = !!diagramData?.physicalAdapters?.toggle
166
166
  const adaptersCount: number =
167
- diagramData?.physicalAdapters?.adapters.length || 0
167
+ diagramData?.physicalAdapters?.adapters.length || 0
168
168
 
169
169
  return {
170
170
  height:
171
- UI_E_PositionsY.ADAPTER_FROM_RECT_TOP +
172
- (adaptersCount === 0
173
- ? UI_E_PositionsY.SINGLE_ADAPTER_HEIGHT
174
- : toggle
175
- ? adaptersCount * UI_E_PositionsY.SINGLE_ADAPTER_HEIGHT
176
- : 0) +
177
- UI_E_PositionsY.SPACE_FROM_RECT_BOTTOM,
171
+ UI_E_PositionsY.ADAPTER_FROM_RECT_TOP +
172
+ (adaptersCount === 0
173
+ ? UI_E_PositionsY.SINGLE_ADAPTER_HEIGHT
174
+ : toggle
175
+ ? adaptersCount * UI_E_PositionsY.SINGLE_ADAPTER_HEIGHT
176
+ : 0) +
177
+ UI_E_PositionsY.SPACE_FROM_RECT_BOTTOM,
178
178
  toggle,
179
179
  adaptersCount,
180
180
  }
181
181
  }
182
182
 
183
183
  export const getAdaptersPositions = (
184
- diagramData: UI_I_DiagramData | null,
185
- height: number
184
+ diagramData: UI_I_DiagramData | null,
185
+ height: number
186
186
  ): UI_I_AdaptersPositions => {
187
187
  const titlePosition: number =
188
- UI_E_PositionsY.DIAGRAM_TOP +
189
- UI_E_PositionsY.BETWEEN_RECTS +
190
- UI_E_PositionsY.TITLE_FROM_RECT_TOP
188
+ UI_E_PositionsY.DIAGRAM_TOP +
189
+ UI_E_PositionsY.BETWEEN_RECTS +
190
+ UI_E_PositionsY.TITLE_FROM_RECT_TOP
191
191
 
192
192
  const rectPosition: number =
193
- UI_E_PositionsY.DIAGRAM_TOP + UI_E_PositionsY.BETWEEN_RECTS
193
+ UI_E_PositionsY.DIAGRAM_TOP + UI_E_PositionsY.BETWEEN_RECTS
194
194
 
195
195
  const adaptersConnectLineY: number = rectPosition + height / 2
196
196
 
197
197
  const adapters: UI_T_Adapters[] | null =
198
- diagramData?.physicalAdapters?.adapters.map(
199
- (adapter: UI_I_Adapter, index: number) => {
200
- const adapterPosition: number =
201
- UI_E_PositionsY.DIAGRAM_TOP +
202
- UI_E_PositionsY.BETWEEN_RECTS +
203
- UI_E_PositionsY.ADAPTER_FROM_RECT_TOP +
204
- UI_E_PositionsY.SINGLE_ADAPTER_HEIGHT * index
205
-
206
- return {
207
- ...adapter,
208
- adapterPosition,
209
- }
210
- }
211
- ) || null
198
+ diagramData?.physicalAdapters?.adapters.map(
199
+ (adapter: UI_I_Adapter, index: number) => {
200
+ const adapterPosition: number =
201
+ UI_E_PositionsY.DIAGRAM_TOP +
202
+ UI_E_PositionsY.BETWEEN_RECTS +
203
+ UI_E_PositionsY.ADAPTER_FROM_RECT_TOP +
204
+ UI_E_PositionsY.SINGLE_ADAPTER_HEIGHT * index
205
+
206
+ return {
207
+ ...adapter,
208
+ adapterPosition,
209
+ }
210
+ }
211
+ ) || null
212
212
 
213
213
  return {
214
214
  titlePosition,
@@ -219,10 +219,10 @@ export const getAdaptersPositions = (
219
219
  }
220
220
 
221
221
  export const makeSwitchSendData = (
222
- data: UI_I_DiagramData,
223
- adapterStatus: UI_I_AdapterStatus
224
- ): API_UI_I_SwitchItem | void => {
225
- if(!data.networking) return
222
+ data: UI_I_DiagramData,
223
+ adapterStatus: UI_I_AdapterStatus
224
+ ): API_UI_I_SwitchItem | null => {
225
+ if (!data.networking) return null
226
226
 
227
227
  return {
228
228
  id: data.id,
@@ -49,12 +49,14 @@
49
49
  </template>
50
50
 
51
51
  <script setup lang="ts">
52
- import { UI_I_Localization } from '~/lib/models/interfaces'
52
+ import {
53
+ UI_I_Localization,
54
+ UI_I_ItemsWithTotalCounts,
55
+ } from '~/lib/models/interfaces'
53
56
  import {
54
57
  UI_I_Adapter,
55
58
  UI_I_AdapterStatus,
56
59
  UI_I_SwitchAdapterItem,
57
- UI_I_SwitchAdapters,
58
60
  } from '~/components/common/diagramMain/lib/models/interfaces'
59
61
 
60
62
  // Props from up
@@ -67,7 +69,7 @@ const props = withDefaults(
67
69
  height: string
68
70
  freeAdapters: UI_I_Adapter[]
69
71
  adapterStatus: UI_I_AdapterStatus
70
- adapters: UI_I_SwitchAdapters
72
+ adapters: UI_I_ItemsWithTotalCounts<UI_I_SwitchAdapterItem>
71
73
  initialAdapterStatus: UI_I_AdapterStatus
72
74
  isDarkMode?: boolean
73
75
  }>(),
@@ -92,10 +92,11 @@
92
92
  </template>
93
93
 
94
94
  <script setup lang="ts">
95
+ import { UI_I_ItemsWithTotalCounts } from '~/lib/models/interfaces'
95
96
  import {
96
97
  UI_I_AdapterStatus,
97
98
  UI_I_ModalsInitialData,
98
- UI_I_SwitchAdapters,
99
+ UI_I_SwitchAdapterItem,
99
100
  UI_I_SecurityFields,
100
101
  UI_I_TrafficShapingFields,
101
102
  UI_I_TeamingFailoverFields,
@@ -116,7 +117,7 @@ const props = withDefaults(
116
117
  text: string
117
118
  }[]
118
119
  initialData?: UI_I_ModalsInitialData
119
- adapters: UI_I_SwitchAdapters
120
+ adapters: UI_I_ItemsWithTotalCounts<UI_I_SwitchAdapterItem>
120
121
  flagSendData: boolean
121
122
  isDarkMode?: boolean
122
123
  }>(),
@@ -36,11 +36,14 @@
36
36
  </template>
37
37
 
38
38
  <script setup lang="ts">
39
- import { UI_I_Localization } from '~/lib/models/interfaces'
39
+ import {
40
+ UI_I_Localization,
41
+ UI_I_ItemsWithTotalCounts,
42
+ } from '~/lib/models/interfaces'
40
43
  import {
41
44
  UI_I_ModalsInitialData,
42
45
  UI_I_EditFieldsData,
43
- UI_I_SwitchAdapters,
46
+ UI_I_SwitchAdapterItem,
44
47
  } from '~/components/common/diagramMain/lib/models/interfaces'
45
48
 
46
49
  // Props from up
@@ -55,7 +58,7 @@ interface UI_I_PortViewSettingsModalProps {
55
58
  text: string
56
59
  }[]
57
60
  initialData?: UI_I_ModalsInitialData
58
- adapters?: UI_I_SwitchAdapters
61
+ adapters?: UI_I_ItemsWithTotalCounts<UI_I_SwitchAdapterItem>
59
62
  isDarkMode: boolean
60
63
  }
61
64
 
@@ -63,8 +66,8 @@ const props = withDefaults(defineProps<UI_I_PortViewSettingsModalProps>(), {
63
66
  initialData: () => ({}),
64
67
  title: 'Network',
65
68
  adapters: () => ({
66
- totalPages: 0,
67
- totalItems: 0,
69
+ total_pages: 0,
70
+ total_items: 0,
68
71
  items: [],
69
72
  }),
70
73
  })
@@ -93,10 +93,13 @@
93
93
  </template>
94
94
 
95
95
  <script setup lang="ts">
96
- import { UI_I_Localization } from '~/lib/models/interfaces'
96
+ import {
97
+ UI_I_Localization,
98
+ UI_I_ItemsWithTotalCounts,
99
+ } from '~/lib/models/interfaces'
97
100
  import {
98
101
  UI_I_TeamingFailoverFields,
99
- UI_I_SwitchAdapters,
102
+ UI_I_SwitchAdapterItem,
100
103
  UI_I_ModalsInitialData,
101
104
  UI_I_TeamingAndFailoverTemplate,
102
105
  UI_I_AdapterStatus,
@@ -112,7 +115,7 @@ import {
112
115
  const props = withDefaults(
113
116
  defineProps<{
114
117
  initialData?: UI_I_ModalsInitialData
115
- adapters: UI_I_SwitchAdapters
118
+ adapters: UI_I_ItemsWithTotalCounts<UI_I_SwitchAdapterItem>
116
119
  adapterStatus: UI_I_AdapterStatus
117
120
  isSwitch: boolean
118
121
  isDarkMode?: boolean
@@ -108,6 +108,7 @@
108
108
  import {
109
109
  UI_I_ArbitraryObject,
110
110
  UI_I_Localization,
111
+ UI_I_ItemsWithTotalCounts,
111
112
  } from '~/lib/models/interfaces'
112
113
  import { UI_T_Project } from '~/lib/models/types'
113
114
  import {
@@ -119,13 +120,15 @@ import {
119
120
  UI_I_ReadyCompleteFields,
120
121
  UI_I_AddNetworkingSecondOrThirdSchemeDataSend,
121
122
  UI_I_AddNetworkingZeroOrFirstSchemeDataSend,
123
+ UI_I_AddNetworkingFourthOrFifthSchemeDataSend,
122
124
  UI_I_AddNetworkingEmits,
123
125
  UI_I_TCPStack,
124
126
  } from '~/components/common/wizards/network/add/lib/models/interfaces'
125
127
  import {
126
128
  UI_I_Adapter,
127
129
  UI_I_AdapterStatus,
128
- UI_I_SwitchAdapters,
130
+ UI_I_SwitchAdapterItem,
131
+ UI_I_DiagramData,
129
132
  } from '~/components/common/diagramMain/lib/models/interfaces'
130
133
  import {
131
134
  UI_I_ValidationReturn,
@@ -149,7 +152,6 @@ import {
149
152
  addNetworkingSecondOrThirdSchemeDataFunc,
150
153
  addNetworkingFourthOrFifthSchemeDataFunc,
151
154
  } from '~/components/common/wizards/network/add/lib/config'
152
-
153
155
  import {
154
156
  checkTargetDeviceSync,
155
157
  checkAdaptersSync,
@@ -162,7 +164,7 @@ import {
162
164
  const props = withDefaults(
163
165
  defineProps<{
164
166
  show: boolean
165
- adapters: UI_I_SwitchAdapters
167
+ adapters: UI_I_ItemsWithTotalCounts<UI_I_SwitchAdapterItem>
166
168
  standardSwitchesInitial: UI_I_Switch[]
167
169
  freeAdapters: UI_I_Adapter[]
168
170
  project?: UI_T_Project
@@ -171,6 +173,7 @@ const props = withDefaults(
171
173
  selectedSwitchId?: string
172
174
  tcpStacks?: UI_I_TCPStack[]
173
175
  tcpStackLoading?: boolean
176
+ diagramsData?: UI_I_DiagramData[]
174
177
  }>(),
175
178
  {
176
179
  standardSwitchesInitial: () => [],
@@ -181,6 +184,7 @@ const props = withDefaults(
181
184
  selectedSwitchId: '',
182
185
  tcpStacks: () => [],
183
186
  tcpStackLoading: false,
187
+ diagramsData: [],
184
188
  }
185
189
  )
186
190
 
@@ -475,6 +479,7 @@ const checkFinal = async (): Promise<UI_I_ArbitraryObject<string>> => {
475
479
  let sendData:
476
480
  | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
477
481
  | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
482
+ | UI_I_AddNetworkingFourthOrFifthSchemeDataSend
478
483
 
479
484
  let type: 'network' | 'vmkernel'
480
485
 
@@ -512,6 +517,7 @@ const checkFinal = async (): Promise<UI_I_ArbitraryObject<string>> => {
512
517
  targetDevice.value.switch,
513
518
  wizard.isSelectedScheme(4),
514
519
  adapterStatus.value,
520
+ props.diagramsData,
515
521
  targetDevice.value.mtu
516
522
  )
517
523
 
@@ -723,6 +729,18 @@ const onSubmit = async (): Promise<void> => {
723
729
  )
724
730
  }
725
731
 
732
+ if (wizard.isSelectedScheme(4) || wizard.isSelectedScheme(5)) {
733
+ sendData = addNetworkingFourthOrFifthSchemeDataFunc(
734
+ targetDevice.value.switch,
735
+ wizard.isSelectedScheme(4),
736
+ adapterStatus.value,
737
+ props.diagramsData,
738
+ targetDevice.value.mtu
739
+ )
740
+
741
+ type = 'adapter'
742
+ }
743
+
726
744
  sendData &&
727
745
  emits(
728
746
  'send-add-networking-data',
@@ -6,41 +6,45 @@ import {
6
6
  UI_I_TargetDevice,
7
7
  UI_I_AddNetworkingSecondOrThirdSchemeDataSend,
8
8
  } from '~/components/common/wizards/network/add/lib/models/interfaces'
9
- import { UI_I_AdapterStatus } from '~/components/common/diagramMain/lib/models/interfaces'
9
+ import {
10
+ UI_I_AdapterStatus,
11
+ UI_I_DiagramData,
12
+ } from '~/components/common/diagramMain/lib/models/interfaces'
13
+ import { makeSwitchSendData } from '~/components/common/diagramMain/lib/utils/utils'
10
14
 
11
15
  export const addNetworkingSecondOrThirdSchemeDataFunc = (
12
- connectionSettings: UI_I_ConnectionSettings,
13
- targetDevice: UI_I_TargetDevice,
14
- vlan: number,
15
- isSecondScheme: boolean = false,
16
- adapterStatus?: UI_I_AdapterStatus
16
+ connectionSettings: UI_I_ConnectionSettings,
17
+ targetDevice: UI_I_TargetDevice,
18
+ vlan: number,
19
+ isSecondScheme: boolean = false,
20
+ adapterStatus?: UI_I_AdapterStatus
17
21
  ): UI_I_AddNetworkingSecondOrThirdSchemeDataSend =>
18
- isSecondScheme
19
- ? {
20
- vlan,
21
- name: connectionSettings.networkLabel,
22
- switch: targetDevice.standardSwitch,
23
- }
24
- : {
25
- vlan,
26
- name: connectionSettings.networkLabel,
27
- new_switch: {
28
- mtu: targetDevice.selected === '3' ? targetDevice.mtu : undefined,
29
- nics: {
30
- active: adapterStatus?.active || [],
31
- standby: adapterStatus?.standby || [],
32
- unused: adapterStatus?.unused || [],
22
+ isSecondScheme
23
+ ? {
24
+ vlan,
25
+ name: connectionSettings.networkLabel,
26
+ switch: targetDevice.standardSwitch,
27
+ }
28
+ : {
29
+ vlan,
30
+ name: connectionSettings.networkLabel,
31
+ new_switch: {
32
+ mtu: targetDevice.selected === '3' ? targetDevice.mtu : undefined,
33
+ nics: {
34
+ active: adapterStatus?.active || [],
35
+ standby: adapterStatus?.standby || [],
36
+ unused: adapterStatus?.unused || [],
37
+ },
33
38
  },
34
- },
35
- }
39
+ }
36
40
 
37
41
  export const addNetworkingZeroOrFirstSchemeDataFunc = (
38
- targetDevice: UI_I_TargetDevice,
39
- vlan: number,
40
- portProperties: UI_I_PortProperties,
41
- ipFourSettings: UI_I_IpFourSettings,
42
- isFirstScheme?: boolean,
43
- adapterStatus?: UI_I_AdapterStatus
42
+ targetDevice: UI_I_TargetDevice,
43
+ vlan: number,
44
+ portProperties: UI_I_PortProperties,
45
+ ipFourSettings: UI_I_IpFourSettings,
46
+ isFirstScheme?: boolean,
47
+ adapterStatus?: UI_I_AdapterStatus
44
48
  ): UI_I_AddNetworkingZeroOrFirstSchemeDataSend => {
45
49
  const sendData: UI_I_AddNetworkingZeroOrFirstSchemeDataSend = {
46
50
  switch: targetDevice.selected === '1' ? targetDevice.standardSwitch : '',
@@ -68,8 +72,8 @@ export const addNetworkingZeroOrFirstSchemeDataFunc = (
68
72
  net_mask: ipFourSettings.static.subnetMask,
69
73
  gateway_override: ipFourSettings.static.defaultGateway.override,
70
74
  gateway: ipFourSettings.static.defaultGateway.override
71
- ? ipFourSettings.static.defaultGateway.value
72
- : '',
75
+ ? ipFourSettings.static.defaultGateway.value
76
+ : '',
73
77
  },
74
78
  }
75
79
 
@@ -87,36 +91,45 @@ export const addNetworkingZeroOrFirstSchemeDataFunc = (
87
91
  const isAutoIp: boolean = ipFourSettings.ipSettings === '0'
88
92
 
89
93
  sendData.tcp_config = isAutoIp
90
- ? { auto: true }
91
- : {
94
+ ? { auto: true }
95
+ : {
92
96
  auto: false,
93
97
  ipv4: ipFourSettings.static.ipFourAddress,
94
98
  net_mask: ipFourSettings.static.subnetMask,
95
99
  gateway_override: ipFourSettings.static.defaultGateway.override,
96
100
  gateway: ipFourSettings.static.defaultGateway.override
97
- ? ipFourSettings.static.defaultGateway.value
98
- : '',
101
+ ? ipFourSettings.static.defaultGateway.value
102
+ : '',
99
103
  }
100
104
 
101
105
  return sendData
102
106
  }
103
107
 
104
108
  export const addNetworkingFourthOrFifthSchemeDataFunc = (
105
- switchId: string,
106
- isFourthScheme: boolean = false,
107
- adapterStatus: UI_I_AdapterStatus,
108
- mtu?: number
109
- ): any =>
110
- isFourthScheme
111
- ? {
112
- id: switchId,
113
- nics: {
114
- active: adapterStatus?.active || [],
115
- standby: adapterStatus?.standby || [],
116
- unused: adapterStatus?.unused || [],
117
- },
118
- }
119
- : {
109
+ switchId: string,
110
+ isFourthScheme: boolean = false,
111
+ adapterStatus: UI_I_AdapterStatus,
112
+ switchData: UI_I_DiagramData[] | null,
113
+ mtu?: number
114
+ ): any => {
115
+ let data: UI_I_DiagramData | null = null
116
+ if (switchData) {
117
+ data = switchData.find(
118
+ (d: UI_I_DiagramData) => d.diagramName === switchId
119
+ ) as UI_I_DiagramData
120
+ }
121
+
122
+ return isFourthScheme
123
+ ? makeSwitchSendData(data as UI_I_DiagramData, adapterStatus)
124
+ : // {
125
+ // id: switchId,
126
+ // nics: {
127
+ // active: adapterStatus?.active || [],
128
+ // standby: adapterStatus?.standby || [],
129
+ // unused: adapterStatus?.unused || [],
130
+ // },
131
+ // }
132
+ {
120
133
  mtu: mtu,
121
134
  nics: {
122
135
  active: adapterStatus?.active || [],
@@ -124,3 +137,4 @@ export const addNetworkingFourthOrFifthSchemeDataFunc = (
124
137
  unused: adapterStatus?.unused || [],
125
138
  },
126
139
  }
140
+ }
@@ -154,6 +154,19 @@ export interface UI_I_AddNetworkingSecondOrThirdSchemeDataSend {
154
154
  }
155
155
  }
156
156
 
157
+ export interface UI_I_AddNetworkingFourthOrFifthSchemeDataSend {
158
+ name: string
159
+ switch?: string | undefined
160
+ new_switch?: {
161
+ mtu: number | undefined
162
+ nics: {
163
+ active: string[]
164
+ standby: string[]
165
+ unused: string[]
166
+ }
167
+ }
168
+ }
169
+
157
170
  export interface UI_I_VlanIdData {
158
171
  text: string
159
172
  value: string
@@ -179,28 +192,30 @@ export interface UI_I_ReadyCompleteFirstColumn {
179
192
  export interface UI_I_AddNetworkingEmits {
180
193
  (event: 'hide'): void
181
194
  (
182
- event: 'add-networking-data-validate',
183
- networkData:
184
- | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
185
- | UI_I_AddNetworkingZeroOrFirstSchemeDataSend,
186
- type: string,
187
- setValidation: (err_arg: UI_I_ArbitraryObject<string>) => void
195
+ event: 'add-networking-data-validate',
196
+ networkData:
197
+ | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
198
+ | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
199
+ | UI_I_AddNetworkingFourthOrFifthSchemeDataSend,
200
+ type: string,
201
+ setValidation: (err_arg: UI_I_ArbitraryObject<string>) => void
188
202
  ): void
189
203
  (
190
- event: 'send-add-networking-data',
191
- schemeData:
192
- | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
193
- | UI_I_AddNetworkingZeroOrFirstSchemeDataSend,
194
- type: string,
195
- hideSendNetworkDataLoader: () => void,
196
- onHideAddNetworkingModal: () => void
204
+ event: 'send-add-networking-data',
205
+ schemeData:
206
+ | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
207
+ | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
208
+ | UI_I_AddNetworkingFourthOrFifthSchemeDataSend,
209
+ type: string,
210
+ hideSendNetworkDataLoader: () => void,
211
+ onHideAddNetworkingModal: () => void
197
212
  ): void
198
213
  (event: 'get-existing-standard-switches', cb: () => void): void
199
214
  (event: 'get-free-adapters', cb: () => void): void
200
215
  (
201
- event: 'check-network-label',
202
- networkLabel: string,
203
- cb: (error_message: string) => void
216
+ event: 'check-network-label',
217
+ networkLabel: string,
218
+ cb: (error_message: string) => void
204
219
  ): void
205
220
  (event: 'get-tcp-stacks'): void
206
221
  }
@@ -34,11 +34,14 @@
34
34
  </template>
35
35
 
36
36
  <script setup lang="ts">
37
- import { UI_I_Localization } from '~/lib/models/interfaces'
37
+ import {
38
+ UI_I_Localization,
39
+ UI_I_ItemsWithTotalCounts,
40
+ } from '~/lib/models/interfaces'
38
41
  import {
39
42
  UI_I_Adapter,
40
43
  UI_I_AdapterStatus,
41
- UI_I_SwitchAdapters,
44
+ UI_I_SwitchAdapterItem,
42
45
  } from '~/components/common/diagramMain/lib/models/interfaces'
43
46
 
44
47
  // Props from up
@@ -46,7 +49,7 @@ const props = defineProps<{
46
49
  addedAdapters: string[]
47
50
  freeAdapters: UI_I_Adapter[]
48
51
  adapterStatus: UI_I_AdapterStatus
49
- adapters: UI_I_SwitchAdapters
52
+ adapters: UI_I_ItemsWithTotalCounts<UI_I_SwitchAdapterItem>
50
53
  coreAdapters: string[]
51
54
  isShowNoConnectedActiveAdaptersModal: boolean
52
55
  isShowNoActiveAdaptersModal: boolean
@@ -32,7 +32,7 @@
32
32
  <div class="add-networking-radio-button-description">
33
33
  {{ localization.portGroupHandlesVirtualMachineTraffic }}
34
34
  </div>
35
- <div class="radio disabled-on-time">
35
+ <div class="radio">
36
36
  <input
37
37
  id="physical-adapter"
38
38
  type="radio"
@@ -44,7 +44,7 @@
44
44
  {{ localization.physicalNetworkAdapter }}
45
45
  </label>
46
46
  </div>
47
- <div class="add-networking-radio-button-description disabled-on-time">
47
+ <div class="add-networking-radio-button-description">
48
48
  {{ localization.physicalNetworkAdapterHandlesNetworkTraffic }}
49
49
  </div>
50
50
  </form>
@@ -21,8 +21,14 @@ export enum E_NodeIconsByState {
21
21
  }
22
22
 
23
23
  export enum UI_E_State {
24
- UNKNOWN = 0,
25
- OK = 1,
26
- WARNING = 2,
27
- ERROR = 3,
24
+ UNKNOWN,
25
+ OK,
26
+ WARNING,
27
+ ERROR,
28
+ }
29
+
30
+ export enum UI_E_Kind {
31
+ UNKNOWN,
32
+ NORMAL,
33
+ SYSTEM,
28
34
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.3.204",
4
+ "version": "1.3.206",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",