bfg-common 1.3.204 → 1.3.205
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/common/diagramMain/DiagramMain.vue +3 -0
- package/components/common/diagramMain/lib/utils/utils.ts +78 -78
- package/components/common/wizards/network/add/Add.vue +565 -548
- package/components/common/wizards/network/add/lib/config/sendData.ts +64 -50
- package/components/common/wizards/network/add/lib/models/interfaces.ts +31 -16
- package/components/common/wizards/network/add/steps/SelectConnectionType.vue +2 -2
- package/package.json +1 -1
|
@@ -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"
|
|
@@ -300,6 +301,7 @@ const props = withDefaults(
|
|
|
300
301
|
isDarkMode: boolean
|
|
301
302
|
tcpStacks?: UI_I_TCPStack[]
|
|
302
303
|
tcpStackLoading?: boolean
|
|
304
|
+
diagramsData?: UI_I_DiagramData[]
|
|
303
305
|
}>(),
|
|
304
306
|
{
|
|
305
307
|
diagramData: null,
|
|
@@ -315,6 +317,7 @@ const props = withDefaults(
|
|
|
315
317
|
networksList: () => [],
|
|
316
318
|
tcpStacks: () => [],
|
|
317
319
|
tcpStackLoading: false,
|
|
320
|
+
diagramsData: [],
|
|
318
321
|
}
|
|
319
322
|
)
|
|
320
323
|
|
|
@@ -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
|
-
|
|
22
|
-
|
|
21
|
+
selectedPort: UI_I_SelectedPort,
|
|
22
|
+
id: string
|
|
23
23
|
): boolean =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
selectedPort.portId !== '-1' &&
|
|
25
|
+
selectedPort.networkId !== '-1' &&
|
|
26
|
+
selectedPort.networkId === id
|
|
27
27
|
|
|
28
28
|
export const networksPositions = (
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
40
|
-
|
|
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
|
-
|
|
46
|
-
|
|
45
|
+
selectedPortPosition: number | undefined,
|
|
46
|
+
selectedNetworkData: UI_I_Network
|
|
47
47
|
) =>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
56
|
-
|
|
55
|
+
networkId: string,
|
|
56
|
+
networksWithPositions: UI_I_NetworksWithPositions[]
|
|
57
57
|
): UI_I_NetworksWithPositions | undefined =>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
networksWithPositions?.find(
|
|
59
|
+
(network: UI_I_Network): boolean => network.id === networkId
|
|
60
|
+
)
|
|
61
61
|
|
|
62
62
|
export const getSelectNetworkDataFunc = (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
86
|
-
|
|
85
|
+
adaptersWithPositions.adapters === null ||
|
|
86
|
+
adaptersWithPositions.adapters?.length === 0
|
|
87
87
|
) {
|
|
88
88
|
selectedPositions = [47.5, selectedNetworkData.connectLineY].sort(
|
|
89
|
-
|
|
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
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
-
|
|
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
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
selectedNetworkData.ports.find(
|
|
129
|
+
(el): boolean => el.id === portId
|
|
130
|
+
)?.portPosition
|
|
131
131
|
const selectedPortLinePosition: number = getSelectedPortLinePositions(
|
|
132
|
-
|
|
133
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
167
|
+
diagramData?.physicalAdapters?.adapters.length || 0
|
|
168
168
|
|
|
169
169
|
return {
|
|
170
170
|
height:
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
-
|
|
185
|
-
|
|
184
|
+
diagramData: UI_I_DiagramData | null,
|
|
185
|
+
height: number
|
|
186
186
|
): UI_I_AdaptersPositions => {
|
|
187
187
|
const titlePosition: number =
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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
|
-
|
|
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
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
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
|
-
|
|
223
|
-
|
|
224
|
-
): API_UI_I_SwitchItem |
|
|
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,
|