bfg-common 1.3.296 → 1.3.298

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.
@@ -11,14 +11,15 @@
11
11
  @click.capture="onClickDiagram"
12
12
  >
13
13
  <common-diagram-main-switch
14
- :networks-count="props.networksWithPositions.length"
14
+ :networks-count="networksCount"
15
15
  :main-rect-height="props.mainRectHeight"
16
16
  :main-switch-line="props.mainSwitchLine"
17
17
  :selected-main-line="props.selectedMainLine"
18
18
  :is-visible-line="hasActiveAdapter"
19
+ :is-selected-linked-with-adapter="isSelectedLinkedWithAdapter"
19
20
  />
20
21
  <common-diagram-main-adapter
21
- :networks-count="props.networksWithPositions.length"
22
+ :networks-count="networksCount"
22
23
  :adapters-with-positions="props.adaptersWithPositions"
23
24
  :selected-main-line="props.selectedMainLine"
24
25
  :selected-port="props.selectedPort"
@@ -27,6 +28,7 @@
27
28
  :is-visible-line="hasActiveAdapter"
28
29
  :is-dark-mode="props.isDarkMode"
29
30
  :test-id="props.diagramData.testId"
31
+ :is-selected-linked-with-adapter="isSelectedLinkedWithAdapter"
30
32
  @toggle-adapters="onToggleAdapters"
31
33
  @select-adapter="onSelectAdapter"
32
34
  @show-modal="onShowModal"
@@ -56,7 +58,7 @@
56
58
  <common-diagram-main-network-no-network v-else />
57
59
  <common-diagram-main-switch-selected
58
60
  :selected-switch-line-y="props.selectedSwitchLineY"
59
- :is-visible-line="hasActiveAdapter"
61
+ :is-visible-line="hasActiveAdapter && isSelectedLinkedWithAdapter"
60
62
  />
61
63
  </svg>
62
64
  </div>
@@ -143,6 +145,51 @@ const hasActiveAdapter = computed<boolean>(() => {
143
145
  ).length
144
146
  })
145
147
 
148
+ const isSelectedLinkedWithAdapter = computed<boolean>(() => {
149
+ if (props.selectedNetwork && props.selectedNetwork !== '-1') {
150
+ const selectedNetworkData = props.networksWithPositions.find(
151
+ (network: UI_I_NetworksWithPositions) =>
152
+ network.id === props.selectedNetwork
153
+ )
154
+
155
+ if (!selectedNetworkData) return false
156
+
157
+ return (
158
+ selectedNetworkData.activeAdapters.length > 0 &&
159
+ selectedNetworkData.state.state !== 3
160
+ )
161
+ }
162
+
163
+ if (props.selectedPort.portId && props.selectedPort.portId !== '-1') {
164
+ const selectedNetworkData = props.networksWithPositions.find(
165
+ (network: UI_I_NetworksWithPositions) =>
166
+ network.id === props.selectedPort.networkId
167
+ )
168
+
169
+ if (!selectedNetworkData) return false
170
+
171
+ return (
172
+ selectedNetworkData.activeAdapters.length > 0 &&
173
+ selectedNetworkData.state.state !== 3
174
+ )
175
+ }
176
+
177
+ if (props.selectedAdapter.adapterId !== '-1' || props.selectedMainLine) {
178
+ return true
179
+ }
180
+
181
+ return false
182
+ })
183
+
184
+ const networksCount = computed<number>(
185
+ () =>
186
+ props.networksWithPositions.filter(
187
+ (networkWithPositions: UI_I_NetworksWithPositions) =>
188
+ networkWithPositions.activeAdapters.length > 0 &&
189
+ networkWithPositions.state.state !== 3
190
+ ).length
191
+ )
192
+
146
193
  const onClickDiagram = (ev: MouseEvent) => emits('click-diagram', ev)
147
194
  const onToggleAdapters = () => emits('toggle-adapters')
148
195
  const onSelectAdapter = (adapterId: string) =>
@@ -256,7 +256,6 @@ import {
256
256
  UI_I_PortToggleFlag,
257
257
  UI_I_DiagramData,
258
258
  UI_I_SwitchAdapterItem,
259
- API_UI_I_SwitchItem,
260
259
  } from '~/components/common/diagramMain/lib/models/interfaces'
