|
|
|
@ -198,7 +198,7 @@ const PrepareHostForm: FC = () => { |
|
|
|
|
const accessSection = useMemo( |
|
|
|
|
() => ( |
|
|
|
|
<GateForm |
|
|
|
|
formContainer={isShowAccessSubmit} |
|
|
|
|
allowSubmit={isShowAccessSubmit} |
|
|
|
|
gridProps={{ |
|
|
|
|
wrapperBoxProps: { |
|
|
|
|
sx: { |
|
|
|
@ -218,26 +218,18 @@ const PrepareHostForm: FC = () => { |
|
|
|
|
} |
|
|
|
|
}} |
|
|
|
|
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<APICommandInquireHostResponseBody>( |
|
|
|
|
'/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" |
|
|
|
|