fix(striker-ui): reflect GateForm changes in PrepareHostForm

main
Tsu-ba-me 2 years ago
parent 7f826132a4
commit 4fc2655a44
  1. 38
      striker-ui/components/PrepareHostForm.tsx
  2. 8
      striker-ui/types/APICommand.d.ts

@ -198,7 +198,7 @@ const PrepareHostForm: FC = () => {
const accessSection = useMemo( const accessSection = useMemo(
() => ( () => (
<GateForm <GateForm
formContainer={isShowAccessSubmit} allowSubmit={isShowAccessSubmit}
gridProps={{ gridProps={{
wrapperBoxProps: { wrapperBoxProps: {
sx: { sx: {
@ -218,26 +218,18 @@ const PrepareHostForm: FC = () => {
} }
}} }}
onSubmitAppend={( onSubmitAppend={(
{ getValue: getIdentifier }, ipAddress,
{ getValue: getPassphrase }, password,
setMessage, setGateMessage,
setIsSubmitting, setGateIsSubmitting,
) => { ) => {
const identifierValue = getIdentifier?.call(null); const body = { ipAddress, password };
const passphraseValue = getPassphrase?.call(null);
api api
.put<{ .put<APICommandInquireHostResponseBody>(
hostName: string; '/command/inquire-host',
hostOS: string; body,
hostUUID: string; )
isConnected: boolean;
isInetConnected: boolean;
isOSRegistered: boolean;
}>('/command/inquire-host', {
ipAddress: identifierValue,
password: passphraseValue,
})
.then( .then(
({ ({
data: { data: {
@ -265,14 +257,14 @@ const PrepareHostForm: FC = () => {
setIsShowRedhatSection(true); setIsShowRedhatSection(true);
} }
setConnectedHostIPAddress(identifierValue); setConnectedHostIPAddress(ipAddress);
setConnectedHostPassword(passphraseValue); setConnectedHostPassword(password);
setConnectedHostUUID(hostUUID); setConnectedHostUUID(hostUUID);
setIsShowAccessSubmit(false); setIsShowAccessSubmit(false);
setIsShowOptionalSection(true); setIsShowOptionalSection(true);
} else { } else {
setMessage?.call(null, { setGateMessage({
children: `Failed to establish a connection with the given host credentials.`, children: `Failed to establish a connection with the given host credentials.`,
type: 'error', type: 'error',
}); });
@ -282,10 +274,10 @@ const PrepareHostForm: FC = () => {
.catch((apiError) => { .catch((apiError) => {
const emsg = handleAPIError(apiError); const emsg = handleAPIError(apiError);
setMessage?.call(null, emsg); setGateMessage?.call(null, emsg);
}) })
.finally(() => { .finally(() => {
setIsSubmitting(false); setGateIsSubmitting(false);
}); });
}} }}
passphraseLabel="Host root password" passphraseLabel="Host root password"

@ -0,0 +1,8 @@
type APICommandInquireHostResponseBody = {
hostName: string;
hostOS: string;
hostUUID: string;
isConnected: boolean;
isInetConnected: boolean;
isOSRegistered: boolean;
};
Loading…
Cancel
Save