261
260
  import {
262
261
  UI_I_ArbitraryObject,
@@ -264,12 +263,10 @@ import {
264
263
  UI_I_ItemsWithTotalCounts,
265
264
  } from '~/lib/models/interfaces'
266
265
  import {
267
- UI_I_AddNetworkingSecondOrThirdSchemeDataSend,
268
- UI_I_AddNetworkingZeroOrFirstSchemeDataSend,
269
- UI_I_AddNetworkingFourthOrFifthSchemeDataSend,
270
266
  UI_I_Switch,
271
267
  UI_I_TCPStack,
272
268
  } from '~/components/common/wizards/network/add/lib/models/interfaces'
269
+ import { UI_T_EditData } from '~/components/common/wizards/network/add/lib/models/type'
273
270
  import {
274
271
  adapterViewSettingsFunc,
275
272
  adapterViewSettingsModalTabsFunc,
@@ -357,11 +354,7 @@ watch(
357
354
  )
358
355
 
359
356
  const onValidateBeforeSending = (
360
- data:
361
- | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
362
- | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
363
- | UI_I_AddNetworkingFourthOrFifthSchemeDataSend
364
- | API_UI_I_SwitchItem,
357
+ data: UI_T_EditData,
365
358
  type: string,
366
359
  setValidation: (messages: UI_I_ArbitraryObject<string>) => void
367
360
  ) => {
@@ -579,7 +572,6 @@ const onRemove = (id: string, type: string) => {
579
572
  : onHidePortRemoveModal
580
573
  emits('remove', id, type, hideModal)
581
574
  }
582
-
583
575
  const onChangeEditFieldsData = (newEditFieldsData: UI_I_EditFieldsData) => {
584
576
  emits('change-edit-fields-data', newEditFieldsData)
585
577
  }
@@ -599,11 +591,7 @@ const onGetFreeAdapters = (showModal: () => void) => {
599
591
  emits('get-free-adapters', showModal)
600
592
  }
601
593
  const onSendNetworkData = (
602
- data:
603
- | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
604
- | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
605
- | UI_I_AddNetworkingFourthOrFifthSchemeDataSend
606
- | API_UI_I_SwitchItem,
594
+ data: UI_T_EditData,
607
595
  type: string,
608
596
  hideModal: () => void
609
597
  ) => {
@@ -635,6 +623,7 @@ const selectedAdapter = ref<UI_I_SelectedAdapter>(
635
623
  useDeepCopy(selectedAdapterInitial)
636
624
  )
637
625
  const selectedNetwork = ref<string>('-1')
626
+
638
627
  const selectedSwitchLineY = ref<UI_I_SwitchLine>(
639
628
  useDeepCopy(selectedSwitchLineYInitial)
640
629
  )
@@ -650,6 +639,12 @@ const countNetworksPositions = (): UI_I_NetworksWithPositions[] => {
650
639
  let lastPosition = UI_E_PositionsY.DIAGRAM_TOP + UI_E_PositionsY.BETWEEN_RECTS
651
640
  mainRectHeights.value.networksHeight =
652
641
  UI_E_PositionsY.DIAGRAM_TOP + UI_E_PositionsY.BETWEEN_RECTS
642
+
643
+ const lastIndex = props.diagramData?.networks.findLastIndex(
644
+ (network: UI_I_Network) =>
645
+ network.activeAdapters.length > 0 && network.state.state !== 3
646
+ )
647
+
653
648
  return (
654
649
  props.diagramData?.networks?.map(
655
650
  (network: UI_I_Network, index: number, networks: UI_I_Network[]) => {
@@ -693,9 +688,9 @@ const countNetworksPositions = (): UI_I_NetworksWithPositions[] => {
693
688
  'Virtual Machines') ||
694
689
  ''
695
690
 
696
- index === 0 && (switchLine.value.y1 = connectLineY)
697
- networks &&
698
- index === networks.length - 1 &&
691
+ lastIndex !== -1 && index === 0 && (switchLine.value.y1 = connectLineY)
692
+ lastIndex !== -1 &&
693
+ index === lastIndex &&
699
694
  (switchLine.value.y2 = connectLineY)
700
695
 
701
696
  mainRectHeights.value.networksHeight +=
@@ -826,12 +821,12 @@ const onSelectNetwork = (networkId: string): void => {
826
821
 
827
822
  const onSelectAdapter = (adapterId: string): void => {
828
823
  const selectedNetworks: UI_I_NetworksWithPositions[] =
829
- networksWithPositions.value?.filter((network: UI_I_NetworksWithPositions) =>
830
- network.activeAdapters.includes(adapterId)
824
+ networksWithPositions.value?.filter(
825
+ (network: UI_I_NetworksWithPositions) =>
826
+ network.activeAdapters.includes(adapterId) && network.state.state !== 3
831
827
  )
832
828
 
833
829
  let pos: number[] = selectedNetworks?.reduce(networksPositions, [])
834
-
835
830
  let selectedAdapterPosition: number | null =
836
831
  adaptersWithPositions.value.adapters?.find((ad) => ad.id === adapterId)
837
832
  ?.adapterPosition || null
@@ -879,21 +874,13 @@ const emits = defineEmits<{
879
874
  (event: 'get-existing-standard-switches'): void
880
875
  (
881
876
  event: 'send-add-networking-data',
882
- data:
883
- | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
884
- | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
885
- | UI_I_AddNetworkingFourthOrFifthSchemeDataSend
886
- | API_UI_I_SwitchItem,
877
+ data: UI_T_EditData,
887
878
  type: string,
888
879
  hideModal: () => void
889
880
  ): void
890
881
  (
891
882
  event: 'add-networking-data-validate',
892
- data:
893
- | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
894
- | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
895
- | UI_I_AddNetworkingFourthOrFifthSchemeDataSend
896
- | API_UI_I_SwitchItem,
883
+ data: UI_T_EditData,
897
884
  type: string,
898
885
  setValidation: (message: UI_I_ArbitraryObject<string>) => void
899
886
  ): void
@@ -941,12 +928,9 @@ const onTogglePorts = (
941
928
  const handlePortToggle = () => {
942
929
  selectedPort.value.portId !== '-1' &&
943
930
  onSelectPort(selectedPort.value.networkId, selectedPort.value.portId)
944
-
945
931
  selectedAdapter.value.adapterId !== '-1' &&
946
932
  onSelectAdapter(selectedAdapter.value.adapterId)
947
-
948
933
  selectedNetwork.value !== '-1' && onSelectNetwork(selectedNetwork.value)
949
-
950
934
  hasPortAndNetwork(selectedPort.value, isPortToggled.value.id) &&
951
935
  resetSelection()
952
936
 
@@ -958,7 +942,6 @@ const handlePortToggle = () => {
958
942
 
959
943
  const onToggleAdapters = (): void => {
960
944
  const newState = !adaptersWithPositions.value.toggle
961
-
962
945
  const payload: Omit<UI_I_ToggleDiagramAdaptersPayload, 'paths'> = {
963
946
  isToggle: newState,
964
947
  diagramId: props.diagramData?.id || '',
@@ -968,9 +951,7 @@ const onToggleAdapters = (): void => {
968
951
 
969
952
  selectedPort.value.portId !== '-1' &&
970
953
  onSelectPort(selectedPort.value.networkId, selectedPort.value.portId)
971
-
972
954
  selectedAdapter.value.adapterId !== '-1' && resetSelection()
973
-
974
955
  selectedNetwork.value !== '-1' && onSelectNetwork(selectedNetwork.value)
975
956
  }
976
957
 
@@ -1001,8 +982,6 @@ const onClickDiagram = (ev: MouseEvent): void => {
1001
982
  </style>
1002
983
  <style lang="scss">
1003
984
  .diagram-main-actions__popup.navbar-dropdown-menu {
1004
- //transform: translate(-40px, -10px);
1005
- //width: 360px;
1006
985
  .btn {
1007
986
  border-radius: 3px;
1008
987
  border-bottom: none;
@@ -53,6 +53,7 @@ const props = defineProps<{
53
53
  selectedPort: UI_I_SelectedPort
54
54
  selectedAdapter: UI_I_SelectedAdapter
55
55
  selectedNetwork: string
56
+ isSelectedLinkedWithAdapter: boolean
56
57
  isVisibleLine: boolean
57
58
  networksCount: number
58
59
  isDarkMode: boolean
@@ -77,6 +78,7 @@ const isHighlightedOptimizePart = computed(
77
78
 
78
79
  const isHighlightedAdapterLine = computed<boolean>(
79
80
  () =>
81
+ props.isSelectedLinkedWithAdapter &&
80
82
  !(
81
83
  isHighlightedOptimizePart.value &&
82
84
  !hasNoAdaptersAndNoSelectedNetwork.value
@@ -85,6 +87,7 @@ const isHighlightedAdapterLine = computed<boolean>(
85
87
 
86
88
  const isHighlightedClosedAdapterBlock = computed<boolean>(
87
89
  () =>
90
+ props.isSelectedLinkedWithAdapter &&
88
91
  !(
89
92
  isHighlightedOptimizePart.value &&
90
93
  !(hasNoAdaptersAndNoSelectedNetwork.value && props.isVisibleLine)
@@ -55,17 +55,9 @@ export const mode: UI_T_LoadBalancingMode[] = [
55
55
  'balance-tcp',
56
56
  ]
57
57
 
58
- export const iyn: UI_T_IYN[] = [
59
- 'inherit',
60
- 'yes',
61
- 'no',
62
- ]
58
+ export const iyn: UI_T_IYN[] = ['inherit', 'yes', 'no']
63
59
 
64
- export const carier: UI_T_Carier[] = [
65
- 'inherit',
66
- 'carier',
67
- 'beakon',
68
- ]
60
+ export const carier: UI_T_Carier[] = ['inherit', 'carier', 'beakon']
69
61
 
70
62
  export const {
71
63
  managePhysicalAdapterStatusInitial,
@@ -74,4 +66,5 @@ export const {
74
66
  selectedPortInitial,
75
67
  selectedAdapterInitial,
76
68
  selectedSwitchLineYInitial,
69
+ NETWORK_POSITIONS,
77
70
  } = initial
@@ -1,7 +1,10 @@
1
1
  import {
2
2
  UI_I_AdapterStatus,
3
- UI_I_MainRectHeights, UI_I_SelectedAdapter, UI_I_SelectedPort,
4
- UI_I_SwitchLine
3
+ UI_I_MainRectHeights,
4
+ UI_I_SelectedAdapter,
5
+ UI_I_SelectedPort,
6
+ UI_I_SwitchLine,
7
+ UI_I_NetworkPositionsConst,
5
8
  } from '~/components/common/diagramMain/lib/models/interfaces'
6
9
 
7
10
  export const managePhysicalAdapterStatusInitial: UI_I_AdapterStatus = {
@@ -36,3 +39,12 @@ export const selectedSwitchLineYInitial: UI_I_SwitchLine = {
36
39
  y1: 0,
37
40
  y2: 0,
38
41
  }
42
+
43
+ export const NETWORK_POSITIONS: UI_I_NetworkPositionsConst = {
44
+ EMPTY_PORTS_PADDING_BOTTOM: 7.5,
45
+ FROM_VLAN_ID_TO_GROUP_NAME: 22,
46
+ VMS_AND_PORTS_HEIGHT: 22,
47
+ V_CENTER_HEIGHT: 32,
48
+ BETWEEN_VMS_AND_PORTS: 7.5,
49
+ BETWEEN_V_CENTERS: 12.5,
50
+ } as const
@@ -7,6 +7,7 @@ import {
7
7
  UI_E_ICBLinkDetectionMode,
8
8
  UI_E_IBSTLoadBalancingMode,
9
9
  } from '~/components/common/diagramMain/lib/models/enums'
10
+ import { NETWORK_POSITIONS } from '#build/components/common/diagramMain/lib/config/initial'
10
11
 
11
12
  export interface UI_I_Port {
12
13
  id: string
@@ -147,6 +148,25 @@ export interface UI_I_Network extends UI_I_NetworkInfo {
147
148
  unusedAdapters?: string[]
148
149
  vlanId?: number | string
149
150
  testId: string
151
+ state: {
152
+ state: UI_E_State
153
+ errors?: string[]
154
+ }
155
+ }
156
+
157
+ export interface UI_I_NetworkWithError {
158
+ id: string
159
+ networkType: UI_E_NetworkType
160
+ ports?: UI_I_Port[]
161
+ sysx?: UI_I_Sysx
162
+ switchName: string
163
+ title: string
164
+ toggle: boolean
165
+ testId: string
166
+ state: {
167
+ state: UI_E_State
168
+ errors?: string[]
169
+ }
150
170
  }
151
171
 
152
172
  export interface UI_I_SwitchInfo extends UI_I_NetworkInfo {
@@ -694,3 +714,12 @@ export interface API_UI_I_Network {
694
714
  teaming: API_UI_I_Teaming
695
715
  nics: UI_I_AdapterStatus
696
716
  }
717
+
718
+ export interface UI_I_NetworkPositionsConst {
719
+ readonly EMPTY_PORTS_PADDING_BOTTOM: 7.5
720
+ readonly FROM_VLAN_ID_TO_GROUP_NAME: 22
721
+ readonly VMS_AND_PORTS_HEIGHT: 22
722
+ readonly V_CENTER_HEIGHT: 32
723
+ readonly BETWEEN_VMS_AND_PORTS: 7.5
724
+ readonly BETWEEN_V_CENTERS: 12.5
725
+ }
@@ -16,64 +16,91 @@ import {
16
16
  UI_E_PositionsY,
17
17
  } from '~/components/common/diagramMain/lib/models/enums'
18
18
  import { UI_T_Adapters } from '~/components/common/diagramMain/lib/models/types'
19
+ import { NETWORK_POSITIONS } from '~/components/common/diagramMain/lib/config'
19
20
 
20
21
  export const hasPortAndNetwork = (
21
- selectedPort: UI_I_SelectedPort,
22
- id: string
22
+ selectedPort: UI_I_SelectedPort,
23
+ id: string
23
24
  ): boolean =>
24
- selectedPort.portId !== '-1' &&
25
- selectedPort.networkId !== '-1' &&
26
- selectedPort.networkId === id
25
+ selectedPort.portId !== '-1' &&
26
+ selectedPort.networkId !== '-1' &&
27
+ selectedPort.networkId === id
27
28
 
28
29
  export const networksPositions = (
29
- arr: number[],
30
- net: UI_I_NetworksWithPositions
30
+ arr: number[],
31
+ net: UI_I_NetworksWithPositions
31
32
  ): number[] => {
32
33
  if (net.ports.length === 0) return [...arr, net.connectLineY]
33
- if (!net.toggle) return [...arr, net.portsPosition + 7.5]
34
+ if (!net.toggle)
35
+ return [
36
+ ...arr,
37
+ net.portsPosition + NETWORK_POSITIONS.EMPTY_PORTS_PADDING_BOTTOM,
38
+ ]
34
39
 
35
40
  return [
36
41
  ...arr,
37
- net.portsPosition + 22 + 7.5,
42
+ net.portsPosition +
43
+ NETWORK_POSITIONS.FROM_VLAN_ID_TO_GROUP_NAME +
44
+ NETWORK_POSITIONS.BETWEEN_VMS_AND_PORTS,
38
45
  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),
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),
41
54
  ]
42
55
  }
43
56
 
44
57
  export const getSelectedPortLinePositions = (
45
- selectedPortPosition: number | undefined,
46
- selectedNetworkData: UI_I_Network
58
+ selectedPortPosition: number | undefined,
59
+ selectedNetworkData: UI_I_Network
47
60
  ) =>
48
- selectedPortPosition
49
- ? selectedNetworkData.networkType === UI_E_NetworkType.VCenter
50
- ? selectedPortPosition + 12.5
51
- : selectedPortPosition + 7.5
52
- : 0
61
+ selectedPortPosition
62
+ ? selectedNetworkData.networkType === UI_E_NetworkType.VCenter
63
+ ? selectedPortPosition + 12.5
64
+ : selectedPortPosition + 7.5
65
+ : 0
53
66
 
54
67
  const selectedNetworkDataFunc = (
55
- networkId: string,
56
- networksWithPositions: UI_I_NetworksWithPositions[]
68
+ networkId: string,
69
+ networksWithPositions: UI_I_NetworksWithPositions[]
57
70
  ): UI_I_NetworksWithPositions | undefined =>
58
- networksWithPositions?.find(
59
- (network: UI_I_Network): boolean => network.id === networkId
60
- )
71
+ networksWithPositions?.find(
72
+ (network: UI_I_Network): boolean => network.id === networkId
73
+ )
61
74
 
62
75
  export const getSelectNetworkDataFunc = (
63
- networkId: string,
64
- networksWithPositions: UI_I_NetworksWithPositions[],
65
- adaptersWithPositions: UI_I_AdaptersWithPositions
76
+ networkId: string,
77
+ networksWithPositions: UI_I_NetworksWithPositions[],
78
+ adaptersWithPositions: UI_I_AdaptersWithPositions
66
79
  ): UI_I_SelectedSwitchPositions | undefined => {
67
80
  const selectedNetworkData: UI_I_NetworksWithPositions | undefined =
68
- selectedNetworkDataFunc(networkId, networksWithPositions)
81
+ selectedNetworkDataFunc(networkId, networksWithPositions)
69
82
 
70
83
  if (!selectedNetworkData) return
71
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
+
72
98
  const activeAdapters: string[] = selectedNetworkData.activeAdapters
99
+
73
100
  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) || []
101
+ adaptersWithPositions.adapters
102
+ ?.filter((adapter: UI_T_Adapters) => activeAdapters?.includes(adapter.id))
103
+ ?.map((adapter: UI_T_Adapters) => adapter.adapterPosition + 7.5) || []
77
104
  let selectedPositions: number[] = []
78
105
 
79
106
  if (!adaptersWithPositions.toggle) {
@@ -82,11 +109,11 @@ export const getSelectNetworkDataFunc = (
82
109
  selectedNetworkData.connectLineY,
83
110
  ]
84
111
  } else if (
85
- adaptersWithPositions.adapters === null ||
86
- adaptersWithPositions.adapters?.length === 0
112
+ adaptersWithPositions.adapters === null ||
113
+ adaptersWithPositions.adapters?.length === 0
87
114
  ) {
88
115
  selectedPositions = [47.5, selectedNetworkData.connectLineY].sort(
89
- (y1: number, y2: number) => y1 - y2
116
+ (y1: number, y2: number) => y1 - y2
90
117
  )
91
118
  } else {
92
119
  selectedPositions = [
@@ -109,28 +136,28 @@ export const getSelectNetworkDataFunc = (
109
136
  }
110
137
 
111
138
  export const getSelectPortDataFunc = (
112
- networkId: string,
113
- portId: string,
114
- networksWithPositions: UI_I_NetworksWithPositions[],
115
- adaptersWithPositions: UI_I_AdaptersWithPositions
139
+ networkId: string,
140
+ portId: string,
141
+ networksWithPositions: UI_I_NetworksWithPositions[],
142
+ adaptersWithPositions: UI_I_AdaptersWithPositions
116
143
  ): UI_I_SelectedSwitchPositions | undefined => {
117
144
  const selectedNetworkData: UI_I_NetworksWithPositions | undefined =
118
- selectedNetworkDataFunc(networkId, networksWithPositions)
145
+ selectedNetworkDataFunc(networkId, networksWithPositions)
119
146
 
120
147
  if (!selectedNetworkData) return
121
148
 
122
149
  const activeAdapters: string[] = selectedNetworkData.activeAdapters
123
150
  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) || []
151
+ adaptersWithPositions.adapters
152
+ ?.filter((adapter: UI_T_Adapters) => activeAdapters?.includes(adapter.id))
153
+ ?.map((adapter: UI_T_Adapters) => adapter.adapterPosition + 7.5) || []
127
154
  const selectedPortPosition: number | undefined =
128
- selectedNetworkData.ports.find(
129
- (el): boolean => el.id === portId
130
- )?.portPosition
155
+ selectedNetworkData.ports.find(
156
+ (el): boolean => el.id === portId
157
+ )?.portPosition
131
158
  const selectedPortLinePosition: number = getSelectedPortLinePositions(
132
- selectedPortPosition,
133
- selectedNetworkData
159
+ selectedPortPosition,
160
+ selectedNetworkData
134
161
  )
135
162
  let selectedPositions: number[] = []
136
163
 
@@ -142,7 +169,7 @@ export const getSelectPortDataFunc = (
142
169
  ]
143
170
  } else {
144
171
  selectedPositions = [...adaptersPositions, selectedPortLinePosition].sort(
145
- (y1: number, y2: number) => y1 - y2
172
+ (y1: number, y2: number) => y1 - y2
146
173
  )
147
174
  }
148
175
 
@@ -160,55 +187,55 @@ export const getSelectPortDataFunc = (
160
187
  }
161
188
 
162
189
  export const countAdaptersHeight = (
163
- diagramData: UI_I_DiagramData | null
190
+ diagramData: UI_I_DiagramData | null
164
191
  ): UI_I_AdaptersHeight => {
165
192
  const toggle: boolean = !!diagramData?.physicalAdapters?.toggle
166
193
  const adaptersCount: number =
167
- diagramData?.physicalAdapters?.adapters.length || 0
194
+ diagramData?.physicalAdapters?.adapters.length || 0
168
195
 
169
196
  return {
170
197
  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,
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,
178
205
  toggle,
179
206
  adaptersCount,
180
207
  }
181
208
  }
182
209
 
183
210
  export const getAdaptersPositions = (
184
- diagramData: UI_I_DiagramData | null,
185
- height: number
211
+ diagramData: UI_I_DiagramData | null,
212
+ height: number
186
213
  ): UI_I_AdaptersPositions => {
187
214
  const titlePosition: number =
188
- UI_E_PositionsY.DIAGRAM_TOP +
189
- UI_E_PositionsY.BETWEEN_RECTS +
190
- UI_E_PositionsY.TITLE_FROM_RECT_TOP
215
+ UI_E_PositionsY.DIAGRAM_TOP +
216
+ UI_E_PositionsY.BETWEEN_RECTS +
217
+ UI_E_PositionsY.TITLE_FROM_RECT_TOP
191
218
 
192
219
  const rectPosition: number =
193
- UI_E_PositionsY.DIAGRAM_TOP + UI_E_PositionsY.BETWEEN_RECTS
220
+ UI_E_PositionsY.DIAGRAM_TOP + UI_E_PositionsY.BETWEEN_RECTS
194
221
 
195
222
  const adaptersConnectLineY: number = rectPosition + height / 2
196
223
 
197
224
  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
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
212
239
 
213
240
  return {
214
241
  titlePosition,
@@ -219,8 +246,8 @@ export const getAdaptersPositions = (
219
246
  }
220
247
 
221
248
  export const makeSwitchSendData = (
222
- data: UI_I_DiagramData,
223
- adapterStatus: UI_I_AdapterStatus
249
+ data: UI_I_DiagramData,
250
+ adapterStatus: UI_I_AdapterStatus
224
251
  ): API_UI_I_SwitchItem | null => {
225
252
  if (!data.networking) return null
226
253
 
@@ -237,36 +237,36 @@ export const networkPopupFieldsFunc = (
237
237
  localization: UI_I_Localization,
238
238
  _networkType: string,
239
239
  testId: string,
240
+ state: number,
240
241
  inPortlet = false
241
242
  ) => {
242
- const inPortletConfig = [
243
- {
244
- text: localization.viewSettings,
245
- value: 'network-view-settings',
246
- testId: `${testId}-view`,
247
- },
248
- // {
249
- // text: localization.editSettings,
250
- // value: 'network-edit-settings',
251
- // },
252
- ]
253
- const notInPortletConfig = [
254
- ...inPortletConfig,
255
- {
256
- text: localization.editSettings,
257
- value: 'network-edit-settings',
258
- testId: `${testId}-edit`,
259
- },
260
- { separate: true },
261
- {
262
- text: localization.remove,
263
- value: 'network-port-remove',
264
- testId: `${testId}-remove`,
265
- // networkType === '1' ? 'network-vkernel-remove' : 'network-port-remove',
266
- },
267
- ]
243
+ const view = {
244
+ text: localization.viewSettings,
245
+ value: 'network-view-settings',
246
+ testId: `${testId}-view`,
247
+ }
248
+ const edit = {
249
+ text: localization.editSettings,
250
+ value: 'network-edit-settings',
251
+ testId: `${testId}-edit`,
252
+ }
253
+ const remove = {
254
+ text: localization.remove,
255
+ value: 'network-port-remove',
256
+ testId: `${testId}-remove`,
257
+ // networkType === '1' ? 'network-vkernel-remove' : 'network-port-remove',
258
+ }
268
259
 
269
- return inPortlet ? inPortletConfig : notInPortletConfig
260
+ const inPortletConfig = [view]
261
+
262
+ const notInPortletConfig = [view, edit, { separate: true }, remove]
263
+ const notInPortletErrorConfig = [remove]
264
+
265
+ if (inPortlet) {
266
+ return state === 3 ? [] : inPortletConfig
267
+ } else {
268
+ return state === 3 ? notInPortletErrorConfig : notInPortletConfig
269
+ }
270
270
  }
271
271
 
272
272
  export const teamingAndFailoverTemplateMakerFunc = (
@@ -24,7 +24,8 @@
24
24
  :height="props.network.networkHeight"
25
25
  :y="props.network.rectPosition"
26
26
  :hide="
27
- !props.selectedMainLine && !props.isNetworkConnectedSelectedAdapter
27
+ props.isCantBeHighlighted ||
28
+ (!props.selectedMainLine && !props.isNetworkConnectedSelectedAdapter)
28
29
  "
29
30
  />
30
31
  </g>
@@ -38,6 +39,7 @@ const props = defineProps<{
38
39
  selectedNetwork: string
39
40
  selectedMainLine: boolean
40
41
  isNetworkConnectedSelectedAdapter: boolean
42
+ isCantBeHighlighted: boolean
41
43
  }>()
42
44
  </script>
43
45
 
@@ -7,7 +7,13 @@
7
7
  x="26"
8
8
  :y="props.network.titlePosition"
9
9
  >
10
- <div class="vsphere-icon-network"></div>
10
+ <atoms-the-icon
11
+ v-if="props.network.state.state === 3"
12
+ name="error-outline"
13
+ width="15"
14
+ height="15"
15
+ />
16
+ <div v-else class="vsphere-icon-network"></div>
11
17
  </foreignObject>
12
18
 
13
19
  <a
@@ -107,6 +113,7 @@
107
113
  </foreignObject>
108
114
 
109
115
  <text
116
+ v-if="props.network.state.state !== 3"
110
117
  data-title="ports-main-text"
111
118
  dy="11px"
112
119
  font-size="13"
@@ -117,6 +124,21 @@
117
124
  >
118
125
  {{ props.network.networkPortsName }} ({{ props.network.portsCount }})
119
126
  </text>
127
+ <foreignObject
128
+ v-else
129
+ dy="11px"
130
+ font-size="13"
131
+ font-weight="400"
132
+ x="26"
133
+ height="20"
134
+ width="246"
135
+ :y="props.network.portsPosition - 5"
136
+ class="port-group-header"
137
+ >
138
+ <span class="error-text text-ellipsis" :title="errorText">
139
+ {{ errorText }}
140
+ </span>
141
+ </foreignObject>
120
142
 
121
143
  <common-diagram-main-highlights
122
144
  data-title="ports-closed"
@@ -169,6 +191,7 @@ const networkPopupFields = computed(() =>
169
191
  localization.value,
170
192
  props.network.networkType,
171
193
  props.network.testId,
194
+ props.network.state.state,
172
195
  props.inPortlet
173
196
  )
174
197
  )
@@ -195,6 +218,13 @@ const networkTitlePosition = computed<number>(
195
218
  () => props.network.titlePosition - 5
196
219
  )
197
220
 
221
+ const errorText = computed<string>(() =>
222
+ props.network.state.state === 3
223
+ ? props.network.state?.errors?.join(', ') ||
224
+ localization.value.somethingWentWrong
225
+ : ''
226
+ )
227
+
198
228
  const onSelectNetwork = (networkId: string): void => {
199
229
  emits('select-network', networkId)
200
230
  }
@@ -231,6 +261,15 @@ const onTogglePorts = (
231
261
  text-decoration: solid underline #c1cdd4 2px;
232
262
  }
233
263
  }
264
+
265
+ .error-text {
266
+ color: #e02200;
267
+
268
+ &:hover {
269
+ color: #e02200;
270
+ text-decoration: unset;
271
+ }
272
+ }
234
273
  }
235
274
 
236
275
  .diagram {
@@ -287,4 +326,16 @@ const onTogglePorts = (
287
326
  text-decoration: solid underline #565656 2px;
288
327
  }
289
328
  }
329
+
330
+ .error-text {
331
+ font-weight: 400;
332
+ font-size: 12px;
333
+ max-width: 246px;
334
+ color: #e02200;
335
+
336
+ &:hover {
337
+ color: #e02200;
338
+ text-decoration: unset;
339
+ }
340
+ }
290
341
  </style>
@@ -1,5 +1,10 @@
1
1
  <template>
2
- <g data-title="network-lines-group">
2
+ <g
3
+ v-if="
4
+ props.network.activeAdapters.length > 0 && props.network.state.state !== 3
5
+ "
6
+ data-title="network-lines-group"
7
+ >
3
8
  <line
4
9
  data-title="network-line"
5
10
  x1="332.5"
@@ -4,6 +4,7 @@
4
4
  :network="props.network"
5
5
  :selected-network="props.selectedNetwork"
6
6
  :selected-main-line="props.selectedMainLine"
7
+ :is-cant-be-highlighted="isCantBeHighlighted"
7
8
  :is-network-connected-selected-adapter="isNetworkConnectedSelectedAdapter"
8
9
  />
9
10
 
@@ -20,6 +21,7 @@
20
21
  :selected-main-line="props.selectedMainLine"
21
22
  :network-rect-bottom-position="networkRectBottomPosition"
22
23
  :is-network-connected-selected-adapter="isNetworkConnectedSelectedAdapter"
24
+ :is-cant-be-highlighted="isCantBeHighlighted"
23
25
  />
24
26
 
25
27
  <common-diagram-main-network-contents
@@ -88,6 +90,11 @@ const networkRectBottomPosition = computed<number>(
88
90
  () => props.network.rectPosition + props.network.networkHeight
89
91
  )
90
92
 
93
+ const isCantBeHighlighted = computed<boolean>(
94
+ () =>
95
+ props.network.state.state === 3 || props.network.activeAdapters.length === 0
96
+ )
97
+
91
98
  const emits = defineEmits<{
92
99
  (event: 'select-port', networkId: string, portId: string): void
93
100
  (event: 'select-network', networkId: string): void
@@ -12,7 +12,8 @@
12
12
  type="second-orange"
13
13
  :d="`M 313.5 ${props.network.rectPosition} H 333.5 V ${props.networkRectBottomPosition} H 313.5`"
14
14
  :hide="
15
- !props.selectedMainLine && !props.isNetworkConnectedSelectedAdapter
15
+ props.isCantBeHighlighted ||
16
+ (!props.selectedMainLine && !props.isNetworkConnectedSelectedAdapter)
16
17
  "
17
18
  />
18
19
 
@@ -34,6 +35,7 @@ const props = defineProps<{
34
35
  selectedNetwork: string
35
36
  networkRectBottomPosition: number
36
37
  isNetworkConnectedSelectedAdapter: boolean
38
+ isCantBeHighlighted: boolean
37
39
  }>()
38
40
  </script>
39
41
 
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <g>
3
3
  <line
4
- v-if="isVisibleLine"
4
+ v-if="props.isVisibleLine"
5
5
  x1="362.5"
6
6
  :y1="props.selectedSwitchLineY.y1"
7
7
  x2="362.5"
@@ -1,4 +1,5 @@
1
1
  export enum UI_E_FieldsSphere {
2
+ 'location' = 2,
2
3
  'compute_resource' = 3,
3
4
  'storage.id' = 4,
4
5
  'storage.name' = 4,
@@ -29,6 +30,8 @@ export enum UI_E_FieldsSphere {
29
30
  'network_devices' = 8,
30
31
  }
31
32
  export enum UI_E_FieldsProcurator {
33
+ 'location' = 2, // Только для Сфере
34
+ 'compute_resource' = 3, // Только для Сфере
32
35
  'storage.id' = 4,
33
36
  'storage.name' = 4,
34
37
  'storage.type' = 4,
@@ -59,44 +62,44 @@ export enum UI_E_FieldsProcurator {
59
62
  }
60
63
 
61
64
  // TODO remove because not used
62
- export enum UI_E_GetElemByField {
63
- 'storage.id' = '#none',
64
- 'storage.name' = '#none',
65
- 'storage.type' = '#none',
66
- 'storage.pool' = '#none',
67
- 'compatibility' = '#version-select',
68
- 'guest_os_family' = '#os-select',
69
- 'guest_os_version' = '#os-version-select',
70
- 'machine_type' = '#machine-type-select',
71
- 'cpu.vcpus' = '#vm-wizard-vcpus-field input',
72
- 'cpu.max_vcpus' = '#vm-wizard-max-vcpus-field input',
73
- 'cpu.shares' = '#vm-wizard-shares-field input',
74
- 'cpu.core_per_socket' = '#vm-wizard-core-per-socket-field',
75
- 'cpu.model' = '#vm-wizard-cpu-model-field',
76
- 'memory.size_mb' = '#vm-wizard-memory-field input',
77
- 'memory.limit_mb' = '.memory-limit .combobox-container input',
78
- 'memory.reservation_mb' = '.memory-reservation .combobox-container input',
79
- 'video_card.adapter' = '#vm-wizard-video-card-adapter-field',
80
- 'video_card.displays' = '#vm-wizard-video-card-display-field',
81
- 'video_card.memory_mb' = '#vm-wizard-video-card-memory-field',
82
- 'options.remote_console.type' = '#vm-wizard-remote-console-type-field',
83
- 'options.remote_console.spice.img_compression' = '#vm-wizard-img-compression-field',
84
- 'options.remote_console.spice.jpeg_compression' = '#vm-wizard-jpeg-compression-field',
85
- 'options.remote_console.spice.zlib_glz_compression' = '#vm-wizard-zlib-compression-field',
86
- 'options.remote_console.spice.streaming_mode' = '#vm-wizard-streaming-mode-field',
87
- 'options.boot_options.firmware' = '#vm-wizard-firmware-field',
88
- 'disk_devices.bus' = '.vm-wizard-disk-device-bus-field',
89
- 'disk_devices.target' = '.vm-wizard-disk-device-target-field',
90
- 'disk_devices.provision_type' = '.vm-wizard-disk-device-provisioning-field',
91
- 'disk_devices.disk_mode' = '.vm-wizard-disk-device-mode-field',
92
- 'disk_devices.cache' = '.vm-wizard-disk-device-cache-field',
93
- 'disk_devices.io' = '.vm-wizard-disk-device-io-field',
94
- 'disk_devices.sharing' = '.vm-wizard-disk-device-sharing-field',
95
- 'network_devices.network' = '.vm-wizard-network-field',
96
- 'network_devices.mac_address' = '.vm-wizard-network-mac-address-field',
97
- 'network_devices.model' = '.vm-wizard-network-model-field',
98
- '' = '#none',
99
- }
65
+ // export enum UI_E_GetElemByField {
66
+ // 'storage.id' = '#none',
67
+ // 'storage.name' = '#none',
68
+ // 'storage.type' = '#none',
69
+ // 'storage.pool' = '#none',
70
+ // 'compatibility' = '#version-select',
71
+ // 'guest_os_family' = '#os-select',
72
+ // 'guest_os_version' = '#os-version-select',
73
+ // 'machine_type' = '#machine-type-select',
74
+ // 'cpu.vcpus' = '#vm-wizard-vcpus-field input',
75
+ // 'cpu.max_vcpus' = '#vm-wizard-max-vcpus-field input',
76
+ // 'cpu.shares' = '#vm-wizard-shares-field input',
77
+ // 'cpu.core_per_socket' = '#vm-wizard-core-per-socket-field',
78
+ // 'cpu.model' = '#vm-wizard-cpu-model-field',
79
+ // 'memory.size_mb' = '#vm-wizard-memory-field input',
80
+ // 'memory.limit_mb' = '.memory-limit .combobox-container input',
81
+ // 'memory.reservation_mb' = '.memory-reservation .combobox-container input',
82
+ // 'video_card.adapter' = '#vm-wizard-video-card-adapter-field',
83
+ // 'video_card.displays' = '#vm-wizard-video-card-display-field',
84
+ // 'video_card.memory_mb' = '#vm-wizard-video-card-memory-field',
85
+ // 'options.remote_console.type' = '#vm-wizard-remote-console-type-field',
86
+ // 'options.remote_console.spice.img_compression' = '#vm-wizard-img-compression-field',
87
+ // 'options.remote_console.spice.jpeg_compression' = '#vm-wizard-jpeg-compression-field',
88
+ // 'options.remote_console.spice.zlib_glz_compression' = '#vm-wizard-zlib-compression-field',
89
+ // 'options.remote_console.spice.streaming_mode' = '#vm-wizard-streaming-mode-field',
90
+ // 'options.boot_options.firmware' = '#vm-wizard-firmware-field',
91
+ // 'disk_devices.bus' = '.vm-wizard-disk-device-bus-field',
92
+ // 'disk_devices.target' = '.vm-wizard-disk-device-target-field',
93
+ // 'disk_devices.provision_type' = '.vm-wizard-disk-device-provisioning-field',
94
+ // 'disk_devices.disk_mode' = '.vm-wizard-disk-device-mode-field',
95
+ // 'disk_devices.cache' = '.vm-wizard-disk-device-cache-field',
96
+ // 'disk_devices.io' = '.vm-wizard-disk-device-io-field',
97
+ // 'disk_devices.sharing' = '.vm-wizard-disk-device-sharing-field',
98
+ // 'network_devices.network' = '.vm-wizard-network-field',
99
+ // 'network_devices.mac_address' = '.vm-wizard-network-mac-address-field',
100
+ // 'network_devices.model' = '.vm-wizard-network-model-field',
101
+ // '' = '#none',
102
+ // }
100
103
  export enum UI_E_GetToggleBlockElemByField {
101
104
  'cpu.vcpus' = '.stack-block-expandable #vm-wizard-toggle-block-cpu',
102
105
  'cpu.max_vcpus' = '.stack-block-expandable #vm-wizard-toggle-block-cpu',
@@ -19,6 +19,7 @@ export type UI_T_CustomizeHardwareField =
19
19
 
20
20
  export type UI_T_AllField =
21
21
  | UI_T_CustomizeHardwareField
22
+ | 'location'
22
23
  | 'compute_resource'
23
24
  | 'compatibility'
24
25
  | 'guest_os_family'
@@ -194,6 +194,7 @@ const checkCustomizeHardware = (
194
194
  export const checkAllField = (field: string): field is UI_T_AllField => {
195
195
  return (
196
196
  checkCustomizeHardware(field) ||
197
+ field === 'location' ||
197
198
  field === 'compute_resource' ||
198
199
  field === 'compatibility' ||
199
200
  field === 'guest_os_family' ||
@@ -1,2 +1,14 @@
1
+ import {
2
+ UI_I_AddNetworkingSecondOrThirdSchemeDataSend,
3
+ UI_I_AddNetworkingZeroOrFirstSchemeDataSend,
4
+ UI_I_AddNetworkingFourthOrFifthSchemeDataSend,
5
+ } from '~/components/common/wizards/network/add/lib/models/interfaces'
6
+ import { API_UI_I_SwitchItem } from '~/components/common/diagramMain/lib/models/interfaces'
7
+
1
8
  export type UI_T_TCP = 'default' | 'provisioning' | ''
2
9
  export type UI_T_Project = 'procurator' | 'sphere'
10
+ export type UI_T_EditData =
11
+ | UI_I_AddNetworkingSecondOrThirdSchemeDataSend
12
+ | UI_I_AddNetworkingZeroOrFirstSchemeDataSend
13
+ | UI_I_AddNetworkingFourthOrFifthSchemeDataSend
14
+ | API_UI_I_SwitchItem
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.3.296",
4
+ "version": "1.3.298",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",