fix(striker-ui): connect prepare network submission with endpoint

main
Tsu-ba-me 1 year ago
parent 9728f56927
commit e436b4de11
  1. 3
      striker-ui/components/NetworkInitForm.tsx
  2. 15
      striker-ui/components/PrepareNetworkForm.tsx

@ -84,7 +84,7 @@ type NetworkInitFormValues = {
networks: Omit<NetworkInput, 'ipAddressInputRef' | 'subnetMaskInputRef'>[];
};
type NetworkInitFormForwardedRefContent = {
type NetworkInitFormForwardedRefContent = MessageGroupForwardedRefContent & {
get?: () => NetworkInitFormValues;
};
@ -1271,6 +1271,7 @@ const NetworkInitForm = forwardRef<
useImperativeHandle(
ref,
() => ({
...messageGroupRef.current,
get: () => ({
dns: dnsCSVInputRef.current.getValue?.call(null),
gateway: gatewayInputRef.current.getValue?.call(null),

@ -123,6 +123,7 @@ const PrepareNetworkForm: FC<PrepareNetworkFormProps> = ({
isFormInvalid,
setMessage,
setValidity,
submitForm,
} = useFormUtils(
[INPUT_ID_PREP_NET_HOST_NAME, INPUT_GROUP_ID_PREP_NET_NETCONF],
generalInputMessageGroupRef,
@ -204,6 +205,18 @@ const PrepareNetworkForm: FC<PrepareNetworkFormProps> = ({
}
/>
),
onProceedAppend: () => {
submitForm({
body,
getErrorMsg: (parentMsg) => (
<>Failed to prepare network. {parentMsg}</>
),
method: 'put',
setMsg: netconfFormRef?.current?.setMessage,
successMsg: `Initiated prepare network on ${hostDetail?.shortHostName}`,
url: `/host/${hostUUID}?handler=subnode-network`,
});
},
titleText: `Prepare ${hostDetail?.shortHostName} network?`,
});
@ -265,6 +278,8 @@ const PrepareNetworkForm: FC<PrepareNetworkFormProps> = ({
netconfForm,
isFormInvalid,
setConfirmDialogProps,
submitForm,
hostUUID,
setMessage,
]);

Loading…
Cancel
Save