From 4db9d8b321dc23836967534517c936a45e0e9a78 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Thu, 30 Mar 2023 17:48:58 -0400 Subject: [PATCH] refactor(striker-ui): rename id variables in manifest network input group --- .../ManageManifest/AnNetworkInputGroup.tsx | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/striker-ui/components/ManageManifest/AnNetworkInputGroup.tsx b/striker-ui/components/ManageManifest/AnNetworkInputGroup.tsx index c86c0c14..83c0c576 100644 --- a/striker-ui/components/ManageManifest/AnNetworkInputGroup.tsx +++ b/striker-ui/components/ManageManifest/AnNetworkInputGroup.tsx @@ -106,15 +106,15 @@ const AnNetworkInputGroup = ({ [networkNumber, networkType], ); - const inputCellGatewayId = useMemo( + const inputCellIdGateway = useMemo( () => `${INPUT_CELL_ID_PREFIX_AN}-${networkId}-gateway`, [networkId], ); - const inputCellIpId = useMemo( + const inputCellIdIp = useMemo( () => `${INPUT_CELL_ID_PREFIX_AN}-${networkId}-ip`, [networkId], ); - const inputCellSubnetMaskId = useMemo( + const inputCellIdSubnetMask = useMemo( () => `${INPUT_CELL_ID_PREFIX_AN}-${networkId}-subnet-mask`, [networkId], ); @@ -124,19 +124,19 @@ const AnNetworkInputGroup = ({ [networkId], ); - const inputGatewayId = useMemo( + const inputIdGateway = useMemo( () => buildInputIdANGateway(networkId), [networkId], ); - const inputMinIpId = useMemo( + const inputIdMinIp = useMemo( () => buildInputIdANMinIp(networkId), [networkId], ); - const inputNetworkTypeId = useMemo( + const inputIdNetworkType = useMemo( () => buildInputIdANNetworkType(networkId), [networkId], ); - const inputSubnetMaskId = useMemo( + const inputIdSubnetMask = useMemo( () => buildInputIdANSubnetMask(networkId), [networkId], ); @@ -169,8 +169,8 @@ const AnNetworkInputGroup = ({ const inputGatewayElement = useMemo(() => { let result: ReactNode; - if (isShowGateway && inputGatewayId) { - setMsgSetter(inputGatewayId); + if (isShowGateway && inputIdGateway) { + setMsgSetter(inputIdGateway); result = ( ({ 'data-handler': 'gateway', 'data-network-id': networkId, }} - id={inputGatewayId} + id={inputIdGateway} label={inputGatewayLabel} value={previousGateway} /> @@ -188,18 +188,18 @@ const AnNetworkInputGroup = ({ inputTestBatch={buildIPAddressTestBatch( `${networkName} ${inputGatewayLabel}`, () => { - msgSetters[inputGatewayId](); + msgSetters[inputIdGateway](); }, { - onFinishBatch: buildFinishInputTestBatchFunction(inputGatewayId), + onFinishBatch: buildFinishInputTestBatchFunction(inputIdGateway), }, (message) => { - msgSetters[inputGatewayId]({ + msgSetters[inputIdGateway]({ children: message, }); }, )} - onFirstRender={buildInputFirstRenderFunction(inputGatewayId)} + onFirstRender={buildInputFirstRenderFunction(inputIdGateway)} required={isShowGateway} /> ); @@ -208,7 +208,7 @@ const AnNetworkInputGroup = ({ return result; }, [ isShowGateway, - inputGatewayId, + inputIdGateway, setMsgSetter, networkId, inputGatewayLabel, @@ -220,9 +220,9 @@ const AnNetworkInputGroup = ({ ]); useEffect(() => { - setMsgSetter(inputMinIpId); - setMsgSetter(inputSubnetMaskId); - }, [inputMinIpId, inputSubnetMaskId, setMsgSetter]); + setMsgSetter(inputIdMinIp); + setMsgSetter(inputIdSubnetMask); + }, [inputIdMinIp, inputIdSubnetMask, setMsgSetter]); return ( @@ -230,7 +230,7 @@ const AnNetworkInputGroup = ({ { onNetworkTypeChange?.call( @@ -261,7 +261,7 @@ const AnNetworkInputGroup = ({ /> ({ 'data-handler': 'minip', 'data-network-id': networkId, }} - id={inputMinIpId} + id={inputIdMinIp} label={inputMinIpLabel} value={previousIpAddress} /> @@ -278,24 +278,24 @@ const AnNetworkInputGroup = ({ inputTestBatch={buildIPAddressTestBatch( `${networkName} ${inputMinIpLabel}`, () => { - msgSetters[inputMinIpId](); + msgSetters[inputIdMinIp](); }, { onFinishBatch: - buildFinishInputTestBatchFunction(inputMinIpId), + buildFinishInputTestBatchFunction(inputIdMinIp), }, (message) => { - msgSetters[inputMinIpId]({ + msgSetters[inputIdMinIp]({ children: message, }); }, )} - onFirstRender={buildInputFirstRenderFunction(inputMinIpId)} + onFirstRender={buildInputFirstRenderFunction(inputIdMinIp)} required /> ), }, - [inputCellSubnetMaskId]: { + [inputCellIdSubnetMask]: { children: ( ({ 'data-handler': 'subnetmask', 'data-network-id': networkId, }} - id={inputSubnetMaskId} + id={inputIdSubnetMask} label={inputSubnetMaskLabel} value={previousSubnetMask} /> @@ -313,7 +313,7 @@ const AnNetworkInputGroup = ({ /> ), }, - [inputCellGatewayId]: { + [inputCellIdGateway]: { children: inputGatewayElement, display: inputCellGatewayDisplay, },