diff --git a/striker-ui/components/NetworkInitForm.tsx b/striker-ui/components/NetworkInitForm.tsx index 23278ae4..14b989af 100644 --- a/striker-ui/components/NetworkInitForm.tsx +++ b/striker-ui/components/NetworkInitForm.tsx @@ -272,6 +272,7 @@ const NetworkForm: FC<{ interfaceIndex: number, ) => MUIBoxProps['onMouseUp']; getNetworkTypeCount: GetNetworkTypeCountFunction; + hostDetail?: APIHostDetail; networkIndex: number; networkInput: NetworkInput; networkInterfaceInputMap: NetworkInterfaceInputMap; @@ -286,6 +287,7 @@ const NetworkForm: FC<{ }> = ({ createDropMouseUpHandler, getNetworkTypeCount, + hostDetail: { hostType } = {}, networkIndex, networkInput, networkInterfaceInputMap, @@ -334,6 +336,14 @@ const NetworkForm: FC<{ [inputTestPrefix], ); + const netIfTemplate = useMemo( + () => + hostType !== 'node' && Object.keys(networkInterfaceInputMap).length <= 2 + ? [1] + : NETWORK_INTERFACE_TEMPLATE, + [hostType, networkInterfaceInputMap], + ); + useEffect(() => { const { ipAddressInputRef: ipRef, subnetMaskInputRef: maskRef } = networkInput; @@ -417,7 +427,7 @@ const NetworkForm: FC<{ }, }} > - {NETWORK_INTERFACE_TEMPLATE.map((linkNumber) => { + {netIfTemplate.map((linkNumber) => { const linkName = `Link ${linkNumber}`; const networkInterfaceIndex = linkNumber - 1; const networkInterface = interfaces[networkInterfaceIndex]; @@ -555,6 +565,7 @@ const NetworkForm: FC<{ NetworkForm.defaultProps = { createDropMouseUpHandler: undefined, + hostDetail: undefined, }; const NetworkInitForm = forwardRef<