fix(striker-ui): unset message and validity where necessary in manage manifest

main
Tsu-ba-me 2 years ago
parent bc25f1a2ad
commit 4bbd8a32f3
  1. 3
      striker-ui/components/ManageManifest/AnHostInputGroup.tsx
  2. 10
      striker-ui/components/ManageManifest/AnNetworkConfigInputGroup.tsx
  3. 4
      striker-ui/components/ManageManifest/AnNetworkInputGroup.tsx

@ -109,6 +109,7 @@ const AnHostInputGroup = <M extends MapToInputTestID>({
formUtils: { formUtils: {
buildFinishInputTestBatchFunction, buildFinishInputTestBatchFunction,
buildInputFirstRenderFunction, buildInputFirstRenderFunction,
buildInputUnmountFunction,
setMessage, setMessage,
}, },
hostId, hostId,
@ -233,6 +234,7 @@ const AnHostInputGroup = <M extends MapToInputTestID>({
}, },
)} )}
onFirstRender={buildInputFirstRenderFunction(inputId)} onFirstRender={buildInputFirstRenderFunction(inputId)}
onUnmount={buildInputUnmountFunction(inputId)}
required required
/> />
), ),
@ -247,6 +249,7 @@ const AnHostInputGroup = <M extends MapToInputTestID>({
hostId, hostId,
buildFinishInputTestBatchFunction, buildFinishInputTestBatchFunction,
buildInputFirstRenderFunction, buildInputFirstRenderFunction,
buildInputUnmountFunction,
setMessage, setMessage,
], ],
); );

@ -51,7 +51,7 @@ const AnNetworkConfigInputGroup = <
buildFinishInputTestBatchFunction, buildFinishInputTestBatchFunction,
buildInputFirstRenderFunction, buildInputFirstRenderFunction,
setMessage, setMessage,
unsetKeyRe, setMessageRe,
} = formUtils; } = formUtils;
const getNetworkNumber = useCallback( const getNetworkNumber = useCallback(
@ -140,8 +140,8 @@ const AnNetworkConfigInputGroup = <
if (networkId === targetId) { if (networkId === targetId) {
isIdMatch = true; isIdMatch = true;
networkType = newType; networkType = newType;
setMessageRe(RegExp(networkId));
} }
const isTypeMatch = networkType === newType; const isTypeMatch = networkType === newType;
@ -173,7 +173,7 @@ const AnNetworkConfigInputGroup = <
setNetworkList(newList); setNetworkList(newList);
}, },
[networkListEntries, setNetworkList], [networkListEntries, setMessageRe, setNetworkList],
); );
const handleNetworkRemove = useCallback<AnNetworkCloseEventHandler>( const handleNetworkRemove = useCallback<AnNetworkCloseEventHandler>(
@ -185,8 +185,6 @@ const AnNetworkConfigInputGroup = <
(previous, [networkId, networkValue]) => { (previous, [networkId, networkValue]) => {
if (networkId === rmId) { if (networkId === rmId) {
isIdMatch = true; isIdMatch = true;
unsetKeyRe(RegExp(rmId));
} else { } else {
const { networkType } = networkValue; const { networkType } = networkValue;
@ -206,7 +204,7 @@ const AnNetworkConfigInputGroup = <
setNetworkList(newList); setNetworkList(newList);
}, },
[networkListEntries, setNetworkList, unsetKeyRe], [networkListEntries, setNetworkList],
); );
const networksGridLayout = useMemo<GridLayout>(() => { const networksGridLayout = useMemo<GridLayout>(() => {

@ -80,6 +80,7 @@ const AnNetworkInputGroup = <M extends MapToInputTestID>({
formUtils: { formUtils: {
buildFinishInputTestBatchFunction, buildFinishInputTestBatchFunction,
buildInputFirstRenderFunction, buildInputFirstRenderFunction,
buildInputUnmountFunction,
setMessage, setMessage,
}, },
inputGatewayLabel = 'Gateway', inputGatewayLabel = 'Gateway',
@ -195,6 +196,7 @@ const AnNetworkInputGroup = <M extends MapToInputTestID>({
}, },
)} )}
onFirstRender={buildInputFirstRenderFunction(inputIdGateway)} onFirstRender={buildInputFirstRenderFunction(inputIdGateway)}
onUnmount={buildInputUnmountFunction(inputIdGateway)}
required={isShowGateway} required={isShowGateway}
/> />
); );
@ -210,6 +212,7 @@ const AnNetworkInputGroup = <M extends MapToInputTestID>({
networkName, networkName,
buildFinishInputTestBatchFunction, buildFinishInputTestBatchFunction,
buildInputFirstRenderFunction, buildInputFirstRenderFunction,
buildInputUnmountFunction,
setMessage, setMessage,
]); ]);
@ -278,6 +281,7 @@ const AnNetworkInputGroup = <M extends MapToInputTestID>({
}, },
)} )}
onFirstRender={buildInputFirstRenderFunction(inputIdMinIp)} onFirstRender={buildInputFirstRenderFunction(inputIdMinIp)}
onUnmount={buildInputUnmountFunction(inputIdMinIp)}
required required
/> />
), ),

Loading…
Cancel
Save