diff --git a/striker-ui/components/PrepareHostForm.tsx b/striker-ui/components/PrepareHostForm.tsx index 7f416cfd..0ea5017e 100644 --- a/striker-ui/components/PrepareHostForm.tsx +++ b/striker-ui/components/PrepareHostForm.tsx @@ -198,7 +198,7 @@ const PrepareHostForm: FC = () => { const accessSection = useMemo( () => ( { } }} onSubmitAppend={( - { getValue: getIdentifier }, - { getValue: getPassphrase }, - setMessage, - setIsSubmitting, + ipAddress, + password, + setGateMessage, + setGateIsSubmitting, ) => { - const identifierValue = getIdentifier?.call(null); - const passphraseValue = getPassphrase?.call(null); + const body = { ipAddress, password }; api - .put<{ - hostName: string; - hostOS: string; - hostUUID: string; - isConnected: boolean; - isInetConnected: boolean; - isOSRegistered: boolean; - }>('/command/inquire-host', { - ipAddress: identifierValue, - password: passphraseValue, - }) + .put( + '/command/inquire-host', + body, + ) .then( ({ data: { @@ -265,14 +257,14 @@ const PrepareHostForm: FC = () => { setIsShowRedhatSection(true); } - setConnectedHostIPAddress(identifierValue); - setConnectedHostPassword(passphraseValue); + setConnectedHostIPAddress(ipAddress); + setConnectedHostPassword(password); setConnectedHostUUID(hostUUID); setIsShowAccessSubmit(false); setIsShowOptionalSection(true); } else { - setMessage?.call(null, { + setGateMessage({ children: `Failed to establish a connection with the given host credentials.`, type: 'error', }); @@ -282,10 +274,10 @@ const PrepareHostForm: FC = () => { .catch((apiError) => { const emsg = handleAPIError(apiError); - setMessage?.call(null, emsg); + setGateMessage?.call(null, emsg); }) .finally(() => { - setIsSubmitting(false); + setGateIsSubmitting(false); }); }} passphraseLabel="Host root password" diff --git a/striker-ui/types/APICommand.d.ts b/striker-ui/types/APICommand.d.ts new file mode 100644 index 00000000..e8a084d6 --- /dev/null +++ b/striker-ui/types/APICommand.d.ts @@ -0,0 +1,8 @@ +type APICommandInquireHostResponseBody = { + hostName: string; + hostOS: string; + hostUUID: string; + isConnected: boolean; + isInetConnected: boolean; + isOSRegistered: boolean; +};