diff --git a/striker-ui/components/ManageManifest/AnNetworkConfigInputGroup.tsx b/striker-ui/components/ManageManifest/AnNetworkConfigInputGroup.tsx index 28d598c8..28cdfd8a 100644 --- a/striker-ui/components/ManageManifest/AnNetworkConfigInputGroup.tsx +++ b/striker-ui/components/ManageManifest/AnNetworkConfigInputGroup.tsx @@ -225,14 +225,6 @@ const AnNetworkConfigInputGroup = < ) => { const cellId = `${INPUT_CELL_ID_PREFIX_ANC}-${networkId}`; - const idPrefix = `an-network-${networkId}`; - - const inputIdPrefix = `${INPUT_ID_PREFIX_AN_NETWORK_CONFIG}-${networkId}`; - const inputGatewayId = `${inputIdPrefix}-gateway`; - const inputMinIpId = `${inputIdPrefix}-min-ip`; - const inputNetworkTypeId = `${inputIdPrefix}-network-type`; - const inputSubnetMaskId = `${inputIdPrefix}-subnet-mask`; - const isFirstNetwork = networkNumber === 1; const isIfn = assertIfn(networkType); const isMn = assertMn(networkType); @@ -242,11 +234,6 @@ const AnNetworkConfigInputGroup = < children: ( + `${INPUT_ID_PREFIX_AN_NETWORK}-${networkId}-gateway`; + +const buildInputIdANMinIp = (networkId: string): string => + `${INPUT_ID_PREFIX_AN_NETWORK}-${networkId}-min-ip`; + +const buildInputIdANNetworkType = (networkId: string): string => + `${INPUT_ID_PREFIX_AN_NETWORK}-${networkId}-network-type`; + +const buildInputIdANSubnetMask = (networkId: string): string => + `${INPUT_ID_PREFIX_AN_NETWORK}-${networkId}-subnet-mask`; + const AnNetworkInputGroup = ({ formUtils: { buildFinishInputTestBatchFunction, @@ -17,13 +33,8 @@ const AnNetworkInputGroup = ({ msgSetters, setMsgSetter, }, - idPrefix, - inputGatewayId, inputGatewayLabel = 'Gateway', - inputMinIpId, inputMinIpLabel = 'IP address', - inputNetworkTypeId, - inputSubnetMaskId, inputSubnetMaskLabel = 'Subnet mask', networkId, networkNumber, @@ -46,13 +57,33 @@ const AnNetworkInputGroup = ({ ); const inputCellGatewayId = useMemo( - () => `${idPrefix}-input-cell-gateway`, - [idPrefix], + () => `${INPUT_CELL_ID_PREFIX_AN}-${networkId}-gateway`, + [networkId], + ); + const inputCellIpId = useMemo( + () => `${INPUT_CELL_ID_PREFIX_AN}-${networkId}-ip`, + [networkId], ); - const inputCellIpId = useMemo(() => `${idPrefix}-input-cell-ip`, [idPrefix]); const inputCellSubnetMaskId = useMemo( - () => `${idPrefix}-input-cell-subnet-mask`, - [idPrefix], + () => `${INPUT_CELL_ID_PREFIX_AN}-${networkId}-subnet-mask`, + [networkId], + ); + + const inputGatewayId = useMemo( + () => buildInputIdANGateway(networkId), + [networkId], + ); + const inputMinIpId = useMemo( + () => buildInputIdANMinIp(networkId), + [networkId], + ); + const inputNetworkTypeId = useMemo( + () => buildInputIdANNetworkType(networkId), + [networkId], + ); + const inputSubnetMaskId = useMemo( + () => buildInputIdANSubnetMask(networkId), + [networkId], ); const inputCellGatewayDisplay = useMemo( @@ -217,4 +248,11 @@ const AnNetworkInputGroup = ({ ); }; +export { + buildInputIdANGateway, + buildInputIdANMinIp, + buildInputIdANNetworkType, + buildInputIdANSubnetMask, +}; + export default AnNetworkInputGroup; diff --git a/striker-ui/types/ManageManifest.d.ts b/striker-ui/types/ManageManifest.d.ts index c5dac67f..06eedbdf 100644 --- a/striker-ui/types/ManageManifest.d.ts +++ b/striker-ui/types/ManageManifest.d.ts @@ -87,7 +87,6 @@ type AnNetworkTypeChangeEventHandler = ( ) => ReturnType; type AnNetworkInputGroupOptionalProps = { - inputGatewayId?: string; inputGatewayLabel?: string; inputMinIpLabel?: string; inputSubnetMaskLabel?: string; @@ -106,10 +105,6 @@ type AnNetworkInputGroupOptionalProps = { type AnNetworkInputGroupProps = AnNetworkInputGroupOptionalProps & { formUtils: FormUtils; - idPrefix: string; - inputMinIpId: string; - inputNetworkTypeId: string; - inputSubnetMaskId: string; networkId: string; networkNumber: number; networkType: string;