Skip to content

Commit dd67375

Browse files
Merge pull request #145 from openshift-cherrypick-robot/cherry-pick-143-to-release-4.21
[release-4.21] CNV-76214: hide used interface in the form
2 parents 2254c98 + 3d0b662 commit dd67375

File tree

2 files changed

+14
-3
lines changed
  • src/utils/components/PolicyForm/PolicyWizard/utils/hooks/useNodeInterfaces/utils

2 files changed

+14
-3
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { InterfaceType } from '@kubevirt-ui/kubevirt-api/nmstate';
2+
3+
export const GENEV_INTERFACE_PREFIX = 'genev_';
4+
5+
export const bridgeTypes = [
6+
InterfaceType.OVS_BRIDGE,
7+
InterfaceType.LINUX_BRIDGE,
8+
InterfaceType.BOND,
9+
];

src/utils/components/PolicyForm/PolicyWizard/utils/hooks/useNodeInterfaces/utils/utils.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import {
77
} from '@kubevirt-ui/kubevirt-api/nmstate';
88
import { getInterfaces } from '@utils/resources/nns/getters';
99
import { getEthernetInterfaces } from '@utils/resources/nns/utils';
10-
11-
const bridgeTypes = [InterfaceType.OVS_BRIDGE, InterfaceType.LINUX_BRIDGE, InterfaceType.BOND];
10+
import { bridgeTypes, GENEV_INTERFACE_PREFIX } from './constants';
1211

1312
export const getExistingInterfaceNames = (nodeNetworkStates: V1beta1NodeNetworkState[]) => {
1413
const uniqueInterfaceNames = nodeNetworkStates.reduce((acc, nns) => {
@@ -35,7 +34,10 @@ const getUsedPortNamesForNode = (nns: V1beta1NodeNetworkState) => {
3534
export const getAvailableInterfacesForNode = (nns: V1beta1NodeNetworkState) => {
3635
const usedPortNames = getUsedPortNamesForNode(nns);
3736
const allEthernetInterfaces = getEthernetInterfaces(nns);
38-
return allEthernetInterfaces?.filter((iface) => usedPortNames.includes(iface?.name));
37+
return allEthernetInterfaces?.filter(
38+
(iface) =>
39+
!usedPortNames.includes(iface?.name) && !iface?.name?.startsWith(GENEV_INTERFACE_PREFIX),
40+
);
3941
};
4042

4143
const nnsInterfaceComparator = (

0 commit comments

Comments
 (0)