fix(striker-ui): reset interfaces on remove network

main
Tsu-ba-me 2 years ago
parent 77c65e931a
commit 7d7f2d1616
  1. 17
      striker-ui/components/NetworkInitForm.tsx

@ -976,12 +976,25 @@ const NetworkInitForm = forwardRef<
}, [networkInputs, toggleSubmitDisabled]);
const removeNetwork = useCallback(
(networkIndex: number) => {
const [{ inputUUID }] = networkInputs.splice(networkIndex, 1);
const [{ inputUUID, interfaces }] = networkInputs.splice(networkIndex, 1);
interfaces.forEach((iface) => {
if (iface === undefined) {
return;
}
const { networkInterfaceUUID } = iface;
networkInterfaceInputMap[networkInterfaceUUID].isApplied = false;
});
testInputToToggleSubmitDisabled({ excludeTestIdsRe: RegExp(inputUUID) });
setNetworkInputs([...networkInputs]);
setNetworkInterfaceInputMap((previous) => ({
...previous,
}));
},
[networkInputs, testInputToToggleSubmitDisabled],
[networkInputs, networkInterfaceInputMap, testInputToToggleSubmitDisabled],
);
const getNetworkTypeCount: GetNetworkTypeCountFunction = useCallback(
(

Loading…
Cancel
Save